Skip to content

Commit bbe6d9b

Browse files
committed
Tidied up samp test scripts
1 parent e0d522e commit bbe6d9b

File tree

4 files changed

+56
-47
lines changed

4 files changed

+56
-47
lines changed

amx-deps/a_amx.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ forward OnBotConnect(botid, name[]);
2020
forward OnBotEnterVehicle(botid, vehicleid, seatid);
2121
forward OnBotExitVehicle(botid, vehicleid);
2222
forward OnBotDeath(botid, killerid, weaponid, bodypart);
23+
forward OnBotStateChange(botid, newstate, oldstate);
2324
forward OnVehicleDamage(vehicleid, Float:loss);
2425
forward OnPlayerShootingPlayer(playerid, attackerid, bodypart, Float:loss);
2526
forward OnPlayerWeaponSwitch(playerid, previousWeaponID, currentWeaponID);

amx-fs-test/testfs.pwn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <a_samp>
2-
#include <file>
32
43
main()
54
{
@@ -18,4 +17,3 @@ public OnFilterScriptExit()
1817
return 1;
1918
}
2019
21-

amx-test/pawno/include/a_amx.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ forward OnBotConnect(botid, name[]);
2020
forward OnBotEnterVehicle(botid, vehicleid, seatid);
2121
forward OnBotExitVehicle(botid, vehicleid);
2222
forward OnBotDeath(botid, killerid, weaponid, bodypart);
23+
forward OnBotStateChange(botid, newstate, oldstate);
2324
forward OnVehicleDamage(vehicleid, Float:loss);
2425
forward OnPlayerShootingPlayer(playerid, attackerid, bodypart, Float:loss);
2526
forward OnPlayerWeaponSwitch(playerid, previousWeaponID, currentWeaponID);

