SA-MP Forums Archive
/spaz - gun commands. - 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: /spaz - gun commands. (/showthread.php?tid=262883)



/spaz - gun commands. - Brunok - 19.06.2011

Quote:

if (strcmp("/Rifle", cmdtext, true))
{
if (GetPlayerMoney(playerid) < 6000)
{
SendClientMessage(playerid,0xFF0000AA, "You dont have enough money, you need 6000$!");
return 1;
}
SendClientMessage(playerid, 0xFF0000AA,"You have bought a Country Rifle, Enjoy!");
GivePlayerMoney(playerid, -6000);
GivePlayerWeapon(playerid, 33, 500);
return 1;
}

I have several of these like one /shotgun command for 1000$ that you can buy too, All commands are the same but it gives this error IG: 1, It shows for all commands this ''You dont have enough money, you need 1000$'', and the only ting you can get is the shotgun for 1000 but even commands that does't exist it gives this error, how can i fix that it gives the good gun and doesn't disable all commands.
Note:
The command above is used for all commands, just the price,sendclientmessage,weaponid,etc are changed, but all commands look like that.


Re: /spaz - gun commands. - Wesley221 - 19.06.2011

pawn Код:
if(!strcmp(cmdtext, "/rifle", true, 7))
{
    if(GetPlayerMoney(playerid) < 6000) return SendClientMessage(playerid, 0xFF0000AA, "You dont have enough money. You need atleast $6000!");
    SendClientMessage(playerid, 0xFF0000AA,"You have bought a Country Rifle, Enjoy!");
    SetPlayerMoney(playerid,GetPlayerMoney(playerid) -6000);
    GivePlayerWeapon(playerid, 33, 500);
    return 1;
}



Re: /spaz - gun commands. - Brunok - 19.06.2011

Thanks very much, But can you explain me the if(!strcmp(cmdtext, "/rifle", true, 7))

7? I want to learn and i dont get it.

EDIT: J:\Spellen\Samp server\gamemodes\scr.pwn(814) : error 017: undefined symbol "SetPlayerMoney"
J:\Spellen\Samp server\gamemodes\scr.pwn(824) : error 017: undefined symbol "SetPlayerMoney"


Re: /spaz - gun commands. - Wesley221 - 19.06.2011

Oh, forget about the SetPlayerMoney.. Just use GivePlayerMoney; my bad :$

The 7 is the amount of characters of your command.

Like, my command is "/lol", then the number would be 4. "/(1)l(2)o(3)l(4)"


Re: /spaz - gun commands. - jameskmonger - 19.06.2011

/rifle has 6 characters.


Re: /spaz - gun commands. - Wesley221 - 19.06.2011

Quote:
Originally Posted by jameskmonger
Посмотреть сообщение
/rifle has 6 characters.
Oh duh, change it to 6 then.. Kinda sleepy


Re: /spaz - gun commands. - Brunok - 19.06.2011

Oh thanks both very much!