xXMADEXx Posted February 9, 2013 Posted February 9, 2013 I made this code, to set a vehicle's color with an edit. No luck.. Client: local r = tonumber (guiGetText(rog_modshop_colors_edit_r)) local g = tonumber (guiGetText(rog_modshop_colors_edit_r)) local b = tonumber (guiGetText(rog_modshop_colors_edit_b)) triggerServerEvent ( "rog:modshop:color:setColor", localPlayer, localPlayer, r, g, b ) Server addEvent("rog:modshop:color:setColor",true) addEventHandler("rog:modshop:color:setColor",root, function (r,g,b) local veh = getPedOccupiedVehicle(source) setVehicleColor(veh,r,g,b) end )
Vision Posted February 9, 2013 Posted February 9, 2013 triggerServerEvent ( "rog:modshop:color:setColor", localPlayer, localPlayer, r, g, b ) Should be triggerServerEvent ( "rog:modshop:color:setColor", localPlayer, r, g, b )
denny199 Posted February 9, 2013 Posted February 9, 2013 You had 2 times getLocalPlayer within triggerServerEvent bool triggerServerEvent ( string event, element theElement, [arguments...] ) local r = tonumber (guiGetText(rog_modshop_colors_edit_r)) local g = tonumber (guiGetText(rog_modshop_colors_edit_r)) local b = tonumber (guiGetText(rog_modshop_colors_edit_b)) player = getLocalPlayer() triggerServerEvent ( "rog:modshop:color:setColor", player, player, r, g, b ) addEvent("rog:modshop:color:setColor",true) addEventHandler("rog:modshop:color:setColor",root, function (player,r,g,b) local veh = getPedOccupiedVehicle(player) setVehicleColor(veh,r,g,b) end )
xXMADEXx Posted February 9, 2013 Author Posted February 9, 2013 Thank you guys, for working scripts and fast response
50p Posted February 10, 2013 Posted February 10, 2013 Just so you know, you can use client "hidden variable" in custom server side events triggered by clients to get the player who triggered the event.
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