Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_players>
- #include <a_samp>
- new InAir[MAX_PLAYERS];
- new CheckIfLanded[MAX_PLAYERS];
- new AlreadyDoubleHopped[MAX_PLAYERS];
- new ZWasZeroAtLastCheck[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- InAir[playerid] = 0;
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == 32)
- {
- if(!IsPlayerInAnyVehicle(playerid))
- {
- new Float:x,Float:y,Float:z;
- GetPlayerVelocity(playerid,x,y,z);
- if(InAir[playerid] == 0 && z == 0)
- {
- CheckIfLanded[playerid] = 1;
- InAir[playerid] = 1;
- AlreadyDoubleHopped[playerid] = 0;
- }
- else
- {
- if(AlreadyDoubleHopped[playerid] == 1) return 1;
- if(z <= 0)
- {
- SetPlayerVelocity(playerid,x,y,4);
- AlreadyDoubleHopped[playerid] = 1;
- }
- else
- {
- SetPlayerVelocity(playerid,x,y,z+4);
- AlreadyDoubleHopped[playerid] = 1;
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(CheckIfLanded[playerid] == 1)
- {
- if(!IsPlayerInAnyVehicle(playerid))
- {
- new Float:x,Float:y,Float:z;
- GetPlayerVelocity(playerid,x,y,z);
- if(z == 0)
- {
- if(ZWasZeroAtLastCheck[playerid] == 1)
- {
- ZWasZeroAtLastCheck[playerid] = 0;
- InAir[playerid] = 0;
- return 1;
- }
- ZWasZeroAtLastCheck[playerid] = 1;
- if(x > 0 || x < 0 || y > 0 || y < 0)
- {
- return 1;
- }
- else
- {
- InAir[playerid] = 0;
- AlreadyDoubleHopped[playerid] = 0;
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement