new AntiFall[MAX_PLAYERS]; new CurrentCar[MAX_PLAYERS]; #define COLOR_YELLOW 0xFFFF00AA #define COLOR_RED 0xFF0000AA public OnPlayerConnect(playerid) { AntiFall[playerid] = 0; return 1; } public OnPlayerDisconnect(playerid, reason) { AntiFall[playerid] = 0; return 1; } public OnPlayerDeath(playerid, killerid, reason) { AntiFall[playerid] = 0; return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { if ( vehicleid == CurrentCar[playerid] ) { AntiFall[playerid] = 0; } return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { new Float:health; new h; h = GetPlayerHealth(playerid, health); if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) { CurrentCar[playerid] = GetPlayerVehicleID(playerid); } else if ( newstate == PLAYER_STATE_ONFOOT && AntiFall[playerid] == 1 ) { new Float:vX, Float:vY, Float:vZ, Float:vAng; GetVehiclePos(CurrentCar[playerid], vX, vY, vZ); GetVehicleZAngle(CurrentCar[playerid], vAng); SetPlayerPos(playerid, vX, vY, vZ +1); SetPlayerFacingAngle(playerid, vAng); SetPlayerHealth(playerid, h +100); if ( oldstate == PLAYER_STATE_DRIVER ) { PutPlayerInVehicle(playerid, CurrentCar[playerid], 0); } else if ( oldstate == PLAYER_STATE_PASSENGER ) { PutPlayerInVehicle(playerid, CurrentCar[playerid], 1); } } return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { new jump, updown, leftright; if(newkeys == KEY_SECONDARY_ATTACK && GetPlayerKeys(playerid, jump, updown, leftright) ) { if ( AntiFall[playerid] == 1 ) { AntiFall[playerid] = 0; RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_YELLOW, "Anti Bike Fall DISABLED! /antifall to ENABLE again"); } } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/antifall", cmdtext, true, 10) == 0) { if(AntiFallOff[playerid] == 1) { AntiFallOff[playerid] = 0; SendClientMessage(playerid, 0x5BC476FF, "Anti fall off bike disabled"); return 1; } else if(AntiFallOff[playerid] == 0) { AntiFallOff[playerid] = 1; SendClientMessage(playerid, 0x5BC476FF, "Anti fall off bike enabled"); return 1; } return 1; } return 0; }