28.11.2011, 13:17
can someone make me the command to setplayer hp and armor to 100 and each player to can use it 1 time in 2 minutes
new
HealUsed[ MAX_PLAYERS ]
;
forward @RefreshCmd( playerid );
@RefreshCmd( playerid )
{
HealUsed[ playerid ] = 0;
SendClientMessage( playerid, -1, #two minutes passed you can now use heal command );
}
CMD:heal( playerid, params[] )
{
if ( HealUsed[ playerid ] == 1 ) return SendClientMessage( playerid, -1, #you cannot use this command, 2 minutes not passed );
SetPlayerHealth( playerid, 100 );
SetPlayerArmour( playerid, 100 );
HealUsed[ playerid ] = 1;
SetTimerEx( "RefreshCmd", 120000, false, "i", playerid );
return ( 1 );
}
new pHealTime[MAX_PLAYERS];
dcmd_heal(playerid, params[])
{
#pragma unused params
if(gettime()-pHealTime[playerid] < 120) return SendClientMessage(playerid, COLOR_RED, "You can only heal once every 2 minutes.");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
pHealTime[playerid] = gettime();
return 1;
}
if(strcmp, "/heal", cmd, true, 10) == 0) { SetPlayerHealth(playerid, 100); // You can also edit the health healing here SetPlayerArmour(playerid, 100);//You can also edit the armour healing here SendClientMessage(playerid, [COLORHERE], "You have healed yourself."); return 1;