25.04.2012, 14:11
thanks but after every jump it(SuperJumpEnabled) set's to 0 again... and we have to /jump again to set it enabled... how can i fix it?
pawn Код:
command(jump, playerid, params[])
{
if(SuperJumpEnabled[playerid] == 0)
{
SuperJumpEnabled[playerid] = 1;
SendClientMessage(playerid, -1, "Super Jump is now enabled.");
}
else
{
SuperJumpEnabled[playerid] = 0;
SendClientMessage(playerid, -1, "Super jump is now disabled.");
}
return 1;
}
pawn Код:
new
SuperJumpEnabled[MAX_PLAYERS], // you had a ; here, which is wrong, unless if you want to define just one variable, here you are defining 5 variables (so if you use ;, then you need to type "new (var)" again.
Float:pX,
Float:pY,
Float:pZ,
IsJumping[MAX_PLAYERS];
forward ResetJumping(playerid);
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(SuperJumpEnabled[playerid] == 1)
{
if(newkeys == KEY_JUMP && SuperJumpEnabled[playerid] == 1)
{
SuperJumpEnabled[playerid] = 0;
GetPlayerVelocity(playerid, pX, pY, pZ);
SetPlayerVelocity(playerid, pX,pY, pZ+5);
SetTimerEx("ResetJumping", 2500, false, "d" , playerid);
}
}
return 1;
}
public ResetJumping(playerid)
{
IsJumping[playerid] = 0;
return true;
}