public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){if (PRESSED(KEY_JUMP)){if (IsPlayerInAnyVehicle(playerid)){ new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);}}return 1;}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){if (PRESSED(KEY_FIRE)){if (IsPlayerInAnyVehicle(playerid)){ new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective; vehicleid = GetPlayerVehicleID(playerid); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); if(engine == 0) { SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective); } else { if(engine == 1) { SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective); } }}}return 1;}CMD:ellop(playerid, params[]){ if (IsPlayerInAnyVehicle(playerid)){ new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective; vehicleid = GetPlayerVehicleID(playerid); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); if(engine == 0) { SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective); SendClientMessage(playerid, -1, \"Ezt az autót nem tudod ellopni mert nem jár a motorja, keress másikat!\"); } else { if(engine == 1) return SendClientMessage(playerid, -1, \"Sikeresen elloptad az autót\"); } } else { SendClientMessage(playerid, -1, \"Te nem ülsz egy autóban sem, így nem is tudod ellopni õket\"); } return 1;}
#define PRESSED(%0) \\(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#pragma tabsize 0
CMD:ellop(playerid, params[]){ new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, vehicleid2; if (IsPlayerInAnyVehicle(playerid)){ vehicleid = GetPlayerVehicleID(playerid); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); if(engine == 0) { SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective); SendClientMessage(playerid, -1, \"Ezt az autót nem tudod ellopni mert nem jár a motorja, keress másikat!\"); } else { if(engine == 1) return SendClientMessage(playerid, -1, \"Sikeresen elloptad az autót\"); } } else { SendClientMessage(playerid, -1, \"Te nem ülsz a kocsiban\"); } vehicleid2 = GetClosestVehicle( playerid ); if(vehicleid2) { SendClientMessage(playerid, -1, \"Feltörted az autót\"); vehicleid = GetPlayerVehicleID(playerid); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); if(doors == 0) { SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective); } else { SendClientMessage(playerid, -1, \"Ennek az autónak nyitva az ajtaja\"); } } return 1;}
stock GetClosestVehicle( playerid ){ new iMax=INVALID_VEHICLE_ID, Float:dis, Float:dMax = float( 10000 ), Float:PlayerPos[ 3 ], Float:VehiclePos[ 3 ]; GetPlayerPos( playerid, PlayerPos[ 0 ], PlayerPos[ 1 ], PlayerPos[ 2 ] ); for( new x = 0; x < MAX_VEHICLES; x++ ) { GetVehiclePos( x, VehiclePos[ 0 ], VehiclePos[ 1 ], VehiclePos[ 2 ] ); for( new j = 0; j < 3; j++ ) PlayerPos[ j ] -= VehiclePos[ j ]; dis = floatsqroot( ( ( PlayerPos[ 0 ] * PlayerPos[ 0 ] ) + ( PlayerPos[ 1 ] * PlayerPos[ 1 ] ) + ( PlayerPos[ 2 ] * PlayerPos[ 2 ] ) ) ); if( dis < dMax ) { dMax = dis, iMax = x; } } return iMax;}