#1

I wrote a little maths game for my gamemode.. it was on command /a but I decided against that idea and now I'm trying to put it on OnPlayerText.

pawn Код:
if(text[0] == answer) {
    new str[128];
    format(str,sizeof(str),"* %s has won Numb3rz with an answer of %d",PlayerName2(playerid), answer);
    SendClientMessageToAll(MAD_WHITE,str);
    GivePlayerMoney(playerid,20000);
    MathOff();
  }
The above code doesn't work, why not?
Reply
#2

use this :

pawn Код:
new idx;
          tmp = strtok(text, idx);
          if ((strcmp("obama", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("obama")))
          {
            GivePlayerCash(playerid, 20000);
            format(string, sizeof(string), "* %s has won Nymb3rz with an answer of [obama].", PlayerName(playerid));
            SendClientMessageToAll(COLOR_YELLOW, string);
          }
Reply
#3

pawn Код:
if(text[0] == answer) {
For some reason, that looks wrong .

pawn Код:
if(strval(text) == answer)
{
Reply
#4

Quote:
Originally Posted by Kinto
use this :

pawn Код:
new idx;
          tmp = strtok(text, idx);
         if ((strcmp("obama", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("obama")))
          {
            GivePlayerCash(playerid, 20000);
            format(string, sizeof(string), "* %s has won Nymb3rz with an answer of [obama].", PlayerName(playerid));
            SendClientMessageToAll(COLOR_YELLOW, string);
          }
Oh I see you're a faggot? Please do me a favour and fuck yourself backwards?! Thanks.

Quote:
Originally Posted by HiC
For some reason, that looks wrong
Thanks I'll try using strval, didn't even think. :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)