/pay Command not working
#1

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

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

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

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
Reply
#5

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

https://sampwiki.blast.hk/wiki/Strtok
Reply
#6

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)