MajdMTA Posted February 21, 2016 Posted February 21, 2016 Help me guys, with this function function buttonPick(vehicle) local x, y, z = getElementPosition(localPlayer) local vehicleZoneName = getZoneName ( x, y, z ) guiSetText(zonexad, "Veh Zone: "..vehicleZoneName) end end I wanna it getting zone for vehicle, I tried to remove (LocalPlayer) It won't work.
KariiiM Posted February 21, 2016 Posted February 21, 2016 function buttonPick(vehicle) if not vehicle then return end local x, y, z = getElementPosition(vehicle) local vehicleZoneName = getZoneName(x, y, z) guiSetText(zonexad, "Veh Zone: "..tostring(vehicleZoneName)) end
MajdMTA Posted February 21, 2016 Author Posted February 21, 2016 function buttonPick(vehicle) if not vehicle then return end local x, y, z = getElementPosition(vehicle) local vehicleZoneName = getZoneName(x, y, z) guiSetText(zonexad, "Veh Zone: "..tostring(vehicleZoneName)) end It's bugged, and it's saying in the text "false"
MajdMTA Posted February 21, 2016 Author Posted February 21, 2016 (edited) Because "vehicle" is not defined. Edited February 21, 2016 by Guest
KariiiM Posted February 21, 2016 Posted February 21, 2016 vehicle still not defined in your code, did you create a vehicle or you just using this parameter for no reason?
MajdMTA Posted February 21, 2016 Author Posted February 21, 2016 (edited) vehicle still not defined in your code, did you create a vehicle or you just using this parameter for no reason? Edited February 21, 2016 by Guest
KariiiM Posted February 21, 2016 Posted February 21, 2016 Can I just know from where you got this "theVehicle" ?
Dimos7 Posted February 21, 2016 Posted February 21, 2016 function buttonPickup(theVehicle) if isElement(theVehicle) and getElementType(theVehicle) == "vehicle" then local x, y, z = getElementPosition(theVehicle) local vehicleZoneName = getZoneName(x, y, z) guiSetText(zonexad, "Veh Zone: ", vehicleZoneName) end end
MajdMTA Posted February 21, 2016 Author Posted February 21, 2016 function buttonPickup(theVehicle) if isElement(theVehicle) and getElementType(theVehicle) == "vehicle" then local x, y, z = getElementPosition(theVehicle) local vehicleZoneName = getZoneName(x, y, z) guiSetText(zonexad, "Veh Zone: ", vehicleZoneName) end end Didn't work, look at the full function function buttonPick(theVehicle) if (source == Button_VS_sn) then if isElement(theVehicle) and getElementType(theVehicle) == "vehicle" then local x, y, z = getElementPosition(theVehicle) local vehicleZoneName = getZoneName(x, y, z) guiSetText(Label_Zone, "", vehicleZoneName) end end end addEventHandler("onClientGUIClick", guiRoot, buttonPick) @Dimos7
Enargy, Posted February 21, 2016 Posted February 21, 2016 function buttonPick() if (source == Button_VS_sn) then local v = getPedOccupiedVehicle(localPlayer) if v then local x, y, z = getElementPosition(v) local vehicleZoneName = getZoneName(x, y, z) guiSetText(Label_Zone, "", tostring(vehicleZoneName)) end end end addEventHandler("onClientGUIClick", guiRoot, buttonPick)
MajdMTA Posted February 21, 2016 Author Posted February 21, 2016 function buttonPick() if (source == Button_VS_sn) then local v = getPedOccupiedVehicle(localPlayer) if v then local x, y, z = getElementPosition(v) local vehicleZoneName = getZoneName(x, y, z) guiSetText(Label_Zone, "", tostring(vehicleZoneName)) end end end addEventHandler("onClientGUIClick", guiRoot, buttonPick) Didn't work, only works with getElementPosition, for player not for vehicle, cause it hidden.
Dimos7 Posted February 22, 2016 Posted February 22, 2016 function buttonPick(v) if button == "left" and state == "down" then if source == Button_VS_sn then if isElement(v) and getElementType(v) == "vehicle" then local x, y, z = getElementPosition(v) local vehicleZoneName = getZoneName(x, y, z) guiSetText(label_Zone, "", tostring(vehicleZoneName)) end end end end addEventHandler("onClientGUIClick", root, buttonPick)
Bonus Posted February 22, 2016 Posted February 22, 2016 It's like you go to the bathroom and expect a apple in your hand. If you want that apple, you have to get it from the store or from the kitchen if you already bought it. How do you expect to get vehicle by clicking on a GUI?
KariiiM Posted February 22, 2016 Posted February 22, 2016 It's like you go to the bathroom and expect a apple in your hand.If you want that apple, you have to get it from the store or from the kitchen if you already bought it. How do you expect to get vehicle by clicking on a GUI? I told that to him multiple of time I hope he can understand that.
bebo1king Posted February 22, 2016 Posted February 22, 2016 function buttonPick() if (source == Button_VS_sn) then if isPedInVehicle (localPlayer) then local Vehicle = getPedOccupiedVehicle (localPlayer) local x, y, z = getElementPosition(Vehicle) local vehicleZoneName = getZoneName ( x, y, z ) guiSetText(zonexad, "Veh Zone: "..vehicleZoneName) end end end
MajdMTA Posted February 22, 2016 Author Posted February 22, 2016 function buttonPick() if (source == Button_VS_sn) then if isPedInVehicle (localPlayer) then local Vehicle = getPedOccupiedVehicle (localPlayer) local x, y, z = getElementPosition(Vehicle) local vehicleZoneName = getZoneName ( x, y, z ) guiSetText(zonexad, "Veh Zone: "..vehicleZoneName) end end end Didn't work, thanks for your hard work guys.
GTX Posted February 22, 2016 Posted February 22, 2016 Did you put event handler? Does button even exist? Show us full code if this doesn't work: function buttonPick() if (source == Button_VS_sn) then if isPedInVehicle (localPlayer) then local Vehicle = getPedOccupiedVehicle (localPlayer) local x, y, z = getElementPosition(Vehicle) local vehicleZoneName = getZoneName ( x, y, z ) guiSetText(zonexad, "Veh Zone: "..vehicleZoneName) end end end addEventHandler("onClientGUIClick", guiRoot, buttonPick)
MajdMTA Posted February 22, 2016 Author Posted February 22, 2016 Did you put event handler? Does button even exist? Show us full code if this doesn't work: function buttonPick() if (source == Button_VS_sn) then if isPedInVehicle (localPlayer) then local Vehicle = getPedOccupiedVehicle (localPlayer) local x, y, z = getElementPosition(Vehicle) local vehicleZoneName = getZoneName ( x, y, z ) guiSetText(zonexad, "Veh Zone: "..vehicleZoneName) end end end addEventHandler("onClientGUIClick", guiRoot, buttonPick) Yes, sure ido, I put the Event Handler
Bonus Posted February 22, 2016 Posted February 22, 2016 "Show us full code" We don't even know what you want to do. Which vehicle? Which GUI? Show the full code or give more informations!
MajdMTA Posted February 23, 2016 Author Posted February 23, 2016 "Show us full code"We don't even know what you want to do. Which vehicle? Which GUI? Show the full code or give more informations! I'll give you more informations.... This is zone for my F2 vehicles system script, I do it when you press "Pick" Button the vehicle zone (City) will be seen instead of Label_Zone Label..
Bonus Posted February 23, 2016 Posted February 23, 2016 Then you have to get the vehicle from somewhere. Do you want to get the zone of the vehicle you are sitting in?
MajdMTA Posted February 23, 2016 Author Posted February 23, 2016 Then you have to get the vehicle from somewhere.Do you want to get the zone of the vehicle you are sitting in? Yes, exactly.
Bonus Posted February 23, 2016 Posted February 23, 2016 What did you mean with "Didn't work, thanks for your hard work guys." The code should have worked then.
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