amx-test/testgm.pwn

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include <a_samp>
2-
#include <file>
32
#include <a_amx>
4-
new bot = 0;
5-
new bots = 0;
6-
new marker = 0;
3+
4+
new bot, bots, marker;
75
86
main()
97
{
@@ -22,7 +20,7 @@ public OnGameModeInit()
2220
new File:f = fopen("file.txt", io_read);
2321
if (f == File:0)
2422
{
25-
printf("There is a problem with openning the file.");
23+
printf("There is a problem with opening the file.");
2624
}
2725
else
2826
{
@@ -34,13 +32,16 @@ public OnGameModeInit()
3432
}
3533
3634
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
37-
SetRuleValue("nya", "test");
35+
3836
new buf[64];
37+
SetRuleValue("nya", "test");
3938
GetRuleValue("nya", buf, sizeof(buf));
4039
printf("val: %s", buf);
40+
4141
bot = CreateBot(0, 0.5, 0.5, 0.5, "Nyashk");
4242
GetBotName(bot, buf, sizeof(buf));
4343
printf("bot: %s", buf);
44+
4445
printf("sss: %d", GetWaveHeight());
4546
SetWaveHeight(15);
4647
printf("sss: %d", GetWaveHeight());
@@ -76,48 +77,51 @@ public OnPlayerConnect(playerid)
7677
CreateBot(0, 0.5, 0.5, 0.5);
7778
CreateBot(0, 0.5, 0.5, 0.5);
7879
bot = CreateBot(0, 0.5, 0.5, 0.5, "Nyashk");
80+
7981
SetPlayerHealth(playerid, 50.0);
8082
SetPlayerBlurLevel(playerid, 0);
83+
8184
new listitems[] = "1\tDeagle\n2\tSawnoff\n3\tPistol\n4\tGrenade\n5\tParachute\n6\tLorikeet";
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");
8386
//ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "testcapt", "info", "Okay", "Canceled");
8487
return 1;
8588
}
89+
8690
forward OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
8791
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
8892
{
8993
if(dialogid == 0) { // Our example msgbox
9094
if(response) {
91-
SendClientMessage(playerid,0xFFFFFFFF,"You selected OK");
95+
SendClientMessage(playerid, 0xFFFFFFFF, "You selected OK");
9296
} else {
93-
SendClientMessage(playerid,0xFFFFFFFF,"You selected Cancel");
97+
SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel");
9498
}
9599
return 1; // we processed this. no need for other filterscripts to process it.
96100
}
97101
98102
if(dialogid == 1) { // Our example inputbox
99103
if(response) {
100-
new message[256+1];
101-
format(message, 256, "You replied: %s", inputtext);
102-
SendClientMessage(playerid, 0xFFFFFFFF, message);
104+
new message[256 + 1];
105+
format(message, sizeof(message), "You replied: %s", inputtext);
106+
SendClientMessage(playerid, 0xFFFFFFFF, message);
103107
} else {
104-
SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel");
108+
SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel");
105109
}
106110
return 1; // we processed it.
107111
}
108112
109113
if(dialogid == 2) { // Our example listbox
110114
if(response) {
111-
new message[256+1];
115+
new message[256 + 1];
112116
if(listitem != 5) {
113-
format(message, 256, "You selected item %d:", listitem);
114-
SendClientMessage(playerid, 0xFFFFFFFF, message);
115-
SendClientMessage(playerid, 0xFFFFFFFF, inputtext);
117+
format(message, sizeof(message), "You selected item %d:", listitem);
118+
SendClientMessage(playerid, 0xFFFFFFFF, message);
119+
SendClientMessage(playerid, 0xFFFFFFFF, inputtext);
116120
} else {
117-
SendClientMessage(playerid, 0x5555FFFF, "A Lorikeet is NOT a weapon!");
121+
SendClientMessage(playerid, 0x5555FFFF, "A Lorikeet is NOT a weapon!");
118122
}
119123
} else {
120-
SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel");
124+
SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel");
121125
}
122126
return 1; // we processed it.
123127
}
@@ -134,18 +138,21 @@ public OnPlayerDisconnect(playerid, reason)
134138
public OnMarkerCreate(markerid)
135139
{
136140
printf("OnMarkerCreate(%d)", markerid);
141+
return 1;
137142
}
138143
139144
public OnPlayerSpawn(playerid)
140145
{
141146
new Float:x, Float:y, Float:z;
142147
GetPlayerPos(playerid, x, y, z);
143148
marker = CreateMarker(x, y, z, "checkpoint", 3.0, 255, 0, 0, 250);
149+
144150
CreateBot(0, x, y, z);
145151
SetBotPos(bot, x, y, z);
146-
SetPlayerHealth(playerid, 50.0);
147152
SetBotHealth(bot, 100.0);
148153
SetBotArmour(bot, 5.0);
154+
155+
SetPlayerHealth(playerid, 50.0);
149156
GivePlayerWeapon(playerid, 32, 500);
150157
return 1;
151158
}
@@ -156,39 +163,45 @@ public OnBotConnect(botid, name[])
156163
printf("Bot connected: %d [%s]", botid, name);
157164
return 1;
158165
}
166+
159167
public OnMarkerHit(markerid, elemtype[], elemid, matchingDimension)
160168
{
161169
printf("OnMarkerHit(%d, %s, %d)", markerid, elemtype, elemid);
170+
return 1;
162171
}
163172
164173
public OnBotEnterVehicle(botid, vehicleid, seatid)
165174
{
166-
175+
return 1;
167176
}
168177
169178
public OnBotExitVehicle(botid, vehicleid)
170179
{
171-
180+
return 1;
172181
}
173182
174183
public OnBotDeath(botid, killerid, weaponid, bodypart)
175184
{
176185
printf("OnBotDeath(%d, %d, %d, %d)", botid, killerid, weaponid, bodypart);
186+
return 1;
177187
}
178188
179189
public OnPlayerWeaponSwitch(playerid, previousWeaponID, currentWeaponID)
180190
{
181-
printf("OnPlayerWeaponSwitch(%d, %d, %d)",playerid, previousWeaponID, currentWeaponID);
191+
printf("OnPlayerWeaponSwitch(%d, %d, %d)", playerid, previousWeaponID, currentWeaponID);
192+
return 1;
182193
}
183194
184195
public OnPlayerShoot(playerid, weapon, ammo, ammoInClip, Float:hitX, Float:hitY, Float:hitZ)
185196
{
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;
187199
}
188200
189201
public OnVehicleDamage(vehicleid, Float:loss)
190202
{
191203
printf("OnVehicleDamage(%d, %f)", vehicleid, loss);
204+
return 1;
192205
}
193206
194207
public OnPlayerDeath(playerid, killerid, reason)
@@ -211,10 +224,6 @@ public OnPlayerText(playerid, text[])
211224
return 1;
212225
}
213226
214-
public OnPlayerPrivmsg(playerid, recieverid, text[])
215-
{
216-
return 1;
217-
}
218227
strtok(const string[], &index)
219228
{
220229
new length = strlen(string);
@@ -233,41 +242,41 @@ strtok(const string[], &index)
233242
result[index - offset] = EOS;
234243
return result;
235244
}
245+
236246
public OnPlayerCommandText(playerid, cmdtext[])
237247
{
238-
new cmd[256];
239-
new idx;
248+
new cmd[256], idx;
240249
cmd = strtok(cmdtext, idx);
250+
241251
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\nHope 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\nHope it's useful to you.", "OK", "Cancel");
253+
return 1;
244254
}
245255
246256
if(strcmp(cmd, "/testmsgbox2", true) == 0) {
247-
ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Welcome","Welcome:\tInfo\nTest:\t\tTabulated\nLine:\t\tHello","OK","Cancel");
248-
return 1;
257+
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Welcome", "Welcome:\tInfo\nTest:\t\tTabulated\nLine:\t\tHello", "OK", "Cancel");
258+
return 1;
249259
}
250260
251261
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\nAccount:\t%s\n\nPlease 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\nAccount:\t%s\n\nPlease enter your password below:", loginname);
265+
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login to SA-MP", loginmsg, "Login", "Cancel");
266+
return 1;
258267
}
259268
260269
if(strcmp(cmd, "/testlistbox", true) == 0) {
261-
new listitems[] = "1\tDeagle\n2\tSawnoff\n3\tPistol\n4\tGrenade\n5\tParachute\n6\tLorikeet";
262-
ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"List of weapons:",listitems,"Select","Cancel");
263-
return 1;
270+
new listitems[] = "1\tDeagle\n2\tSawnoff\n3\tPistol\n4\tGrenade\n5\tParachute\n6\tLorikeet";
271+
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "List of weapons:", listitems, "Select", "Cancel");
272+
return 1;
264273
}
265274
return 0;
266275
}
267276
268277
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
269278
{
270-
279+
return 1;
271280
}
272281
273282
public OnPlayerInfoChange(playerid)
@@ -284,7 +293,7 @@ public OnPlayerExitVehicle(playerid, vehicleid)
284293
{
285294
return 1;
286295
}
287-
forward OnBotStateChange(botid, newstate, oldstate);
296+
288297
public OnBotStateChange(botid, newstate, oldstate)
289298
{
290299
return 1;

0 commit comments

Comments
 (0)