Reaction Test help
#3

pawn Код:
if(strcmp(cmd, "/answer", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new string[72];
            GetPlayerName(playerid, sendername, sizeof(sendername));
            tmp = strtok(cmdtext, idx);
            theanswer = strval(tmp);
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            new result_len = strlen(result);
            if(!result_len)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /answer");
                return 1;
            }
            if (result == answer && answered == 0)
            {
                format(string,72,"%s has won the reaction test",sendername);
                SendClientMessageToAll(0xAA3333AA, string);
                GivePlayerMoney(playerid, 2000);
            }
        }
        return 1;
    }
And I wouldnt be sure it works. Use sscanf.
Reply


Messages In This Thread
Reaction Test help - by BlackWolf120 - 30.01.2011, 02:22
Re: Reaction Test help - by BlackWolf120 - 30.01.2011, 02:36
Re: Reaction Test help - by admantis - 30.01.2011, 02:36
Re: Reaction Test help - by iMonk3y - 30.01.2011, 02:38
Re: Reaction Test help - by Limex - 30.01.2011, 02:40
Re: Reaction Test help - by admantis - 30.01.2011, 02:41
Re: Reaction Test help - by BlackWolf120 - 30.01.2011, 02:44
Re: Reaction Test help - by BlackWolf120 - 30.01.2011, 19:04
Re: Reaction Test help - by BlackWolf120 - 31.01.2011, 14:15
Re: Reaction Test help - by Jefff - 31.01.2011, 14:47

Forum Jump:


Users browsing this thread: 2 Guest(s)