Absence2 Posted March 5, 2012 Share Posted March 5, 2012 (edited) Hey, I have came this far with my headlights script: --the window itself lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) --edit field redEdit = guiCreateEdit(110,54,142,24,"",false,lights) --edit field greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) --edit field blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) --labels redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) --purchase colored vehicle lights --If Purchase button clicked, change the vehicles headlight color! buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) function buyVLights( red, green, blue ) red = tonumber(redEdit) green = tonumber ( greenEdit ) blue = tonumber ( blueEdit) if red and green and blue then local color = setVehicleHeadLightColor ( theVehicle, red, green, blue ) outputChatBox( "You have changed your vehicle lights." ) end end addEventHandler ( "onClientGUIClick",buyVLightsButton ,buyVLights, false ) --cancel the purchase of headlights cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) function cancelPurchase() destroyElement(greenEdit) destroyElement(blueEdit) destroyElement(redEdit) destroyElement(cancelPurchaseButton) destroyElement(buyVLightsButton) destroyElement(lights) greenEdit, blueEdit, redEdit, cancelPurchaseButton, buyVLightsButton, lights = nil end addEventHandler ( "onClientGUIClick",cancelPurchaseButton,cancelPurchase, false ) Is the Edits right and how do I connect it to the buyVLightsButton ? No errors. Trying to make so when you press "Purchase" you add vehicle lights to the vehicle Edited March 6, 2012 by Guest Link to comment
drk Posted March 5, 2012 Share Posted March 5, 2012 lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) setVehicleHeadLightColor ( veh, red, green, blue ) outputChatBox ( 'You have changed your vehicle lights!' ) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 If you change the head lights client side, others won't see them. Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 If you change the head lights client side, others won't see them. Then what o_o? & @Draken, thank you, it worked Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 If you change the head lights client side, others won't see them. Then what o_o? & @Draken, thank you, it worked Use triggerServerEvent to trigger a event to the server side, there you can also take the money, because taking money client side won't work. Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 Well, I'm kinda lost, I'm supposed to add this to a second GUI window. This button > -- Vehicle Lights bMechanicNine = guiCreateButton( 0.05, y, 0.9, 0.1, "Vehicle Headlights - $2500", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicNinje, lightTriger, false) y = y + 0.1 Then, I'm supposed to add this part over to serverside: function ( ) if ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) setVehicleHeadLightColor ( veh, red, green, blue ) outputChatBox ( 'You have changed your vehicle lights!' ) else outputChatBox ( 'You are not in a vehicle!' ) end end end end ) Then use this: function lightTrigger() triggerServerEvent( "headlights", getLocalPlayer(), currentVehicle ) closeMechanicWindow() end Any help here Should this be the serverside part? function headlightsColor() if ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) setVehicleHeadLightColor ( veh, red, green, blue ) outputChatBox ( 'You have changed your vehicle lights!' ) else outputChatBox ( 'You are not in a vehicle!' ) end end end end ) addEvent("headlights", true) addEventHandler("headlights", getRootElement(), headlightsColor) Is all of this right? But what to do with the GUI buttons? lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 No, that's a mess. -- client side: lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) -- server side: addEvent("onHeadLightsChange",true) addEventHandler("onHeadLightsChange",root, function (currentVehicle, red, green, blue) if (currentVehicle) then setVehicleHeadLightColor ( currentVehicle, tonumber(red) or 255, tonumber(green) or 255, tonumber(blue) or 255 ) outputChatBox ( 'You have changed your vehicle lights!', source ) end end ) Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 Well as I said, I have to trigger the window with this button, if not, it has to stay hidden, -- Vehicle Lights bMechanicNine = guiCreateButton( 0.05, y, 0.9, 0.1, "Vehicle Headlights - $2500", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicNinje, lightTriger, false) y = y + 0.1 then this (I get syntax error at function, line 2) addEventHandler ( 'onClientGUIClick', root, function lightTriger () if ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) Poked around with it and doesn't seem to fix Link to comment
drk Posted March 5, 2012 Share Posted March 5, 2012 Well as I said, I have to trigger the window with this button, if not, it has to stay hidden, -- Vehicle Lights bMechanicNine = guiCreateButton( 0.05, y, 0.9, 0.1, "Vehicle Headlights - $2500", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicNinje, lightTriger, false) y = y + 0.1 then this (I get syntax error at function, line 2) addEventHandler ( 'onClientGUIClick', root, function lightTriger () if ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) Poked around with it and doesn't seem to fix You can't put function name. It have to be: addEventHandler ( 'eventName', root, function ( ) -- Something here end ) Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then guiSetVisible(lights, true) elseif ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then guiSetVisible(lights, true) elseif ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) didn't work, it shows all the time on resource start and buttons stopped working =/ @Draken, I didn't really catch ya there, what do you mean? Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 Are you sure? because it didn't show the window when I tested it. Link to comment
drk Posted March 5, 2012 Share Posted March 5, 2012 lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then guiSetVisible(lights, true) elseif ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) didn't work, it shows all the time on resource start and buttons stopped working =/ @Draken, I didn't really catch ya there, what do you mean? When you use like this: addEventHandler ( 'eventName', root, ---- ---- end ) You can't put like function example() You can't put name in functions. Example of correct script: addEventHandler ( 'onResourceStart', root, function() -- Something end ) Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 Are you sure? because it didn't show the window when I tested it. I wasn't sure I messed up badly, I had missed to erase a few parts which duplicated the windows multiple times, I have no freaking idea how I could of missed that, LOL. Like this: lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then guiSetVisible(lights, true) elseif ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red and green and blue ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) Now I just need to figure out how to hide it after pressing 'Purchase' , any ideas? (It's not in the clientside part so I'm lost ) Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 Use triggerClientEvent in the server side, that'll trigger a event to the client side where you can use guiSetVisible. Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 Use triggerClientEvent in the server side, that'll trigger a event to the client side where you can use guiSetVisible. Oh okay, can you help me with one last thing then? addEvent("onHeadLightsChange",true) addEventHandler("onHeadLightsChange",root, function (currentVehicle, red, green, blue) if (currentVehicle) then if exports.global:hasMoney(player, 2500) then exports.global:takeMoney(player, 2500) setVehicleHeadLightColor ( currentVehicle, tonumber(red) or 255, tonumber(green) or 255, tonumber(blue) or 255 ) outputChatBox ( 'You have changed your vehicle lights!', source ) else outputChatBox ( 'Not Enough Cash!', source ) end end end ) It doesn't let me Purchase lights with or without the money, gives me the second message, "Not Enough Cash!" also, can I set it so only numbers are allowed in the Edit field? Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 addEvent("onHeadLightsChange",true) addEventHandler("onHeadLightsChange",root, function (currentVehicle, red, green, blue) if (currentVehicle) then if exports.global:hasMoney(source, 2500) then -- Your player argument is 'source' not 'player. exports.global:takeMoney(source, 2500) -- Your player argument is 'source' not 'player. setVehicleHeadLightColor ( currentVehicle, tonumber(red) or 255, tonumber(green) or 255, tonumber(blue) or 255 ) outputChatBox ( 'You have changed your vehicle lights!', source ) else outputChatBox ( 'Not Enough Cash!', source ) end end end ) Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 Your player argument is 'source' not 'player. /facepalm =/ Well, that's about it but I did find an issue that I don't know to fix. if one edit field is blank (No 0 that is), like 255 255 or --< blank 255 The color becomes white and they have to pay for it. Can I fix this somehow? Forcing them to type something in if they want to hit the "Purchase" Button or auto change to 0 if it's blank? Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 Try this: lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then guiSetVisible(lights, true) elseif ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red ~= "" and green ~= "" and blue ~= "" and tonumber(red) and tonumber(green) and tonumber(blue) ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) Link to comment
Absence2 Posted March 5, 2012 Author Share Posted March 5, 2012 Try this: lights = guiCreateWindow(211,276,322,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,142,24,"",false,lights) greenEdit = guiCreateEdit(110,87,143,26,"",false,lights) blueEdit = guiCreateEdit(108,125,149,27,"",false,lights) redtx = guiCreateLabel(39,58,64,19,"Red, 0-255:",false,lights) greentx = guiCreateLabel(24,93,75,19,"Green, 0-255:",false,lights) bluetx = guiCreateLabel(32,129,67,17,"Blue, 0-255:",false,lights) buyVLightsButton = guiCreateButton(97,176,70,17,"Purchase",false,lights) cancelPurchaseButton = guiCreateButton(166,176,74,17,"Cancel",false,lights) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then guiSetVisible(lights, true) elseif ( source == buyVLightsButton ) then local red = guiGetText ( redEdit ) local green = guiGetText ( greenEdit ) local blue = guiGetText ( blueEdit ) if ( red ~= "" and green ~= "" and blue ~= "" and tonumber(red) and tonumber(green) and tonumber(blue) ) then if ( isPedInVehicle ( localPlayer ) ) then local veh = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent("onHeadLightsChange",localPlayer,veh,red,green,blue) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) end end ) Works, thanks so much for your help , once again, not the first time you've saved my day. Link to comment
Moderators IIYAMA Posted March 5, 2012 Moderators Share Posted March 5, 2012 Solidsnake are you doing this all day? (I mean helping people with scripting) No school or work Link to comment
Castillo Posted March 5, 2012 Share Posted March 5, 2012 School didn't start for me yet, and I don't work, well, I'm a paid scripter, that's my current "work". Link to comment
Moderators IIYAMA Posted March 6, 2012 Moderators Share Posted March 6, 2012 ok, that sounds interresting "paid scripter". Only mta scripts or also php, flash actionscript < this looks like it a little (for websites)? 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