24.05.2015, 16:59
Hello All i want to set when the player jump no -hp plesae how
+ rep who is help me
+ rep who is help me
new nohptimer[MAX_PLAYERS] = -1;
public OnPlayerConnect(playerid)
{
nohptimer[playerid] = -1;
return 1;
}
forward OnPlayerReachGround(playerid, Float:health);
public OnPlayerReachGround(playerid, Float:health)
{
nohptimer[playerid] = -1;
SetPlayerHealth(playerid, health);
return 1;
}
//just to make sure player updating and taking damage is not effected by the timer
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(nohptimer[playerid] != -1) KillTimer(nohptimer[playerid]);
nohptimer[playerid] = -1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(nohptimer[playerid] != -1) KillTimer(nohptimer[playerid]);
nohptimer[playerid] = -1;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(nohptimer[playerid] != -1) KillTimer(nohptimer[playerid]);
nohptimer[playerid] = -1;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(nohptimer[playerid] != -1) KillTimer(nohptimer[playerid]);
nohptimer[playerid] = -1;
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_JUMP)
{
new Float:health;
GetPlayerHealth(playerid, health);
if(nohptimer[playerid] != -1) KillTimer(nohptimer[playerid]);
nohptimer[playerid] = SetTimerEx("OnPlayerReachGround", 2 * 1000, false, "if", playerid, health);
}
return 1;
}