#Paper Posted December 12, 2010 Share Posted December 12, 2010 Mhh don't show any error, but don't works: addEvent("onPlayerPickupRacePickup") function sevehicle() setElementData ( source, "Vehicle", getElementModel ( getVehicleOccupant ( source ) ) ) end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),sevehicle) How i can make that /login command and /register command, to use a gui instead not? Link to comment
Aibo Posted December 12, 2010 Share Posted December 12, 2010 1. you're not checking if pickup is a vehiclechange 2. you're getting vehicleOccupant of a player (source is player here), use getPedOccupiedVehicle() 3. no need to get player's vehicle/id, if you're using vehicle change addEvent("onPlayerPickupRacePickup") function sevehicle(pID, pType, vehicleID) if vehicleID then setElementData(source, "Vehicle", tostring(vehicleID)) end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),sevehicle) though if you want to update this on every pickup type: addEvent("onPlayerPickupRacePickup") function sevehicle() local vehicleID = getElementModel(getPedOccupiedVehicle(source)) if vehicleID then setElementData(source, "Vehicle", tostring(vehicleID)) end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),sevehicle) as for second question: there were some «login gui» resources in the community, search it or script one yourself. PS: you also may want to try using https://wiki.multitheftauto.com/wiki/Get ... eFromModel to set vehicle name instead of ID. Link to comment
#Paper Posted December 12, 2010 Author Share Posted December 12, 2010 1. you're not checking if pickup is a vehiclechange2. you're getting vehicleOccupant of a player (source is player here), use getPedOccupiedVehicle() 3. no need to get player's vehicle/id, if you're using vehicle change addEvent("onPlayerPickupRacePickup") function sevehicle(pID, pType, vehicleID) if vehicleID then setElementData(source, "Vehicle", tostring(vehicleID)) end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),sevehicle) though if you want to update this on every pickup type: addEvent("onPlayerPickupRacePickup") function sevehicle() local vehicleID = getElementModel(getPedOccupiedVehicle(source)) if vehicleID then setElementData(source, "Vehicle", tostring(vehicleID)) end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),sevehicle) as for second question: there were some «login gui» resources in the community, search it or script one yourself. PS: you also may want to try using https://wiki.multitheftauto.com/wiki/Get ... eFromModel to set vehicle name instead of ID. ty, can you modifi the scritp whit the vehicle's name instad the ID? Link to comment
Aibo Posted December 12, 2010 Share Posted December 12, 2010 replace tostring(vehicleID) with getVehicleNameFromModel(vehicleID) 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