Only returns numeric results. - 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: Only returns numeric results. (
/showthread.php?tid=291367)
Only returns numeric results. -
Shuffler - 19.10.2011
pawn Код:
if(strcmp(cmd, "/accent", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new length = strlen(cmdtext);
tmp = strtok(cmdtext, idx);
if(!strval(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /accent [text]");
SendClientMessage(playerid, COLOR_WHITE, "NB! It will show as Name_Name says [Chosenaccent accent]: Mytexthere.");
SendClientMessage(playerid, COLOR_WHITE, "So make sure you make it correct, like Spanish, Russian etc.");
return 1;
}
strmid(PlayerInfo[playerid][pAccent], tmp, 0, strlen(tmp), 255);
format(string, sizeof(string), "You have set your accent to "lblue"%s", PlayerInfo[playerid][pAccent]);
SendClientMessage(playerid, COLOR_WHITE, string);
SavePlayers();
}
return 1;
}
Why? When I do /accent 123 it works fine but when i do /accent Spanish it fails, it must be numeric to return 1. No errors no warnings. Help?
Re: Only returns numeric results. -
Vince - 19.10.2011
Learn what strval is and how to use it.
https://sampwiki.blast.hk/wiki/strval
Re: Only returns numeric results. -
Jefff - 19.10.2011
Should be if(!strlen(tmp)) and strval returns 0 so its "if(!strval(tmp))" if U use text not integer