ReeferMadness Posted October 5, 2016 Share Posted October 5, 2016 (edited) For those who don't know carhopping is opening an unlocked car and looting it (taking change and whatnot valuables people leave in their car), but not taking the car. /spawn spawns an unlocked baitCar when you enter any vehicle and that vehicle is a bait car, the player will freeze for 15 seconds, player will force exit, a message will say "Looting..." and a small amount of cash is handed to the player. My problem is the getPedOccupiedVehicle, it's getting the vehicle element instead of the player and im wondering why --NPC CARS function createBaitCar(player,command) baitCar = createVehicle(551, 2321, -1951 , 14,0,0,90) baitCarChance = 1 if baitCarChance == 1 then setVehicleLocked(baitCar, false) outputChatBox("Created unlocked bait car.",player) elseif baitCarChance > 1 then setVehicleLocked(baitCar, true) outputChatBox("Created locked bait car.",player) end end function carHop(vehicle,player) hoppedCar = getPedOccupiedVehicle(player) if hoppedCar == baitCar then outputChatBox("Looting...") end end addCommandHandler("spawn", createBaitCar ) addEventHandler("onPlayerVehicleEnter", getRootElement(), carHop) Edited October 5, 2016 by ReeferMadness Link to comment
iPrestege Posted October 5, 2016 Share Posted October 5, 2016 use 'onVehicleStartEnter' ,Insted of onPlayerVehicleEnter player enteringPlayer, int seat, player jacked, int door Link to comment
ReeferMadness Posted October 6, 2016 Author Share Posted October 6, 2016 got it fixing, I just needed to put source instead of player and now im just having issues with turning the car off after exit Link to comment
iPrestege Posted October 6, 2016 Share Posted October 6, 2016 So what the problem is show me what you did so i can see where is the problem in? If you want to turn off an engine of a vehicle use : https://wiki.multitheftauto.com/wiki/SetVehicleEngineState and the event will be : 'onPlayerVehicleExit' Link to comment
ReeferMadness Posted October 6, 2016 Author Share Posted October 6, 2016 51 minutes ago, FaHaD said: So what the problem is show me what you did so i can see where is the problem in? If you want to turn off an engine of a vehicle use : https://wiki.multitheftauto.com/wiki/SetVehicleEngineState and the event will be : 'onPlayerVehicleExit' That would be all I need thanks! I will PM you if I have any other encounters Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now