Only returns numeric results.
#1

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?
Reply
#2

Learn what strval is and how to use it.
https://sampwiki.blast.hk/wiki/strval
Reply
#3

Should be if(!strlen(tmp)) and strval returns 0 so its "if(!strval(tmp))" if U use text not integer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)