Ask about Cmd with quota
#5

pawn Код:
CMD:heal(playerid,params[]) {
#pragma unused params
If(PlayerInfo[playerid][Ticket] == 1) {
SetPlayerHealth(playerid, 100);
PlayerInfo[playerid][Ticket] = -1; //this will be decrease 1 ticket when use this cmd
} else return SendClientMessage(playerid, -1,"You need 1 ticket to use this cmd");
return 1;
}
Its not even THAT wrong. Its wrong, but its pretty close to how you would do it. I wonder why you ask for it here, instead of learning a bit more about pawn, seems like you already got a general idea. (Else I wouldnt reply here )

pawn Код:
CMD:heal(playerid,params[]) {
#pragma unused params
If(PlayerInfo[playerid][Ticket] >= 1) { // You also want that command to work with more than one ticket, not just with exactly one
    SetPlayerHealth(playerid, 100);
    PlayerInfo[playerid][Ticket] = PlayerInfo[playerid][Ticket] - 1; // actually decrease it, else it will just be set to -1
} else return SendClientMessage(playerid, -1,"You need 1 ticket to use this cmd");
return 1;
}
To increase it on every payday, youll have to add something like this to your payday code. I cant tell you where exactly this is.

pawn Код:
// Just increase the amount of tickets when the player currently has less than 5
// so it wont go above 5 tickets
if (PlayerInfo[playerid][Ticket] < 5) {
    PlayerInfo[playerid][Ticket] = PlayerInfo[playerid][Ticket] + 1;
}
You might also need to add 'Ticket' to the 'PlayerInfo' enum (incase these actually are your variable names, and not just examples). Find the enum that PlayerInfo uses, and just add it to that list, not much to do wrong about this.
Reply


Messages In This Thread
Ask about Cmd with quota - by [IND]Crazy - 16.04.2014, 16:37
Re: Ask about Cmd with quota - by Firewire - 16.04.2014, 16:47
Re: Ask about Cmd with quota - by [IND]Crazy - 16.04.2014, 16:54
Re: Ask about Cmd with quota - by Firewire - 16.04.2014, 17:06
Re: Ask about Cmd with quota - by Mauzen - 16.04.2014, 17:17
Re: Ask about Cmd with quota - by [IND]Crazy - 17.04.2014, 05:55

Forum Jump:


Users browsing this thread: 2 Guest(s)