GivePlayerWeapon - 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: GivePlayerWeapon (
/showthread.php?tid=88761)
GivePlayerWeapon -
Puzi - 28.07.2009
Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0)
{
GivePlayerWeapon(playerid,22,500);
GivePlayerMoney(playerid,-150);
SendClientMessage(playerid,COLOR_ADMIN, "*** You have bought a 9MM Pistol - Cost: $150");
return 1;
}
I would like to make this command, when player hasn't got that amount it will say ''Insufficient Funds''. How do I do that?
Thanks and Regards
Puzi
Re: GivePlayerWeapon -
clean180ollie - 28.07.2009
XD just make them go into debt.
But anyways I will get ya da script hold up
Re: GivePlayerWeapon -
SpiderPork - 28.07.2009
pawn Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid) => 150)
{
GivePlayerWeapon(playerid, 22, 500);
GivePlayerMoney(playerid, b-150);
SendClientMessage(playerid, COLOR_ADMIN, "*** You have bought a 9MM Pistol - Cost: $150");
}
else return SendClientMessage(playerid, YOUR_COLOR, "Insufficient funds.");
return 1;
}
Re: GivePlayerWeapon -
Puzi - 28.07.2009
I dont think the command is correct, I get 18 errors =/
Re: GivePlayerWeapon -
Kyle - 28.07.2009
Post errors
Re: GivePlayerWeapon -
Chrham_2 - 28.07.2009
Quote:
Originally Posted by SpiderPork
pawn Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0) { if(GetPlayerMoney(playerid) => 150) { GivePlayerWeapon(playerid, 22, 500); GivePlayerMoney(playerid, b-150); SendClientMessage(playerid, COLOR_ADMIN, "*** You have bought a 9MM Pistol - Cost: $150"); } [u][color=red]else[/color][/u] return SendClientMessage(playerid, YOUR_COLOR, "Insufficient funds."); return 1; }
|
Else what?
You must type else if money under 150, THEN, return SendClientMessage(playerid, YOUR_COLOR, "Insufficient funds.");
Re: GivePlayerWeapon -
MadeMan - 28.07.2009
Quote:
Originally Posted by Chrham_2
Else what?
You must type else if money under 150, THEN, return SendClientMessage(playerid, YOUR_COLOR, "Insufficient funds.");
|
This else is right. It means all other possibilities. But there are few mistakes there. Change => to >= and delete that b from GivePlayerMoney.
Re: GivePlayerWeapon -
Puzi - 28.07.2009
MadeMan was right. Thanks for help guys ^^ It works
Re: GivePlayerWeapon -
SpiderPork - 29.07.2009
Quote:
Originally Posted by Chrham_2
Quote:
Originally Posted by SpiderPork
pawn Код:
if (strcmp("/9mm", cmdtext, true, 10) == 0) { if(GetPlayerMoney(playerid) => 150) { GivePlayerWeapon(playerid, 22, 500); GivePlayerMoney(playerid, b-150); SendClientMessage(playerid, COLOR_ADMIN, "*** You have bought a 9MM Pistol - Cost: $150"); } [u][color=red]else[/color][/u] return SendClientMessage(playerid, YOUR_COLOR, "Insufficient funds."); return 1; }
|
Else what?
You must type else if money under 150, THEN, return SendClientMessage(playerid, YOUR_COLOR, "Insufficient funds.");
|
I never used that, and my scripts worked just fine...