SA-MP Forums Archive
Maths - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Maths (/showthread.php?tid=146376)



Maths - dcmd_crash - 07.05.2010

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?


Re: Maths - Mr L - 07.05.2010

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);
          }



Re: Maths - [HiC]TheKiller - 07.05.2010

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

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



Re: Maths - dcmd_crash - 07.05.2010

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