SA-MP Forums Archive
Need small help if is not a problem :3 - 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)
+--- Thread: Need small help if is not a problem :3 (/showthread.php?tid=586768)



Need small help if is not a problem :3 - Toxik - 24.08.2015

so if the player have no money send him message (You don't have enough money)
i cant figure it out HaHa ;(
pawn Код:
else if(clickedid == TDEditor_TD[9])
    {
    //Buy m4
    GivePlayerWeapon(playerid,WEAPON_M4,1500);
    GivePlayerMoney(playerid,-1800);
    SendClientMessage(playerid,0x00FF00,"You Bought M4-A1 with 1500 ammo");
    }



Re: Need small help if is not a problem :3 - Abagail - 24.08.2015

pawn Код:
if(GetPlayerMoney(playerid) >= 1800)
{
      // code
}
else return SendClientMessage(playerid, -1, "You don't have enough money.");
or
pawn Код:
if(GetPlayerMoney(playerid) < 1800) return SendClientMessage(playerid, -1, "You don't have enough money.");



Re: Need small help if is not a problem :3 - DarkLored - 24.08.2015

pawn Код:
else if(clickedid == TDEditor_TD[9])
    {
    //Buy m4
        if(GetPlayerMoney(playerid) < 0)
        {
           SendClientMessage(playerid, -1, "You don't have enough money to purchase this item.");
           return 1;
        }
    GivePlayerWeapon(playerid,WEAPON_M4,1500);
    GivePlayerMoney(playerid,-1800);
    SendClientMessage(playerid,0x00FF00,"You Bought M4-A1 with 1500 ammo");
    }



Re: Need small help if is not a problem :3 - Toxik - 24.08.2015

thanks
now i can finally release my work <3


Re: Need small help if is not a problem :3 - R0 - 24.08.2015

pawn Код:
else if(clickedid == TDEditor_TD[9])
{
        if(GetPlayerMoney(playerid) < 1800) return SendClientMessage(playerid, -1, "You dont have enough money to buy this gun.");
    //Buy m4
    GivePlayerWeapon(playerid,WEAPON_M4,1500);
    GivePlayerMoney(playerid,-1800);
    SendClientMessage(playerid,0x00FF00,"You Bought M4-A1 with 1500 ammo");
}