SA-MP Forums Archive
Ticket/Quota System - 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: Ticket/Quota System (/showthread.php?tid=504906)



Ticket/Quota System - [IND]Crazy - 06.04.2014

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


Re: Ticket/Quota System - Equuuuin0X - 06.04.2014

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


Re: Ticket/Quota System - [IND]Crazy - 06.04.2014

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 .


Re: Ticket/Quota System - Equuuuin0X - 06.04.2014

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;
}