Need some help.
#1

Alright well I've just converted my script from commands like /ak, /deagle, /spas...etc. to dialog.
so now you /shop and it pulls up a dialog with the prices and the gun name...
I would like to know how to make it to where if you do not have the money to buy the gun it will not let you.
Right now if you /shop and you have no money it will let you buy it but it will put you into negative money.
Reply
#2

pawn Код:
if(GetPlayerMoney(playerid) >= YOUR_GUN_PRICE_HERE)
{
    //player can afford the gun
}
else
{
    //player can't afford the gun
}
Reply
#3

Where would I place this? Under the Case 1:, Case 2:, Case 3: and so on...?
Reply
#4

Put it where you give them the gun preferably, give the gun inside the 'if' block. If you give the gun inside a case put it there.

pawn Код:
case 0:
{
    if(GetPlayerMoney(playerid) >= YOUR_GUN_PRICE_HERE)
    {
        //player can afford the gun so give the gun here and reduce money
    }
    else
    {
        //player can't afford the gun send a message
    }
}
Reply
#5

That worked. Thank you very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)