Help Me :)
#1

i want that the player can use this command only 2 times how i can do this ? pleas

Код:
CMD:vheal(playerid)
{
	if(pInfo[playerid][pVipLevel] >= 4)
	{
        new string[300], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"{00C0FF}%s {F3FF02}Has Used VIP SURVIVAL PACK {B20000}+25 Health",pName);
        SendClientMessageToAll(0xFFFFFFAA,string);
        new Float:hp;
        GetPlayerHealth(playerid,hp);
	    SetPlayerHealth(playerid, hp + 15);
      }
	    return 1;
}
Otherwise:

Reply
#2

So, declare new global variable for all players, example:
Код:
new PlayerUsedCommandTimes[MAX_PLAYERS];
Код:
CMD:vheal(playerid)
{
	if(pInfo[playerid][pVipLevel] >= 4)
	{
	    if(PlayerUsedCommandTimes[playerid] == 2)
	    {
	        //When player used this command 2 times.
	        return 1;
	    }
	    PlayerUsedCommandTimes[playerid]++;
        new string[300], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"{00C0FF}%s {F3FF02}Has Used VIP SURVIVAL PACK {B20000}+25 Health",pName);
        SendClientMessageToAll(0xFFFFFFAA,string);
        new Float:hp;
        GetPlayerHealth(playerid,hp);
	    SetPlayerHealth(playerid, hp + 15);
      }
	    return 1;
}
Don't forget to reset this variable when player connect.
Reply
#3

+Rep

You Saved My life Thanks
Reply


Forum Jump:


Users browsing this thread: