/gift command problem
#1

Hello all.I have a little problem.I have made a command /gift (when you type it, you get 100.000$). The problem is when I type /gift multiple times, it gives me 100.000$ all the time.I wanted to make something like...when you type /gift once, it gives you 100.000$ but when you type /gift again a message appears "You got money once.You can't get money again".How can I do it?
Reply
#2

When players left and come again they will use it.

pawn Код:
new gift[MAX_PLAYERS]              = 1;//on the top of your gamemode.

public OnPlayerConnect(playerid)
{
    gift[playerid] = 1;
}

CMD:gift(playerid,params[])
{
    if(gift[playerid] == 1)
    {
      GivePlayerMoney(playerid,100000);
      gift[playerid] = 0;
     }
     else return SendClientMessage(playerid, -1, "You got money once.You can't get money again");
}

//if you want him to be able to use it after death
public OnPlayerDeath(playerid, killerid, reason)
{
    gift[playerid] = 1;
}
Reply
#3

Worked! Thank you so much man
Reply
#4

Quote:
Originally Posted by JohnYoti
Посмотреть сообщение
Worked! Thank you so much man
No problem dude, You're Welcome
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)