I need help with command! - 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: I need help with command! (
/showthread.php?tid=247618)
I need help with command! -
NitoPSG - 10.04.2011
Hello I want to make a command, when someone type /takegun will take a 9mm and will remove 100$ from his cash, but when he doesn't have the money he can't take the weapon and will appear a massege on the screen "you don't have enough money" , how I can do this? Please help!!!
Re: I need help with command! -
Stigg - 10.04.2011
Try lokking at these links, should help you get the desired effect.
https://sampwiki.blast.hk/wiki/OnPlayerCommandText
https://sampwiki.blast.hk/wiki/GetPlayerWeapon
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
https://sampwiki.blast.hk/wiki/GetPlayerMoney
https://sampwiki.blast.hk/wiki/SendClientMessage
Re: I need help with command! -
Ben7544 - 10.04.2011
Amm, take :
Код:
if(strcmp("/takegun", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerMoney(playerid) <= 100) return SendClientMessage(playerid,0xAFAFAFAA, "You don't have enough money!");
{
SendClientMessage(playerid, 0x9EC73DAA, "You took 9mm.");
GivePlayerMoney(playerid, -100);
GivePlayerWeapon(playerid, 22, 80);
}
}
}
EDIT : Haven't tested it.