1
1
#include < a_samp>
2
- #include < file>
3
2
#include < a_amx>
4
- new bot = 0 ;
5
- new bots = 0 ;
6
- new marker = 0 ;
3
+
4
+ new bot, bots, marker;
7
5
8
6
main ()
9
7
{
@@ -22,7 +20,7 @@ public OnGameModeInit()
22
20
new File: f = fopen (" file.txt" , io_read);
23
21
if (f == File: 0 )
24
22
{
25
- printf (" There is a problem with openning the file." );
23
+ printf (" There is a problem with opening the file." );
26
24
}
27
25
else
28
26
{
@@ -34,13 +32,16 @@ public OnGameModeInit()
34
32
}
35
33
36
34
AddPlayerClass (0 , 1958 .3783 , 1343 .1572 , 15 .3746 , 269 .1425 , 0 , 0 , 0 , 0 , 0 , 0 );
37
- SetRuleValue ( " nya " , " test " );
35
+
38
36
new buf[64 ];
37
+ SetRuleValue (" nya" , " test" );
39
38
GetRuleValue (" nya" , buf, sizeof (buf));
40
39
printf (" val: %s " , buf);
40
+
41
41
bot = CreateBot (0 , 0 .5 , 0 .5 , 0 .5 , " Nyashk" );
42
42
GetBotName (bot, buf, sizeof (buf));
43
43
printf (" bot: %s " , buf);
44
+
44
45
printf (" sss: %d " , GetWaveHeight ());
45
46
SetWaveHeight (15 );
46
47
printf (" sss: %d " , GetWaveHeight ());
@@ -76,48 +77,51 @@ public OnPlayerConnect(playerid)
76
77
CreateBot (0 , 0 .5 , 0 .5 , 0 .5 );
77
78
CreateBot (0 , 0 .5 , 0 .5 , 0 .5 );
78
79
bot = CreateBot (0 , 0 .5 , 0 .5 , 0 .5 , " Nyashk" );
80
+
79
81
SetPlayerHealth (playerid, 50 .0 );
80
82
SetPlayerBlurLevel (playerid, 0 );
83
+
81
84
new listitems[] = " 1\t Deagle\n 2\t Sawnoff\n 3\t Pistol\n 4\t Grenade\n 5\t Parachute\n 6\t Lorikeet" ;
82
- ShowPlayerDialog (playerid,2 , DIALOG_STYLE_LIST," List of weapons:" ,listitems," Select" ," Cancel" );
85
+ ShowPlayerDialog (playerid, 2 , DIALOG_STYLE_LIST, " List of weapons:" , listitems, " Select" , " Cancel" );
83
86
// ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "testcapt", "info", "Okay", "Canceled");
84
87
return 1 ;
85
88
}
89
+
86
90
forward OnDialogResponse (playerid, dialogid, response, listitem, inputtext[]);
87
91
public OnDialogResponse (playerid, dialogid, response, listitem, inputtext[])
88
92
{
89
93
if (dialogid == 0 ) { // Our example msgbox
90
94
if (response) {
91
- SendClientMessage (playerid,0x FFFFFFFF ," You selected OK" );
95
+ SendClientMessage (playerid, 0x FFFFFFFF , " You selected OK" );
92
96
} else {
93
- SendClientMessage (playerid,0x FFFFFFFF ," You selected Cancel" );
97
+ SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
94
98
}
95
99
return 1 ; // we processed this. no need for other filterscripts to process it.
96
100
}
97
101
98
102
if (dialogid == 1 ) { // Our example inputbox
99
103
if (response) {
100
- new message[256 + 1 ];
101
- format (message, 256 , " You replied: %s " , inputtext);
102
- SendClientMessage (playerid, 0x FFFFFFFF , message);
104
+ new message[256 + 1 ];
105
+ format (message, sizeof (message) , " You replied: %s " , inputtext);
106
+ SendClientMessage (playerid, 0x FFFFFFFF , message);
103
107
} else {
104
- SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
108
+ SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
105
109
}
106
110
return 1 ; // we processed it.
107
111
}
108
112
109
113
if (dialogid == 2 ) { // Our example listbox
110
114
if (response) {
111
- new message[256 + 1 ];
115
+ new message[256 + 1 ];
112
116
if (listitem != 5 ) {
113
- format (message, 256 , " You selected item %d :" , listitem);
114
- SendClientMessage (playerid, 0x FFFFFFFF , message);
115
- SendClientMessage (playerid, 0x FFFFFFFF , inputtext);
117
+ format (message, sizeof (message) , " You selected item %d :" , listitem);
118
+ SendClientMessage (playerid, 0x FFFFFFFF , message);
119
+ SendClientMessage (playerid, 0x FFFFFFFF , inputtext);
116
120
} else {
117
- SendClientMessage (playerid, 0x 5555FFFF , " A Lorikeet is NOT a weapon!" );
121
+ SendClientMessage (playerid, 0x 5555FFFF , " A Lorikeet is NOT a weapon!" );
118
122
}
119
123
} else {
120
- SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
124
+ SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
121
125
}
122
126
return 1 ; // we processed it.
123
127
}
@@ -134,18 +138,21 @@ public OnPlayerDisconnect(playerid, reason)
134
138
public OnMarkerCreate (markerid)
135
139
{
136
140
printf (" OnMarkerCreate(%d )" , markerid);
141
+ return 1 ;
137
142
}
138
143
139
144
public OnPlayerSpawn (playerid)
140
145
{
141
146
new Float: x, Float: y, Float: z;
142
147
GetPlayerPos (playerid, x, y, z);
143
148
marker = CreateMarker (x, y, z, " checkpoint" , 3 .0 , 255 , 0 , 0 , 250 );
149
+
144
150
CreateBot (0 , x, y, z);
145
151
SetBotPos (bot, x, y, z);
146
- SetPlayerHealth (playerid, 50 .0 );
147
152
SetBotHealth (bot, 100 .0 );
148
153
SetBotArmour (bot, 5 .0 );
154
+
155
+ SetPlayerHealth (playerid, 50 .0 );
149
156
GivePlayerWeapon (playerid, 32 , 500 );
150
157
return 1 ;
151
158
}
@@ -156,39 +163,45 @@ public OnBotConnect(botid, name[])
156
163
printf (" Bot connected: %d [%s ]" , botid, name);
157
164
return 1 ;
158
165
}
166
+
159
167
public OnMarkerHit (markerid, elemtype[], elemid, matchingDimension)
160
168
{
161
169
printf (" OnMarkerHit(%d , %s , %d )" , markerid, elemtype, elemid);
170
+ return 1 ;
162
171
}
163
172
164
173
public OnBotEnterVehicle (botid, vehicleid, seatid)
165
174
{
166
-
175
+ return 1 ;
167
176
}
168
177
169
178
public OnBotExitVehicle (botid, vehicleid)
170
179
{
171
-
180
+ return 1 ;
172
181
}
173
182
174
183
public OnBotDeath (botid, killerid, weaponid, bodypart)
175
184
{
176
185
printf (" OnBotDeath(%d , %d , %d , %d )" , botid, killerid, weaponid, bodypart);
186
+ return 1 ;
177
187
}
178
188
179
189
public OnPlayerWeaponSwitch (playerid, previousWeaponID, currentWeaponID)
180
190
{
181
- printf (" OnPlayerWeaponSwitch(%d , %d , %d )" ,playerid, previousWeaponID, currentWeaponID);
191
+ printf (" OnPlayerWeaponSwitch(%d , %d , %d )" , playerid, previousWeaponID, currentWeaponID);
192
+ return 1 ;
182
193
}
183
194
184
195
public OnPlayerShoot (playerid, weapon, ammo, ammoInClip, Float: hitX, Float: hitY, Float: hitZ)
185
196
{
186
- printf (" OnPlayerShoot(%d , %d , %d , %d , %f , %f , %f )" ,playerid, weapon, ammo, ammoInClip, hitX, hitY, hitZ);
197
+ printf (" OnPlayerShoot(%d , %d , %d , %d , %f , %f , %f )" , playerid, weapon, ammo, ammoInClip, hitX, hitY, hitZ);
198
+ return 1 ;
187
199
}
188
200
189
201
public OnVehicleDamage (vehicleid, Float: loss)
190
202
{
191
203
printf (" OnVehicleDamage(%d , %f )" , vehicleid, loss);
204
+ return 1 ;
192
205
}
193
206
194
207
public OnPlayerDeath (playerid, killerid, reason)
@@ -211,10 +224,6 @@ public OnPlayerText(playerid, text[])
211
224
return 1 ;
212
225
}
213
226
214
- public OnPlayerPrivmsg (playerid, recieverid, text[])
215
- {
216
- return 1 ;
217
- }
218
227
strtok (const string[], & index)
219
228
{
220
229
new length = strlen (string);
@@ -233,41 +242,41 @@ strtok(const string[], &index)
233
242
result[index - offset] = EOS;
234
243
return result;
235
244
}
245
+
236
246
public OnPlayerCommandText (playerid, cmdtext[])
237
247
{
238
- new cmd[256 ];
239
- new idx;
248
+ new cmd[256 ], idx;
240
249
cmd = strtok (cmdtext, idx);
250
+
241
251
if (strcmp (cmd, " /testmsgbox" , true ) == 0 ) {
242
- ShowPlayerDialog (playerid,0 , DIALOG_STYLE_MSGBOX," Welcome" ," Welcome to the SA-MP 0.3 server. This is test_cmds.pwn /testmsgbox\n Hope it's useful to you." ," OK" ," Cancel" );
243
- return 1 ;
252
+ ShowPlayerDialog (playerid, 0 , DIALOG_STYLE_MSGBOX, " Welcome" , " Welcome to the SA-MP 0.3 server. This is test_cmds.pwn /testmsgbox\n Hope it's useful to you." , " OK" , " Cancel" );
253
+ return 1 ;
244
254
}
245
255
246
256
if (strcmp (cmd, " /testmsgbox2" , true ) == 0 ) {
247
- ShowPlayerDialog (playerid,0 , DIALOG_STYLE_MSGBOX," Welcome" ," Welcome:\t Info\n Test:\t\t Tabulated\n Line:\t\t Hello" ," OK" ," Cancel" );
248
- return 1 ;
257
+ ShowPlayerDialog (playerid, 0 , DIALOG_STYLE_MSGBOX, " Welcome" , " Welcome:\t Info\n Test:\t\t Tabulated\n Line:\t\t Hello" , " OK" , " Cancel" );
258
+ return 1 ;
249
259
}
250
260
251
261
if (strcmp (cmd, " /testinputbox" , true ) == 0 ) {
252
- new loginmsg[256 + 1 ];
253
- new loginname[MAX_PLAYER_NAME+ 1 ];
254
- GetPlayerName (playerid,loginname,MAX_PLAYER_NAME);
255
- format (loginmsg,256 ," Welcome to the SA-MP 0.3 server.\n\n Account:\t %s \n\n Please enter your password below:" ,loginname);
256
- ShowPlayerDialog (playerid,1 ,DIALOG_STYLE_INPUT," Login to SA-MP" ,loginmsg," Login" ," Cancel" );
257
- return 1 ;
262
+ new loginmsg[256 + 1 ], loginname[MAX_PLAYER_NAME + 1 ];
263
+ GetPlayerName (playerid, loginname, MAX_PLAYER_NAME);
264
+ format (loginmsg, sizeof (loginmsg), " Welcome to the SA-MP 0.3 server.\n\n Account:\t %s \n\n Please enter your password below:" , loginname);
265
+ ShowPlayerDialog (playerid, 1 , DIALOG_STYLE_INPUT, " Login to SA-MP" , loginmsg, " Login" , " Cancel" );
266
+ return 1 ;
258
267
}
259
268
260
269
if (strcmp (cmd, " /testlistbox" , true ) == 0 ) {
261
- new listitems[] = " 1\t Deagle\n 2\t Sawnoff\n 3\t Pistol\n 4\t Grenade\n 5\t Parachute\n 6\t Lorikeet" ;
262
- ShowPlayerDialog (playerid,2 , DIALOG_STYLE_LIST," List of weapons:" ,listitems," Select" ," Cancel" );
263
- return 1 ;
270
+ new listitems[] = " 1\t Deagle\n 2\t Sawnoff\n 3\t Pistol\n 4\t Grenade\n 5\t Parachute\n 6\t Lorikeet" ;
271
+ ShowPlayerDialog (playerid, 2 , DIALOG_STYLE_LIST, " List of weapons:" , listitems, " Select" , " Cancel" );
272
+ return 1 ;
264
273
}
265
274
return 0 ;
266
275
}
267
276
268
277
public OnPlayerKeyStateChange (playerid, newkeys, oldkeys)
269
278
{
270
-
279
+ return 1 ;
271
280
}
272
281
273
282
public OnPlayerInfoChange (playerid)
@@ -284,7 +293,7 @@ public OnPlayerExitVehicle(playerid, vehicleid)
284
293
{
285
294
return 1 ;
286
295
}
287
- forward OnBotStateChange (botid, newstate, oldstate);
296
+
288
297
public OnBotStateChange (botid, newstate, oldstate)
289
298
{
290
299
return 1 ;
0 commit comments