How can i create a cmd that can be used once in a while
#1

So, i want to create a command that can only be used, once a day. like:
/givememoney - give player 1000 dollars
*after used and try to use again:
/givememoney - " you already used this command today, try next after 24 hours "
a command that can be used once in a while.
any support please ?
Reply
#2

You can do something like this:

pawn Код:
CMD:giveallmoney(playerid, params[])
{
    if(IsPlayerAdmin(playerid)))
    {
        if(LastGiveAllMoney > gettime())
        {
               foreach(new i: Player)
               {
                    GivePlayerCash(i, 1000);
               }
               LastGiveAllMoney = gettime()+86400;
        }
        else return SendClientMessage(playerid, -1, "you can only do this every 24 hours !");
  }
   return 0;
}
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You can do something like this:

[pawn]
CMD:giveallmoney(playerid, params[])
{
i want players to use it, not me giving them money. but thank you for trying to help me.
Reply
#4

Something like this then:

pawn Код:
CMD:givememoney(playerid, params[])
{
     if(PlayerData[playerid][pLastCashGet] >= gettime())
     {
           GivePlayerCash(playerid, 1000);
           PlayerData[playerid][pLastCashGet] = gettime()+86400;
     }
     else return SendClientMessage(playerid, -1, "You have already used this command today. Try again tommorow.");
}
Reply
#5

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Something like this then:

pawn Код:
CMD:givememoney(playerid, params[])
{
     if(PlayerData[playerid][pLastCashGet] >= gettime())
     {
           GivePlayerCash(playerid, 1000);
           PlayerData[playerid][pLastCashGet] = gettime()+86400;
     }
     else return SendClientMessage(playerid, -1, "You have already used this command today. Try again tommorow.");
}
Thank you, +1 rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)