Errors - 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: Errors (
/showthread.php?tid=363319)
Errors -
Dare Devil..... - 27.07.2012
How can I fix these errors
Код:
C:\Users\Osman Ali\Desktop\Skin.pwn(92) : error 017: undefined symbol "strtok"
C:\Users\Osman Ali\Desktop\Skin.pwn(92) : error 033: array must be indexed (variable "cmd")
C:\Users\Osman Ali\Desktop\Skin.pwn(98) : error 017: undefined symbol "strtok"
C:\Users\Osman Ali\Desktop\Skin.pwn(98) : error 033: array must be indexed (variable "tmp")
C:\Users\Osman Ali\Desktop\Skin.pwn(91) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
THis is the script.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/clothes", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,40.0,207.4733,-109.8061,1005.1328))
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /clothes [skinid]");
if(strval(tmp) >= 0 && strval(tmp) <= 299) SetPlayerSkin(playerid, strval(tmp)); //Checks if valid skinid. Also, make sure you restrict skins that aren't used, because if there is a skinid with no skin, player crashes.
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in range of whatever");
return 1;
}
return 0;
}
Re: Errors -
Ironboy - 27.07.2012
Add this
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: Errors -
Dare Devil..... - 27.07.2012
Any help it dont change my skin
Respuesta: Errors -
farCry.xD - 27.07.2012
Код:
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;
}
Add this on the top of your script
Over all defines and includes.
Re: Errors -
Dare Devil..... - 27.07.2012
It gives errors then
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : error 017: undefined symbol "strlen"
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : warning 215: expression has no effect
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : error 001: expected token: ";", but found ")"
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : error 029: invalid expression, assumed zero
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.