Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_players>
- #include <a_samp>
- #define MAX_HOPS 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(GetPVarInt(playerid,"InAir") == 0 && z == 0)
- {
- SetPVarInt(playerid,"CheckIfLanded",1);
- SetPVarInt(playerid,"InAir",1);
- SetPVarInt(playerid,"AlreadyDoubleHopped",1);
- }
- else
- {
- if(GetPVarInt(playerid,"AlreadyDoubleHopped") == MAX_HOPS) return 1;
- if(z <= 0)
- {
- SetPlayerVelocity(playerid,x,y,4);
- SetPVarInt(playerid,"AlreadyDoubleHopped",GetPVarInt(playerid,"AlreadyDoubleHopped")+1);
- }
- else
- {
- SetPlayerVelocity(playerid,x,y,z+4);
- SetPVarInt(playerid,"AlreadyDoubleHopped",GetPVarInt(playerid,"AlreadyDoubleHopped")+1);
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(GetPVarInt(playerid,"CheckIfLanded") == 1)
- {
- if(!IsPlayerInAnyVehicle(playerid))
- {
- new Float:x,Float:y,Float:z;
- GetPlayerVelocity(playerid,x,y,z);
- if(z == 0)
- {
- if(GetPVarInt(playerid,"ZWasZeroAtLastCheck") == 1)
- {
- SetPVarInt(playerid,"ZWasZeroAtLastCheck",0);
- SetPVarInt(playerid,"InAir",0);
- return 1;
- }
- SetPVarInt(playerid,"ZWasZeroAtLastCheck",1);
- if(x > 0 || x < 0 || y > 0 || y < 0)
- {
- return 1;
- }
- else
- {
- SetPVarInt(playerid,"InAir",0);
- SetPVarInt(playerid,"AlreadyDoubleHopped",0);
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement