zaticsergiu Posted July 22, 2013 Share Posted July 22, 2013 server addEvent( "aw1", true ) function aw1(player,command,id) local x,y,z = getElementPosition(player) veh = createVehicle(560,x,y,z) warpPedIntoVehicle(player,veh) outputChatBox ( "Car Taken", source, 255, 0, 0 ) end addEventHandler ( "aw1", getRootElement(), setaw1 ) client aw1 = guiCreateStaticImage(22,23,250,130,"tab3/aw1.png",false, tab3 ) aw1 = guiCreateButton(22,265,130,40,"Take",false, tab3 ) guiSetProperty(aw1,"NormalTextColour", "FF00FF00") function onGuiClick (button, state, absoluteX, absoluteY) if (source == aw1) then triggerServerEvent ("aw1", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) Help please Link to comment
Vision Posted July 22, 2013 Share Posted July 22, 2013 (edited) Try this server-side addEvent( "aw1", true ) function aw1() local x,y,z = getElementPosition(source) veh = createVehicle(560,x,y,z) warpPedIntoVehicle(source,veh) outputChatBox ( "Car Taken", source, 255, 0, 0 ) end addEventHandler ( "aw1", getRootElement(), aw1 ) Edited July 22, 2013 by Guest Link to comment
Castillo Posted July 22, 2013 Share Posted July 22, 2013 Post how you trigger the event: "aw1". Link to comment
zaticsergiu Posted July 22, 2013 Author Share Posted July 22, 2013 function onGuiClick (button, state, absoluteX, absoluteY) if (source == aw1) then triggerServerEvent ("aw1", getLocalPlayer()) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) Link to comment
Vision Posted July 22, 2013 Share Posted July 22, 2013 Oh, I forgot to change addEventHandler ( "aw1", getRootElement(), setaw1 ) to this addEventHandler ( "aw1", getRootElement(), aw1 ) 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