17.03.2013, 01:55
No that's not how it works.
You need a var. Set it to 1.
If 0, Then megajump from OnPlayerKeyStateChange will be blocked.
But when it's 1. Then it will be worked. Simple eh?
You need a var. Set it to 1.
If 0, Then megajump from OnPlayerKeyStateChange will be blocked.
But when it's 1. Then it will be worked. Simple eh?
pawn Код:
new MegaJump[MAX_PLAYERS]; //at the top of the script
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerConnect(playerid)
{
MegaJump[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
MegaJump[playerid] = 0;
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(MegaJump[playerid] == 1)
{
if(PRESSED(KEY_JUMP))
{
new Float:P[3];
GetPlayerPos(playerid,P[0],P[1],P[2]);
GetPlayerVelocity(playerid,P[0],P[1],P[2]);
SetPlayerVelocity(playerid,P[0],P[1],P[2]+5.0);
}
}
return 1;
}
CMD:megajump(playerid, params[])
{
if(MegaJump[playerid] == 0)
{
//Messages, Sound etc...
MegaJump[playerid] = 1;
}
else if(MegaJump[playerid] == 1)
{
//Messages, Sound etc...
MegaJump[playerid] = 0;
}
return 1;
}