GivePlayerWeapon
#1

Код:
  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
Reply
#2

XD just make them go into debt.

But anyways I will get ya da script hold up
Reply
#3

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

I dont think the command is correct, I get 18 errors =/
Reply
#5

Post errors
Reply
#6

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.");

Reply
#7

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

MadeMan was right. Thanks for help guys ^^ It works
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)