SA-MP Forums Archive
How to make a gun charge you instead of getting it for free? - 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: How to make a gun charge you instead of getting it for free? (/showthread.php?tid=81226)



How to make a gun charge you instead of getting it for free? - Studio - 09.06.2009

Hey Sa-mp.com, I need help with setting the gun prices of each item for an example this is one menu item.

Код:
AddMenuItem(weapon4, 0, "Shotgun");
How would I make it cost to buy a Shotgun instead of getting it for free?




Re: How to make a gun charge you instead of getting it for free? - LaNiZ - 09.06.2009

Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:current;
  new WeaponID;
  new WeaponCost;

//-----------------Change These-------------------
WeaponCost = ;
WeaponID = ;
//--------------------------------------------------


  current = GetPlayerMenu(playerid);
  if(current == weapon4)
  {
    switch(row)
    {
      case 0:
      {
			if (GetPlayerMoney(playerid) >= WeaponCost)
			{
				GivePlayerMoney(playerid, -WeaponCost); //Use a negative number to subtract
				GivePlayerWeapon(playerid, WeaponID, 500);
			}
      }
    }
  }
  return 1;
}