SA-MP Forums Archive
Problem wtf? - 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: Problem wtf? (/showthread.php?tid=107821)



Problem wtf? - TouR - 11.11.2009

i get this errors:

C:\Documents and Settings\Owner\ЕрйцЬнейб есгбуЯбт\gta server\gamemodes\copsandrobbers.pwn(307) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Owner\ЕрйцЬнейб есгбуЯбт\gta server\gamemodes\copsandrobbers.pwn(307) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Owner\ЕрйцЬнейб есгбуЯбт\gta server\gamemodes\copsandrobbers.pwn(312) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Owner\ЕрйцЬнейб есгбуЯбт\gta server\gamemodes\copsandrobbers.pwn(312) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Owner\ЕрйцЬнейб есгбуЯбт\gta server\gamemodes\copsandrobbers.pwn(306) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.






This is my command:

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/kick", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);

if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /kick [playerid]");

Kick(strval(tmp));
return 1;
}
return 0;
}


Re: Problem wtf? - MB@ - 11.11.2009

You need strtok

Код:
stock strtok(const string[], &index,seperator=' ')
{
new length = strlen(string);
new offset = index;
new result[128];
while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}

result[index - offset] = EOS;
if ((index < length) && (string[index] == seperator))
{
index++;
}
return result;
}
stock IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
if (string[i] > '9' || string[i] < '0')
return 0;
return 1;
}



Re: Problem wtf? - TouR - 11.11.2009

Thank you very much!!!!!!!!


Re: Problem wtf? - MB@ - 11.11.2009

lol np


Re: Problem wtf? - TouR - 11.11.2009

Can you help me to make an arrest command?



Re: Problem wtf? - (.Aztec); - 11.11.2009

Quote:
Originally Posted by tour15
Can you help me to make an arrest command?
Just see if the playerid is a police officer, then set the criminal's position to whatever.


Re: Problem wtf? - TouR - 11.11.2009

Can you give me a simple example if the cop team is TEAM_COPS?


Re: Problem wtf? - MenaceX^ - 11.11.2009

pawn Код:
#define TEAM_COPS 1
I suggest you to use sscanf and zcmd instead of strcmp and strtok.


Re: Problem wtf? - TouR - 11.11.2009

I have already the teams.... The only think i need is the command.... Can someone add my msn to help me do this?
nikostour@hotmail.com


Re: Problem wtf? - akis_tze - 11.01.2010

ahahahahahah poso palio einai auto to topic?