/spaz - gun commands.
#1

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

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;
}
Reply
#3

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"
Reply
#4

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

/rifle has 6 characters.
Reply
#6

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

Oh thanks both very much!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)