
Absence2
Members-
Posts
267 -
Joined
-
Last visited
Everything posted by Absence2
-
I just wanted to butt in and ask, is "Mayn't" a word o_o?
-
lights = guiCreateWindow(259,238,290,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,100,21,"255",false,lights) guiEditSetMaxLength ( redEdit, 3 ) greenEdit = guiCreateEdit(110,87,100,21,"255",false,lights) guiEditSetMaxLength ( greenEdit, 3 ) blueEdit = guiCreateEdit(110,125,100,21,"255",false,lights) guiEditSetMaxLength ( blueEdit, 3 ) 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) local veh = getPedOccupiedVehicle ( localPlayer ) local r, g, b = getVehicleHeadLightColor(veh) local changeColor = true addEventHandler("onClientGUIChanged", root, function () local red,green,blue if (source == redEdit or source == greenEdit or source == blueEdit and changeColor == true) then red = guiGetText ( redEdit ) green = guiGetText ( greenEdit ) blue = guiGetText ( blueEdit ) if ( red ~= "" and green ~= "" and blue ~= "" and tonumber(red) and tonumber(green) and tonumber(blue)) then if (veh and changeColor == true) then setVehicleHeadLightColor(veh, red, green, blue) end end end end ) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then r, g, b = getVehicleHeadLightColor(veh) guiSetVisible(lights, true) guiSetVisible(wMechanic, false) guiSetInputEnabled(true) changeColor = 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) guiSetInputEnabled(false) guiSetVisible ( lights, false ) guiSetVisible(wMechanic, true) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then setVehicleHeadLightColor(veh, r, g, b) changeColor = false guiSetInputEnabled(false) guiSetVisible ( lights, false ) showCursor ( false ) guiSetVisible(wMechanic, true) end end ) I came up with this but had a small error, I'll try ours. EDIT: It seems to be working Everything is fixed by the looks of it, thanks everyone, mostly Solidsnake though
-
I did check that, but the Pro Shader resource has far better quality in my opinion and that resource is bigger, pro shader is on 0.5 mb =/
-
Kenix, it's this: setVehicleHeadLightColor(veh, red, green, blue) not the button they don't cancel / disappear or whatever, they stay when I click "Cancel" this is the full code: lights = guiCreateWindow(259,238,290,202,"Vehicle Headlight - $2500",false) guiSetVisible(lights, false) redEdit = guiCreateEdit(110,54,100,21,"255",false,lights) guiEditSetMaxLength ( redEdit, 3 ) greenEdit = guiCreateEdit(110,87,100,21,"255",false,lights) guiEditSetMaxLength ( greenEdit, 3 ) blueEdit = guiCreateEdit(110,125,100,21,"255",false,lights) guiEditSetMaxLength ( blueEdit, 3 ) 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("onClientGUIChanged", root, function () if (source == redEdit or source == greenEdit or source == blueEdit) 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 local veh = getPedOccupiedVehicle ( localPlayer ) if (veh) then setVehicleHeadLightColor(veh, red, green, blue) end end end end ) addEventHandler ( 'onClientGUIClick', root, function ( ) if (source == bMechanicNine ) then guiSetInputEnabled(true) guiSetVisible(lights, true) guiSetVisible(wMechanic, false) 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) guiSetInputEnabled(false) guiSetVisible ( lights, false ) guiSetVisible(wMechanic, true) else outputChatBox ( 'You are not in a vehicle!' ) end end elseif ( source == cancelPurchaseButton ) then guiSetInputEnabled(false) guiSetVisible ( lights, false ) showCursor ( false ) guiSetVisible(wMechanic, true) end end ) I have to disable thissomehow when you click on the cancelPurchaseButton: setVehicleHeadLightColor(veh, red, green, blue) somehow when you click on the cancelPurchaseButton, but don't know how. also, this didn't work: elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) cancelEvent()
-
Well I was way off then, well thanks, I just have a small problem, if you click the cancelPurchaseButton, the event stays and you'll have your "Preview" lights until you /reconnect How do I cancel the event when you click on "Cancel"? elseif ( source == cancelPurchaseButton ) then guiSetVisible ( lights, false ) showCursor ( false ) like this
-
like this? ( This will also end up as a preview? right, just making sure). redEdit = guiCreateEdit(110,54,142,24,"",false,lights) addEventHandler("onClientGUIChanged", redEdit, function(red)
-
Hehe, I just have a small question, if I type something in in edit fields, is it possible to "auto-preview" the vehicle light's color?
-
https://community.multitheftauto.com/index.php?p= ... ls&id=3011 It's compiled so I can't change anything though The resource itself is just brilliant and realistic, why I want to edit it because it pops up over the account/register page and can mess things up together with the Text saying a player activated it. Anyone who has a similar shader like this but triggered with a command or know where I can find it? I want it optional at any time to disable / enable it, hence the command triggerering (without the GUI), just enable/disable the vehicle shader. Thank you in advance.
-
Works, thanks so much for your help , once again, not the first time you've saved my day.
-
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?
-
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?
-
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: 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 )
-
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?
-
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
-
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)
-
Then what o_o? & @Draken, thank you, it worked
-
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
-
I'm trying to force a player to "read" it, open it for a specific player via a command then use a timer so they cannot close it until the time is up. (My guiWindow is scripted on F9).
-
viewtopic.php?f=91&t=28778&hilit=Internet+Radio
-
How do I "force-popup" a gui window in a player's face, then deny their access to press it down with a key? command-wise This is my GUI window.. no idea what to do from here. All I found was: ForcePlayerMap Though, I'm not sure if that's right plus no idea how to use it. myWindow = nil pressed = false ----------------------[KEY BINDS]-------------------- function bindKeys() bindKey("F9", "down", F9RPhelp) end addEventHandler("onClientResourceStart", getRootElement(), bindKeys) function resetState() pressed = false end ---------------------------[HELP]-------------------- function F9RPhelp( key, keyState ) if not (pressed) then pressed = true setTimer(resetState, 200, 1) if ( myWindow == nil ) then myWindow = guiCreateWindow(352,185,330,401,"Server Rules", false) local tabPanel = guiCreateTabPanel(9,25,312,367,false, myWindow) local rules = guiCreateTab("Server Rules", tabPanel) local guide = guiCreateTab("Roleplay Guide", tabPanel) local help = guiCreateTab("Help", tabPanel) local admin = guiCreateTab("Staff List", tabPanel) ------------------ local xml1 = xmlLoadFile( "rules.xml" ) local contents1 = xmlNodeGetValue( xml1 ) local xml2 = xmlLoadFile( "guide.xml" ) local contents2 = xmlNodeGetValue( xml2 ) local xml3 = xmlLoadFile( "help.xml" ) local contents3 = xmlNodeGetValue( xml3 ) local xml4 = xmlLoadFile( "staff.xml" ) local contents4 = xmlNodeGetValue( xml4 ) ------------------ guiCreateMemo(0.03,0.03,0.94,0.95,contents1,true,rules) guiCreateMemo(0.03,0.03,0.94,0.95,contents2,true,guide) guiCreateMemo(0.03,0.03,0.94,0.95,contents3,true,help) guiCreateMemo(0.03,0.03,0.94,0.95,contents4,true,admin) showCursor ( true ) else destroyElement(myWindow) myWindow = nil showCursor(false) end end end (The GUI window) but.. then what?
-
Thanks for the tip, I'm working on the positions, makes it a lot easier having guieditor for it Was on this, but it was huge: dxDrawRelativeRectangle( 421.0,1.0,793.0,52.0,tocolor( 0,0,0,150 ),false ) This should do well: dxDrawRectangle(323.0,0.0,426.0,64.0,tocolor(0,0,0,150),false) centers it very well together with the text, thank you so much man, I really appreciate it. I'm tired of outputchatbox login/logouts... they're spam-ish.
-
Works perfectly fine, thank you , problem solved :3
-
This one worked for me, local sText = '' local uTimer function dxDrawRelativeText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawText( tostring( text ), ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( right/resolutionX )*sWidth, ( bottom/resolutionY)*sHeight, color,( sWidth/resolutionX )*scale, mixed_font, alignX, alignY, clip, wordBreak, postGUI ) end function dxDrawRelativeRectangle( posX, posY, width, height,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawRectangle( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI ) end function fDraw( quitReason ) sText = sText..string.format( 'Server: %s has %s the server %s \n', getPlayerName( source ), eventName == 'onClientPlayerQuit' and 'left' or eventName == 'onClientPlayerJoin' and 'join', eventName == 'onClientPlayerQuit' and '(' .. quitReason .. ')' or '' ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawRelativeRectangle( 245.0,0.0,365.0,23.0,tocolor( 0,0,0,150 ),false ) dxDrawRelativeText( sText,254.0,0.0,757.0,20.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) end end ) addEventHandler ( 'onClientPlayerQuit', root, fDraw ) addEventHandler ( 'onClientPlayerJoin', root, fDraw )
-
Because you not have this functions in code Learn lua please! viewtopic.php?f=91&t=40809 I asked if I should of implanted it or not, and I was given a "no" and I'll learn Lua, no doubt about that , thanks for your help, all of you.