SA-MP Forums Archive
/pay Command not working - 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: /pay Command not working (/showthread.php?tid=469510)



/pay Command not working - Syox - 13.10.2013

Hi, i'm a beginner scripter.
i need help with my new /pay cmd, not working.
the code is:
pawn Код:
if(!strcmp(cmdtext, "/p ", true, 2) && (cmdtext[2] == '\0' || cmdtext[2] == ' '))// /p parancs, fizetйs
    {
    if(!cmdtext[2] || !cmdtext[3]) return SendClientMessage(playerid, 0xFF0000FF, "Fizetйs. Hasznбlat: /p [ID] [цsszeg]");
 GivePlayerMoney(playerid,-cmdtext[4]);
 GivePlayerMoney(cmdtext[3],cmdtext[4]);
 new fizetseg[128];
 format(fizetseg,128,"Adtбl %d FT-t %d-nek", cmdtext[4], cmdtext[2]);
 SendClientMessage(playerid,COLOR_WHITE,fizetseg);
The problem is, that it gets -32 from my money, and it types : Adtбl 32FT-t 32-nek ( You gave 32ft to 32).. if i type /p 8 1000, it says that too,. anyone help?


Re: /pay Command not working - edzis84 - 13.10.2013

Sorry for little offtopic but i will recommend you to use zcmd and sscanf, that would be much much easier.


Re: /pay Command not working - Syox - 13.10.2013

So, is that impossible this way? Because i wanna use only the a_samp.


Re: /pay Command not working - edzis84 - 13.10.2013

Maybe it is possible, i don't know cuz im not using this system.

I don't know how you are goin to make your systems without sscanf, its kinda impossible

Like you are just making things harder for you, zcmd and sscanf would help you a lot


Re: /pay Command not working - PT - 13.10.2013

you can use strtok but it's too old, it's outdated

https://sampwiki.blast.hk/wiki/Strtok


Re: /pay Command not working - Aarab - 13.10.2013

Indeed, I suggest you to use zCMD. Strcmp has many bugs in 0.3x.


Re: /pay Command not working - Konstantinos - 13.10.2013

Quote:
Originally Posted by Aarab
Посмотреть сообщение
Indeed, I suggest you to use zCMD. Strcmp has many bugs in 0.3x.
strcmp is working fine and in the first place, it's used for comparing 2 strings not for commands.

However, I'll agree that using ZCMD or y_commands with sscanf is MUCH better/faster while strcmp and strtok are really bad/slow.