CMD:superjump( playerid, params[ ] ) { #pragma unused params if(PlayerInfo[playerid][SjKey] == 0) { PlayerInfo[playerid][SjKey] = 1; SendClientMessage(playerid, COLOR_RED, "You turned off Super Jump {00FF00}(/Superjump)"); } else { PlayerInfo[playerid][SjKey] = 0; SendClientMessage(playerid, COLOR_RED, "You turned on Super Jump. Press {00FF00}LShift {FF0000}to use it"); } } if ( newkeys & KEY_JUMP && PlayerInfo[ playerid ][ SjKey ] == 1 ) { new Float:SuperJump[3]; GetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]); SetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]+5); return ( 1 ); }
CMD:superjump( playerid, params[ ] )
{
#pragma unused params
if(PlayerInfo[playerid][SjKey] == 0)
{
PlayerInfo[playerid][SjKey] = 0;
SendClientMessage(playerid, COLOR_RED, "{00FFCC}[AFS]{FF0000}You turned off Super Jump {00FF00}(/Superjump)");
}
else
{
PlayerInfo[playerid][SjKey] = 1;
SendClientMessage(playerid, COLOR_RED, "{00FFCC}[AFS]{FF0000}You turned on Super Jump. Press {00FF00}LShift {FF0000}to use it");
}
}
if ( newkeys & KEY_JUMP && PlayerInfo[ playerid ][ SjKey ] == 1 )
{
new Float:SuperJump[3];
GetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]);
SetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]+5);
return ( 1 );
}
CMD:superjump( playerid, params[ ] ) { #pragma unused params if(PlayerInfo[playerid][SjKey] == 0) { PlayerInfo[playerid][SjKey] = 1; SendClientMessage(playerid, COLOR_RED, "You turned on Super Jump. Press {00FF00}LShift {FF0000}to use it"); } else if(PlayerInfo[playerid][SjKey] == 1) { PlayerInfo[playerid][SjKey] = 0; SendClientMessage(playerid, COLOR_RED, "You turned off Super Jump {00FF00}(/Superjump)"); } } if ( newkeys & KEY_JUMP && PlayerInfo[ playerid ][ SjKey ] == 1 ) { new Float:SuperJump[3]; GetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]); SetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]+5); return ( 1 ); }
pawn Код:
|
CMD:superjump(playerid)
{
if(PlayerInfo[playerid][SjKey] == 1)
{
PlayerInfo[playerid][SjKey] = 0;
SendClientMessage(playerid, COLOR_RED, "{00FFCC}[AFS]{FF0000}You turned off Super Jump {00FF00}(/Superjump)");
}
else
{
PlayerInfo[playerid][SjKey] = 1;
SendClientMessage(playerid, COLOR_RED, "{00FFCC}[AFS]{FF0000}You turned on Super Jump. Press {00FF00}LShift {FF0000}to use it");
}
return 1;
}
//at the top will be good under the includes//
new Float:SuperJump[3];
//anywhere outside all the call backs//
CMD:superjump( playerid, params[ ] )
{
#pragma unused params
if(PlayerInfo[playerid][SjKey] == 1)
{
PlayerInfo[playerid][SjKey] = 0;
SendClientMessage(playerid, COLOR_RED, "You turned off Super Jump {00FF00}(/Superjump)");
return 1;
}
else
{
PlayerInfo[playerid][SjKey] = 1;
SendClientMessage(playerid, COLOR_RED, "You turned on Super Jump. Press {00FF00}LShift {FF0000}to use it");
return 1;
}
return 1;
}
//onplayerkeystatechange//
if ( newkeys & KEY_JUMP && PlayerInfo[ playerid ][ SjKey ] == 1 )
{
SetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]+5);
return 1;
}
//At Onplayerupdate//
GetPlayerVelocity(playerid, SuperJump[0], SuperJump[1], SuperJump[2]);
pawn Код:
|
The SuperJump variable doesn't need to be a global it was fine within the scope of OnPlayerKeyStateChange (Local variable).
|
I am getting the player's velocity on player update, it will be not possible without it -_-
|