Blinker. Posted November 9, 2014 Posted November 9, 2014 hello folks , i was trying to add a vehicle upgrade when the player spawn but it's not working. Errors : @ addVehicleUpgrade(veh,id) | expected ped at argument 1 got nil so i guess it's not detecting the ped to detect the Vehicle he's using. i'm using the following: -- id is defined. addEventHandler("onPlayerSpawn",root, function() outputChatBox'1' local veh = getPedOccupiedVehicle( source ) addVehicleUpgrade(veh,id) end) Any help would be greatly appreciated
TAPL Posted November 9, 2014 Posted November 9, 2014 How would a player just got spawned have vehicle? And please post image of the error, I want to see where it say 'expected ped' since the function itself require vehicle not ped.
Blinker. Posted November 9, 2014 Author Posted November 9, 2014 Hello TAPL , i tried using setTimer , and aslo it's not working. the error is @ local veh = getPedOccupiedVehicle( source ) actually. so i wanted to reduce the size of the error since the error is @ local veh = getPedOccupiedVehicle( source ) and it's causing the addVehicleUpgrade(veh,id) to stop working tho.
Anubhav Posted November 9, 2014 Posted November 9, 2014 (edited) -- id is defined. addEventHandler("onPlayerSpawn", root, function() outputChatBox('1', source) local veh = getPedOccupiedVehicle( source ) if veh then addVehicleUpgrade( veh, id ) else return outputChatBox("noveh") end end ) Edited November 9, 2014 by Guest
Blinker. Posted November 9, 2014 Author Posted November 9, 2014 lol man it's the same , if i delete outputChatBox or add it , doesn't work.
Anubhav Posted November 9, 2014 Posted November 9, 2014 That mean's you're not in a vehicle. (facepalm)
Blinker. Posted November 9, 2014 Author Posted November 9, 2014 using race , how am i supposed to leave the vehicle?
'LinKin Posted November 9, 2014 Posted November 9, 2014 Use: onPlayerVehicleEnter Or onVehicleEnter, I dont remember the name. Look at wiki
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