SA-MP Forums Archive
someone fix this - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: someone fix this (/showthread.php?tid=561100)



someone fix this - hardiksingh5 - 01.02.2015

can someone fix this in my script
1. Replace loops like this:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{

With:
foreach(Player, i)

2. Replace strtok with sscanf.

3. Replace the "if(strcmp(cmd, "something"" under OnPlayerText, move them out of OnPlayerText and rename it all to "CMDomething(playerid, params[])".
You probably also have to change the commands a little in order for them to work with zcmd.


Re : someone fix this - Dutheil - 01.02.2015

For foreach this is like that :
pawn Код:
foreach (new i : Player)
For sscanf look his wiki : https://github.com/Y-Less/sscanf/wiki

For "CMD:", this is a command processing system.
https://sampforum.blast.hk/showthread.php?tid=91354
https://sampforum.blast.hk/showthread.php?tid=169029