31.12.2014, 12:13
Hello , please send me that code for disappearing the jetpack after 5 seconds after player press enter button or f button
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
return 1;
}
}
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
SetTimerEx("Remove", 5000, false, "i", playerid);
}
}
return 1;
}
forward Remove(playerid);
public Remove(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z+1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
return 1;
}
CMD:jetpack(playerid, params[])
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
return 1;
}
SetTimerEx("Remove", 5000, false, "i", playerid);
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z+1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
}
return 1;
}
CMD:jetpack(playerid, params[])
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
return 1;
}