1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175. | #include <amxmodx>
#include <amxmisc>
#define PLUGIN "Tutor Text"
#define VERSION "1.0"
#define AUTHOR "Zepa"
#define TUTORIAL 1001
#define TASK_TUT 1111
enum { RED = 1, BLUE, YELLOW, GREEN }
new const g_TutorPrecache[][] = { "gfx/career/icon_!.tga", "gfx/career/icon_!-bigger.tga", "gfx/career/icon_i.tga", "gfx/career/icon_i-bigger.tga", "gfx/career/icon_skulls.tga", "gfx/career/round_corner_ne.tga", "gfx/career/round_corner_nw.tga", "gfx/career/round_corner_se.tga", "gfx/career/round_corner_sw.tga", "resource/TutorScheme.res", "resource/UI/TutorTextWindow.res" }
new g_MsgTutor
new g_MsgTutClose
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_tutor", "cmdTsaykon", ADMIN_CHAT, "<kolor> <wiadomosc>")
register_clcmd("say", "cmdTsaygra", ADMIN_CHAT, "# <kolor> <wiadomosc> - komenda amx_tutor")
g_MsgTutor = get_user_msgid("TutorText")
g_MsgTutClose = get_user_msgid("TutorClose")
}
public plugin_precache()
{
new i
for(i = 0; i < sizeof g_TutorPrecache; i++)
{
precache_generic(g_TutorPrecache[i])
}
}
MakeTutor(id,Text[],Color,Float:Time = 0.0)
{
if(is_user_connected( id ))
{
if(!id){
message_begin(MSG_ALL,g_MsgTutor)
write_string(Text)
write_byte(0)
write_short(0)
write_short(0)
write_short(1<<Color)
message_end()
}
else
{
message_begin(MSG_ONE_UNRELIABLE,g_MsgTutor,_,id)
write_string(Text)
write_byte(0)
write_short(0)
write_short(0)
write_short(1<<Color)
message_end()
}
}
if(Time != 0.0)
{
if( task_exists( id + TASK_TUT ) )
{
remove_task( id + TASK_TUT )
}
set_task(Time,"RemoveTutor",id + TASK_TUT)
}
}
public RemoveTutor(taskID)
{
new id = taskID - TASK_TUT
if(!id){
message_begin(MSG_ALL,g_MsgTutClose,_,id)
message_end()
}
else
{
message_begin(MSG_ONE_UNRELIABLE,g_MsgTutClose,_,id)
message_end()
}
}
public cmdTsaykon(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new color[16], message[192], name[32], Text[100]
read_args(message, 191)
remove_quotes(message)
parse(message, color, 15)
new length = (strlen(color) + 1)
get_user_name(id, name, 31)
formatex(Text,191,"%s", message[length]);
for(new i=1; i<=33; i++){
if(is_user_connected(i))
if(color[0] == 'g')
MakeTutor(i,Text,GREEN,10.0)
else if(color[0] == 'r')
MakeTutor(i,Text,RED,10.0)
else if(color[0] == 'y')
MakeTutor(i,Text,YELLOW,10.0)
else
MakeTutor(i,Text,BLUE,10.0)
}
return PLUGIN_HANDLED
}
public cmdTsaygra(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new said[6], i = 0, color[16], Text[100]
read_argv(1, said, 5)
while (said[i] == '#')
{
i++
}
if (!i || i > 3)
{
return PLUGIN_CONTINUE
}
new message[192], a = 0
read_args(message, 191)
remove_quotes(message)
parse(message, color, 15)
new length = (strlen(color) + 1)
new n, s = i
if (a)
{
n++
s++
}
while (said[s] && isspace(said[s]))
{
n++
s++
}
new name[32]
get_user_name(id, name, 31)
formatex(Text,191,"%s", message[length]);
for(new i=1; i<=33; i++){
{
if (is_user_connected(i))
{
if(said[i] == 'g')
MakeTutor(i,Text,GREEN,10.0)
else if(said[i] == 'r')
MakeTutor(i,Text,RED,10.0)
else if(said[i] == 'y')
MakeTutor(i,Text,YELLOW,10.0)
else
MakeTutor(i,Text,BLUE,10.0)
}
}
}
return PLUGIN_HANDLED
}
|