24.03.2013, 18:46
Hey dudes, i've a little problem with vehicles.
In fact, when i enter in any vehicle, owned or not, i can control and drive with it.
So i wanna make that :
-If it's my vehicle nobody else than me can start the vehicle up
- If it isn't my vehicle, i can enter in the vehicle but not start it up.
Can someone help ? Here is the startup code.
Or pastebin: http://pastebin.com/jUK9e2zi
In fact, when i enter in any vehicle, owned or not, i can control and drive with it.
So i wanna make that :
-If it's my vehicle nobody else than me can start the vehicle up
- If it isn't my vehicle, i can enter in the vehicle but not start it up.
Can someone help ? Here is the startup code.
Or pastebin: http://pastebin.com/jUK9e2zi
Quote:
public Startup(playerid, vehicleid) { new pveh = GetVehicleModel(GetPlayerVehicleID(playerid)); new newcar = GetPlayerVehicleID(playerid); if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER || engineOn[vehicleid]) { TogglePlayerControllable(playerid, false); engineOn[GetPlayerVehicleID(playerid)] = false; //I do nothing! } else if(IsPlayerInAnyVehicle(playerid) && !engineOn[vehicleid] && !vehicleEntered[playerid][vehicleid] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && pveh != 510 && pveh != 462 && newcar != 107 && newcar != 108 && newcar != 109 && newcar != 110 && !IsAHarvest(newcar) && !IsADrugHarvest(newcar) && !IsASweeper(newcar)) { engineOn[GetPlayerVehicleID(playerid)] = false; if(voiturepaslui[playerid] == 1) { TogglePlayerControllable(playerid, false); vehicleEntered[playerid][vehicleid] = false; engineOn[GetPlayerVehicleID(playerid)] = false; } if(CarInfo[vehicleid][cOwned]==0 && IsAnOwnableCar(vehicleid)) { TogglePlayerControllable(playerid, false); engineOn[GetPlayerVehicleID(playerid)] = false; } else { SendClientMessage(playerid, COLOR_LIGHT_BLUE, "Faites /contact pour dйmarrer le vйhicule, /sortir ou F pour sortir, /fermer pour fermer ton vйhicule."); TogglePlayerControllable(playerid, 0); vehicleEntered[playerid][vehicleid] = false; } } else if(IsPlayerInAnyVehicle(playerid) && !engineOn[vehicleid] && vehicleEntered[playerid][vehicleid] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && pveh != 510 && pveh != 462 && newcar != 107 && newcar != 108 && newcar != 109 && newcar != 110 && !IsAHarvest(newcar) && !IsADrugHarvest(newcar) && !IsASweeper(newcar)) { if(voiturepaslui[playerid] == 0) { TogglePlayerControllable(playerid, true); } if(CarInfo[vehicleid][cOwned]==1 && IsAnOwnableCar(vehicleid)) { } else { SendClientMessage(playerid, COLOR_LIGHT_BLUE, "Faites /contact pour dйmarrer le vйhicule, /sortir ou F pour sortir, /fermer pour fermer ton vйhicule."); TogglePlayerControllable(playerid, 0); } } } |