30.03.2013, 15:18
You dont need
Health[playerid] = 1;
under OnPlayerCommandText. Delete that first line in OnPLayerCommandText and also move the timerEx to the under of SetPlayerHealth
You were placing it that way the player each time uses /heal command no matter if it works for him it will set Timer and Health cooldown to 1. You have to move it to the place when he actualy is alowed to use the command.
Example:
Health[playerid] = 1;
under OnPlayerCommandText. Delete that first line in OnPLayerCommandText and also move the timerEx to the under of SetPlayerHealth
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/heal", cmdtext, true, 10) == 0) { if(IsPlayerVipType(playerid,3)) /// PREMIUM VIP { if(Health[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Please wait another 1 minute before using /heal again."); GetPlayerHealth(playerid,hp); SetPlayerHealth(playerid,hp+40); /// 40/100 Health. Health[playerid] = 1; SetTimerEx("EndHealthAbuse", 30000, false, "i", playerid); //// 30 sec to prevent /heal abuse } } else SendClientMessage(playerid, COLOR_RED, "ERROR: You Are Not A Premium Vip Member!"); return 1; } return 0; }
Example:
Код:
CMD:test(playerid, params[]) { //If you put anything here it will triger it each time you use the command. If you put timer here it will start it no matter if you are VIP or not. if(PlayerInfo[playerid][pVIP] == 3) { //Here we will put what will happen if he is level 3 VIP } }