TheRealCow Posted July 7, 2010 Share Posted July 7, 2010 addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( player ) if (source == GUIEditor_Button[16]) then player = getLocalPlayer() local red = guiGetText ( GUIEditor_Edit[4] ) local green = guiGetText ( GUIEditor_Edit[5] ) local blue = guiGetText ( GUIEditor_Edit[6] ) setPlayerNametagColor ( player, red, green, blue ) end end ) idk why, but the player nametag color wont change. no error in debug. Link to comment
50p Posted July 7, 2010 Share Posted July 7, 2010 I'm surprised you don't get an error or warning even... Do you ever use "debugscript 3" command? You can't pass string to setPlayerNametagColor... They have to be numbers. So, what about tonumber( red )? Why not make it server-side so that others can see the change? Link to comment
TheRealCow Posted July 7, 2010 Author Share Posted July 7, 2010 i was used /debugscript 3 ... hmm, when i do it in client side, then the other players dont see that ? Link to comment
50p Posted July 7, 2010 Share Posted July 7, 2010 i was used /debugscript 3 ... hmm, when i do it in client side, then the other players dont see that ? Obviously not... Client-side scripts don't affect the server. Server doesn't know about you changing colour so how would other players know about it? Link to comment
TheRealCow Posted July 7, 2010 Author Share Posted July 7, 2010 hmm i made it to server side: -client: addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( player ) if (source == GUIEditor_Button[16]) then gMe = getLocalPlayer() local red = guiGetText ( GUIEditor_Edit[4] ) local green = guiGetText ( GUIEditor_Edit[5] ) local blue = guiGetText ( GUIEditor_Edit[6] ) triggerServerEvent ( "nametagcolor", gMe, red, green, blue ) end end ) -server: function nametagcolor ( player, red, green, blue ) setPlayerNametagColor ( player, tonumber(red), tonumber(green), tonumber(blue) ) end addEvent ( "nametagcolor", true ) addEventHandler ( "nametagcolor", getRootElement(), nametagcolor ) debug: Bad argument @ setPlayerNametagColor - line 2 Link to comment
50p Posted July 7, 2010 Share Posted July 7, 2010 You pass only 3 arguments in triggerServerEvent but you use 4 in server-side event handler. You used gMe as 2nd argument in triggerServerEvent, so this is going to be source. Remove player from nametagcolor function and use source in setPlayerNametagColor. Link to comment
TheRealCow Posted July 7, 2010 Author Share Posted July 7, 2010 function nametagcolor ( red, green, blue ) setPlayerNametagColor ( source, tonumber(red), tonumber(green), tonumber(blue) ) end addEvent ( "nametagcolor", true ) addEventHandler ( "nametagcolor", getRootElement(), nametagcolor ) still dosent do enything. no errors Link to comment
TheRealCow Posted July 7, 2010 Author Share Posted July 7, 2010 oke, enyway, thx 50p, idk why, but it wasnt showed nametag color, when freeroam wasnt runned. When freeroam run, then it works thx Link to comment
TheRealCow Posted July 7, 2010 Author Share Posted July 7, 2010 one question more.. did all client side things been showed only local player? like settVehicleHeadlightColor and those?? Link to comment
50p Posted July 7, 2010 Share Posted July 7, 2010 Everything client-side is only shown and affects the player on whom the script executes. If you change headlights colour in a client-side script, only that person will see the effects. Link to comment
TheRealCow Posted July 7, 2010 Author Share Posted July 7, 2010 damn, need to remake that script 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