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
86main ()
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\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" );
8386 // ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "testcapt", "info", "Okay", "Canceled");
8487 return 1 ;
8588}
89+
8690forward OnDialogResponse (playerid, dialogid, response, listitem, inputtext[]);
8791public OnDialogResponse (playerid, dialogid, response, listitem, inputtext[])
8892{
8993 if (dialogid == 0 ) { // Our example msgbox
9094 if (response) {
91- SendClientMessage (playerid,0x FFFFFFFF ," You selected OK" );
95+ SendClientMessage (playerid, 0x FFFFFFFF , " You selected OK" );
9296 } else {
93- SendClientMessage (playerid,0x FFFFFFFF ," You selected Cancel" );
97+ SendClientMessage (playerid, 0x FFFFFFFF , " 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, 0x FFFFFFFF , message);
104+ new message[256 + 1 ];
105+ format (message, sizeof (message) , " You replied: %s " , inputtext);
106+ SendClientMessage (playerid, 0x FFFFFFFF , message);
103107 } else {
104- SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
108+ SendClientMessage (playerid, 0x FFFFFFFF , " 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, 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);
116120 } else {
117- SendClientMessage (playerid, 0x 5555FFFF , " A Lorikeet is NOT a weapon!" );
121+ SendClientMessage (playerid, 0x 5555FFFF , " A Lorikeet is NOT a weapon!" );
118122 }
119123 } else {
120- SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
124+ SendClientMessage (playerid, 0x FFFFFFFF , " You selected Cancel" );
121125 }
122126 return 1 ; // we processed it.
123127 }
@@ -134,18 +138,21 @@ public OnPlayerDisconnect(playerid, reason)
134138public OnMarkerCreate (markerid)
135139{
136140 printf (" OnMarkerCreate(%d )" , markerid);
141+ return 1 ;
137142}
138143
139144public 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+
159167public OnMarkerHit (markerid, elemtype[], elemid, matchingDimension)
160168{
161169 printf (" OnMarkerHit(%d , %s , %d )" , markerid, elemtype, elemid);
170+ return 1 ;
162171}
163172
164173public OnBotEnterVehicle (botid, vehicleid, seatid)
165174{
166-
175+ return 1 ;
167176}
168177
169178public OnBotExitVehicle (botid, vehicleid)
170179{
171-
180+ return 1 ;
172181}
173182
174183public OnBotDeath (botid, killerid, weaponid, bodypart)
175184{
176185 printf (" OnBotDeath(%d , %d , %d , %d )" , botid, killerid, weaponid, bodypart);
186+ return 1 ;
177187}
178188
179189public 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
184195public 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
189201public OnVehicleDamage (vehicleid, Float: loss)
190202{
191203 printf (" OnVehicleDamage(%d , %f )" , vehicleid, loss);
204+ return 1 ;
192205}
193206
194207public 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- }
218227strtok (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+
236246public 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\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 ;
244254 }
245255
246256 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 ;
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\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 ;
258267 }
259268
260269 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 ;
264273 }
265274 return 0 ;
266275}
267276
268277public OnPlayerKeyStateChange (playerid, newkeys, oldkeys)
269278{
270-
279+ return 1 ;
271280}
272281
273282public OnPlayerInfoChange (playerid)
@@ -284,7 +293,7 @@ public OnPlayerExitVehicle(playerid, vehicleid)
284293{
285294 return 1 ;
286295}
287- forward OnBotStateChange (botid, newstate, oldstate);
296+
288297public OnBotStateChange (botid, newstate, oldstate)
289298{
290299 return 1 ;
0 commit comments