Ticket/Quota System
#1

how to create Ticket/Quota system for use CMD ?
example :
i type cmd /work but im not have ticket and message will showup "Sorry You need 2 Ticket to use this CMD"
and Player will got 1 ticket on payday . and max ticket player have is 5 and will Decrease when player use that for CMD .

Rep ++ for Helped .
sorry for my bad english
Reply
#2

What does the /work do ?

Payday of tickets:

Add this ontop of your script.

pawn Код:
enum pDat
{
ticket,
}
new pdata[MAX_PLAYERS][pDat];

place this somewhere:
pawn Код:
forward Payday();
public Payday()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
     {
        pdata[i][ticket] = 1;
     }
}
Put this under OnGameModeInIt
pawn Код:
SetTimer("Payday",300000,1);
Ticket paydays are set to a payday per 5 minutes
Reply
#3

oke thanks but how to put that on cmd ?
example
pawn Код:
CMD:heal(playerid,params[]) {
    #pragma unused params
    SetPlayerHealth(playerid, 100);
}
but that cmd only work when player have 2 ticket , and if player have 2 ticket and use that cmd , player ticket will be Decrease .
Reply
#4

It should be like this.

pawn Код:
CMD:heal(playerid,params[])
{
if(pdata[playerid][ticket] > 2) return SendClientMessage(playerid, red,"[ERROR] You need atleast 2 tickets to use this command!");
    {
      #pragma unused params
      SetPlayerHealth(playerid, 100);
      pdata[playerid][ticket] = -2;
    }
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)