SA-MP Forums Archive
What's wrong ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's wrong ? (/showthread.php?tid=188197)



What's wrong ? - marinov - 06.11.2010

Код:
public OnPlayerCommandText(playerid, cmdtext[])

{
	new cmd[256];
	new target, idx;
	cmd = strtok(cmdtext, idx);
	if(strcmp(cmd, "/hide", true) == 0)
	{
		if(team[playerid] != 2) return SendClientMessage(playerid, YELLOW, "You are not a Zombie!");
		TogglePlayerControllable(playerid, 0);
 		ApplyAnimation(playerid,"DAM_JUMP","SF_JUMPWALL",999999,0,1,1,1,1);
        UsingAnimation[playerid] = 1;
		return 1;
	}
Код:
C:\Users\Marino Varesio\Desktop\zombie outbreak\gamemodes\zombieoutbreak.pwn(863) : error 017: undefined symbol "strtok"
C:\Users\Marino Varesio\Desktop\zombie outbreak\gamemodes\zombieoutbreak.pwn(863) : error 033: array must be indexed (variable "cmd")
C:\Users\Marino Varesio\Desktop\zombie outbreak\gamemodes\zombieoutbreak.pwn(862) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: What's wrong ? - RyDeR` - 06.11.2010

Just add strtok to your script:
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}



Re: What's wrong ? - marinov - 06.11.2010

oh yeah, it worked, I think I deleted bu accident cleaning my script