Jaysds1 Posted June 3, 2011 Share Posted June 3, 2011 This forum is only for my problems and the answers for them. I need to know how to make the background blank and the Login GUI visible, and when they press login it spawns them. Link to comment
AGENT_STEELMEAT Posted June 4, 2011 Share Posted June 4, 2011 Have you even tried this on your own? We don't just give out code here, you need to at least make an attempt. Link to comment
Callum Posted June 4, 2011 Share Posted June 4, 2011 To make the 'background' blank (it is blank by default, however) you can use; fadeCamera(false) As for the login GUI, you can use; guiSetVisible(loginGUIWindow) -- of course, you replace loginGUIWindow with your own variable. Link to comment
Jaysds1 Posted June 4, 2011 Author Share Posted June 4, 2011 thank, I've been putting the login gui bigger to fit the whole screen. Link to comment
qaisjp Posted June 4, 2011 Share Posted June 4, 2011 Be sure to enable compatibility between different resolutions. Link to comment
BriGhtx3 Posted June 4, 2011 Share Posted June 4, 2011 It is time to learn... https://wiki.multitheftauto.com/wiki/Scr ... troduction Link to comment
Jaysds1 Posted June 4, 2011 Author Share Posted June 4, 2011 Do you have to put addEventHandler ( ....., getRootElement(), ......) after every function? Link to comment
Castillo Posted June 5, 2011 Share Posted June 5, 2011 No, you can call the function with many ways, command handlers, event handlers, from another function, etc, etc. Link to comment
Jaysds1 Posted June 5, 2011 Author Share Posted June 5, 2011 thnx, My light and engine script doesn't work. WHY? addEvent ( "bindKeys",true ) addEventHandler ( "bindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if player == source then bindKey ( "f", "down", engineOffOn ) bindKey( "l", "down", changeLightsState ) end end end ) addEvent ( "unbindKeys",true ) addEventHandler ( "unbindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if player == source then unbindKey ( "f", "down", engineOffOn ) unbindKey( "l", "down", changeLightsState ) end end end ) function engineOffOn() local vehicle = getPedOccupiedVehicle( source ) if leftseat == 1 then setVehicleEngineState ( vehicle, false ) else setVehicleEngineState ( vehicle, true ) end end function changeLightsState() local vehicle = getPedOccupiedVehicle( source ) if leftseat == 1 then setVehicleOverrideLights( vehicle, 2 ) else setVehicleOverrideLights( vehicle, 1 ) end end Link to comment
Moderators Citizen Posted June 5, 2011 Moderators Share Posted June 5, 2011 My light and engine script doesn't work. WHY? Because you have to stop copy the wiki and paste it whithout your brain leftseat is not defined in your code and it's come from the wiki exemple GetVehicleEngineState addEvent ( "bindKeys",true ) addEventHandler ( "bindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if player == source then bindKey ( "f", "down", engineOffOn ) bindKey( "l", "down", changeLightsState ) end end end ) addEvent ( "unbindKeys",true ) addEventHandler ( "unbindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if player == source then unbindKey ( "f", "down", engineOffOn ) unbindKey( "l", "down", changeLightsState ) end end end ) function engineOffOn() local vehicle = getPedOccupiedVehicle( source ) if ( getVehicleEngineState ( theVehicle ) ~= false ) setVehicleEngineState ( vehicle, false ) else setVehicleEngineState ( vehicle, true ) end end function changeLightsState() local vehicle = getPedOccupiedVehicle( source ) if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights( vehicle, 2 ) else setVehicleOverrideLights( vehicle, 1 ) end end Link to comment
qaisjp Posted June 6, 2011 Share Posted June 6, 2011 My light and engine script doesn't work. WHY? Because you have to stop copy the wiki and paste it whithout your brain Atleast he is using the wiki Link to comment
karlis Posted June 6, 2011 Share Posted June 6, 2011 he shouldn't be both on here and wiki, if he doesn't want to use brain... Link to comment
Jaysds1 Posted June 6, 2011 Author Share Posted June 6, 2011 I am using my brain I'm trying to learn scripting easier by using examples from the wiki. if you looked at my Login GUI resource then you could see that I used wiki...... AND THE (f) button DOESN'T WORK WHEN I TRY TO TURN OFF THE ENGINE!!! Link to comment
Castillo Posted June 6, 2011 Share Posted June 6, 2011 Maybe because you aren't using bindKey right? addEvent ( "bindKeys",true ) addEventHandler ( "bindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if p == source then bindKey (p, "f", "down", engineOffOn ) bindKey(p, "l", "down", changeLightsState ) end end end ) addEvent ( "unbindKeys",true ) addEventHandler ( "unbindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if p == source then unbindKey (p, "f", "down", engineOffOn ) unbindKey(p, "l", "down", changeLightsState ) end end end ) function engineOffOn(player) local vehicle = getPedOccupiedVehicle( player ) if ( getVehicleEngineState ( theVehicle ) ~= false ) setVehicleEngineState ( vehicle, false ) else setVehicleEngineState ( vehicle, true ) end end function changeLightsState(player) local vehicle = getPedOccupiedVehicle( player ) if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights( vehicle, 2 ) else setVehicleOverrideLights( vehicle, 1 ) end end Try that. Edit: Why do you check if source is one of these players? because if you want to bind it just for the one who triggered the event just bind it for source. Link to comment
Jaysds1 Posted June 6, 2011 Author Share Posted June 6, 2011 are you sure you don't need to put a "then" after if ( getVehicleEngineState ( theVehicle ) ~= false ) ???AND EVEN WHEN I PUT IT, IT STILL DOESN'T WORK!!! Link to comment
Castillo Posted June 6, 2011 Share Posted June 6, 2011 Your problem here is that you just copy & paste from the wiki, you don't even think what you are doing. addEvent ( "bindKeys",true ) addEventHandler ( "bindKeys", getRootElement(), function() bindKey (source, "f", "down", engineOffOn ) bindKey(source, "l", "down", changeLightsState ) end) addEvent ( "unbindKeys",true ) addEventHandler ( "unbindKeys", getRootElement(), function() unbindKey (source, "f", "down", engineOffOn ) unbindKey(source, "l", "down", changeLightsState ) end) function engineOffOn(player) local vehicle = getPedOccupiedVehicle( player ) if vehicle then if ( getVehicleEngineState ( vehicle ) ~= false ) then setVehicleEngineState ( vehicle, false ) else setVehicleEngineState ( vehicle, true ) end end end function changeLightsState(player) local vehicle = getPedOccupiedVehicle( player ) if vehicle then if ( getVehicleOverrideLights ( vehicle ) ~= 2 ) then setVehicleOverrideLights( vehicle, 2 ) else setVehicleOverrideLights( vehicle, 1 ) end end end Link to comment
Jaysds1 Posted June 6, 2011 Author Share Posted June 6, 2011 I actually got most of it from another resource!!! Link to comment
Castillo Posted June 6, 2011 Share Posted June 6, 2011 Well, that resource was really bugged or you messed everything. Apart from that, is it working? Link to comment
Castillo Posted June 6, 2011 Share Posted June 6, 2011 Well, then you are either lying or not using it as you should, since it works just fine here. How are you triggering "bindKeys" and "unbindKeys"? Link to comment
Jaysds1 Posted June 6, 2011 Author Share Posted June 6, 2011 like I said I got it from another resource!!! Link to comment
Castillo Posted June 6, 2011 Share Posted June 6, 2011 Well, you could have said that at the start, because it will never work if you won't trigger these events. addEventHandler ( "onPlayerJoin", getRootElement(), function() bindKey (source, "f", "down", engineOffOn ) bindKey(source, "l", "down", changeLightsState ) end) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function() for index, player in pairs(getElementsByType("player")) do unbindKey (player, "f", "down", engineOffOn ) unbindKey(player, "l", "down", changeLightsState ) end) function engineOffOn(player) local vehicle = getPedOccupiedVehicle( player ) if vehicle then if ( getVehicleEngineState ( vehicle ) ~= false ) then setVehicleEngineState ( vehicle, false ) else setVehicleEngineState ( vehicle, true ) end end end function changeLightsState(player) local vehicle = getPedOccupiedVehicle( player ) if vehicle then if ( getVehicleOverrideLights ( vehicle ) ~= 2 ) then setVehicleOverrideLights( vehicle, 2 ) else setVehicleOverrideLights( vehicle, 1 ) end end end Link to comment
Jaysds1 Posted June 6, 2011 Author Share Posted June 6, 2011 NOW IT WORKS, THANKS Solidsnake AND THANKS FOR THOSE WHO TRIED TO HELP!!! Link to comment
Castillo Posted June 6, 2011 Share Posted June 6, 2011 No problem, but remember this, if you want to get it fixed, tell them what you have. Link to comment
Jaysds1 Posted June 6, 2011 Author Share Posted June 6, 2011 OK Does anyone know how to create a marker in an interior in Lua File (.lua)? 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