16.04.2014, 17:17
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;
}
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;
}
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;
}