Jump to content

ASiT

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by ASiT

  1. ASiT

    Mountain Bike Problem

    Hey, So im having a problem .... when i enter my server and hop on a mountain bike the screen goes bright white or sometimes bright yellow .. i dont know really know how else to explain it but hears a picture ... any help would be greatly appreciated... http://img219.imageshack.us/my.php?image=mtaprobyi1.png
  2. ASiT

    ChatBox wiki

    do you guys know how to turn off like when i see another player i see their name and health above their head .... do you know how to turn that off as well when i push "i" or is it not possible to turn it off...?
  3. ASiT

    ChatBox wiki

    I found this code on the development wiki when looking for a way to disable the chatbox ...this should do it ...but when i started it it said there was an error at line 11...btw i was making it into a script if that helps... local isChatVisible = true -- let's assume the chat is visible function chat ( key, keyState ) if ( isChatVisible ) then -- if it's on showChat (false) -- turn it off isChatVisible = false else showChat = (true) -- if it's off isChatVisible = true -- turn it on end end bindKey ( "i", "down","toggle chat", chat ) -- the player's "i" key will toggle the chat addEventHandler("onPlayerJoin", getRootElement(), chat)
  4. and where do i put the syntax thing " bool etc etc" ...?
  5. say i was going to add this to the freeroam script where would i put these parts of code ...?
  6. sweet thanks what about the player health bar and name...?
  7. Is it possible to make the chatbox disappear in the server ... its really annoying me i don't want it there for the kind of server im making ....any help...?
  8. ASiT

    Buttons...

    thanks worked perfectly but i have another question does anyone know how to do random events (if they have those in lua)....so i have 3 spawn points and i want the people to randomly spawn at the different spawn points....so when you choose a team everyone doesnt spawn in the exact same place... any help...?
  9. ASiT

    Buttons...

    using the code i posted above it works great with the cursor fix but when someone else joins the server the select screen shows up for all players if they are in game or not .... whats the problem....? im guessing its something like needing to specify that only the player joining should see it but i dont know how to do that....
  10. ASiT

    Buttons...

    k im moved on to spawning the player and have run into another problem ... once the player is spawned the cursor remains onscreen despite the showcursor(false) command the full client script below.... local localPlayer = getLocalPlayer() local localPlayerName = getPlayerName(localPlayer) local localRootElement = getRootElement() local newUser local passwordAttempts = 0 function CreateLoginWindow() wdwLogin = guiCreateWindow(0.375,0.350,0.300,0.250,"Log In v0.1.2",true) guiWindowSetSizable(wdwLogin,false) guiWindowSetMovable(wdwLogin,false) guiCreateLabel(0.080,0.200,0.250,0.250,"Username:",true,wdwLogin) guiCreateLabel(0.080,0.450,0.250,0.250,"Password:",true,wdwLogin) edtUser = guiCreateEdit(0.380,0.190,0.500,0.150,localPlayerName,true,wdwLogin) guiEditSetReadOnly(edtUser,true) edtPass = guiCreateEdit(0.380,0.440,0.500,0.150,"",true,wdwLogin) guiEditSetMaxLength(edtPass,20) guiEditSetMasked(edtPass,true) btnLogin = guiCreateButton(0.630,0.650,0.250,0.150,"Log In",true,wdwLogin) guiSetVisible(wdwLogin,false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() CreateLoginWindow() lblDisplayArea = guiCreateLabel(0.100,0.800,0.800,0.100,"",true) guiLabelSetHorizontalAlign(lblDisplayArea,"center",true) addEventHandler("onClientGUIClick",btnLogin,clientSubmitLogin,false) --Mouseclick on the Login button... addEventHandler("onClientGUIAccepted",edtPass,clientEnterLogin,false) --Hitting 'enter' key in password box... triggerServerEvent ("checkValidAct",localPlayer,localPlayerName) --Check if they have an account to log in to... end ) function clientNewUserHandler() --Called when no account exists for this players name... newUser = true guiSetText(lblDisplayArea,"No account exists for your username. Please create a password.") if(wdwLogin) then guiSetVisible(wdwLogin,true) guiBringToFront(edtPass) --Puts the cursor into the password box for typing... end showCursor(true) guiSetInputEnabled(true) end addEvent("clientNewUser",true) addEventHandler("clientNewUser",localRootElement,clientNewUserHandler) function clientReturningUserHandler() --Called when there is an existing account for this player's name... newUser = false guiSetText(lblDisplayArea,"You are using a registered nickname - please enter your password.") if(wdwLogin) then guiSetVisible(wdwLogin,true) guiBringToFront(edtPass) --Puts the cursor into the password box for typing... end showCursor(true) guiSetInputEnabled(true) end addEvent("clientReturningUser",true) addEventHandler("clientReturningUser",localRootElement,clientReturningUserHandler) function clientEnterLogin() if(newUser) then triggerServerEvent("SubmitCreate",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) else triggerServerEvent("SubmitLogin",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) end end function clientSubmitLogin(button) if(button == "left") then if(newUser) then triggerServerEvent("SubmitCreate",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) triggerClientEvent("SelectCreate", getRootElement()) else triggerServerEvent("SubmitLogin",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) triggerClientEvent("SelectCreate", getRootElement()) end end end function clientDisplayAreaHandler(theMessage) guiSetText(lblDisplayArea,theMessage) end addEvent("clientDisplayArea",true) addEventHandler("clientDisplayArea",localRootElement,clientDisplayAreaHandler) function clientWrongPasswordHandler(theMessage) passwordAttempts = passwordAttempts + 1 if(passwordAttempts > 3) then guiSetText(lblDisplayArea,"Too many incorrect password attempts. Please disconnect.") destroyElement(wdwLogin) triggerServerEvent("removePlayer",localPlayer) end end addEvent("clientWrongPassword",true) addEventHandler("clientWrongPassword",localRootElement,clientWrongPasswordHandler) function clientLoginSuccessHandler() guiSetInputEnabled(false) destroyElement(wdwLogin) destroyElement(lblDisplayArea) wdwLogin = nil newUser = nil lblDisplayArea = nil passwordAttempts = nil localPlayer = nil localPlayerName = nil localRootElement = nil createSelectWindow() addEventHandler("onClientGUIClick",btnCops,clientAssignCops,false) end addEvent("clientLoginSuccess",true) addEventHandler("clientLoginSuccess",localRootElement,clientLoginSuccessHandler) function createSelectWindow() wdwSelect = guiCreateWindow(0.2,0.2,0.7,0.7,"Select a Character Class", true) tbpCharSelect = guiCreateTabPanel(0.0622,0.1086,0.8466,0.7629,true,wdwSelect) tabCops = guiCreateTab("Cops",tbpCharSelect) tabCivs = guiCreateTab("Civilians",tbpCharSelect) tabArmy = guiCreateTab("Army",tbpCharSelect) btnArmy = guiCreateButton(0.0165,0.8264,0.967,0.1504,"Join Team Army!",true,tabArmy) btnCivs = guiCreateButton(0.0165,0.8264,0.967,0.1504,"Join Team Civilians!",true,tabCivs) btnCops = guiCreateButton(0.0165,0.8264,0.967,0.1504,"Join Team Cops!",true,tabCops) memCops = guiCreateMemo(0.1293,0.1504,0.7503,0.6594,"Police Sample Text....",true,tabCops) memCivs = guiCreateMemo(0.1293,0.1504,0.7503,0.6594,"Civilian Sample Text...",true,tabCivs) memArmy = guiCreateMemo(0.1293,0.1504,0.7503,0.6594,"Army Sample Text...",true,tabArmy) lblCops = guiCreateLabel(0.294,0.0017,0.4144,0.1722,"Team Cops",true,tabCops) guiSetFont(lblCops,"sa-gothic") lblCivs = guiCreateLabel(0.35,0.0017,0.4144,0.1722,"Civilians",true,tabCivs) guiSetFont(lblCivs,"sa-gothic") lblArmy = guiCreateLabel(0.294,0.0017,0.4144,0.1722,"Team Army",true,tabArmy) guiSetFont(lblArmy,"sa-gothic") end function clientAssignCops(button) if (button == "left") then triggerServerEvent("assignCopTeam",getRootElement()) guiSetVisible(wdwSelect, false) guiSetInputEnabled(false) showcursor(false) end end and the server script below local welcomeMessageNewUser = "Welcome to our server!" local welcomeMessageReturningUser = "Welcome back to the server!" function createTeamsOnStart () teamCivilians = createTeam ( "Civilians", 194, 194, 194 ) teamCops = createTeam ( "LSPD", 101, 101, 215 ) teamArmy = createTeam ( "Army", 26, 51, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) function clientAttemptLogin(username,password) local userAccount = getAccount(username) local tryToLog if (client) then tryToLog = logIn(client,userAccount,password) if (tryToLog) then outputChatBox(welcomeMessageReturningUser,client) triggerClientEvent(source,"clientLoginSuccess",getRootElement()) else triggerClientEvent(source,"clientDisplayArea",getRootElement(),"Incorrect password, please try again.") triggerClientEvent(source,"clientWrongPassword",getRootElement()) end end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",getRootElement(),clientAttemptLogin) function clientAttemptCreate(username,password) if (password ~= nil and password ~= "") then addAccount(username,password) local userAccount = getAccount(username) local tryToLog if (client and userAccount ~= false and userAccount ~= nil) then tryToLog = logIn(client,userAccount,password) if (tryToLog) then outputChatBox(welcomeMessageNewUser,client) triggerClientEvent(source,"clientLoginSuccess",getRootElement()) else triggerClientEvent(source,"clientDisplayArea",getRootElement(),"Unable to log in to new account, try again.") end else triggerClientEvent(source,"clientDisplayArea",getRootElement(),"Unable to create new account, try again.") end else triggerClientEvent(source,"clientDisplayArea",getRootElement(),"Please create a password for your new account.") end end addEvent("SubmitCreate",true) addEventHandler("SubmitCreate",getRootElement(),clientAttemptCreate) function checkValidActHandler(thePlayer) local theAccount = getAccount(thePlayer) if (theAccount) then triggerClientEvent(source,"clientReturningUser",getRootElement()) else triggerClientEvent(source,"clientNewUser",getRootElement()) end end addEvent("checkValidAct",true) addEventHandler("checkValidAct",getRootElement(),checkValidActHandler) function removePlayerHandler() kickPlayer(source) end addEvent("removePlayer",true) addEventHandler("removePlayer",getRootElement(),removePlayerHandler) function assignCopTeam () local spawnX = 1552.4109 local spawnY = -1675.0485 local spawnZ = 16.1953 spawnPlayer(client,spawnX,spawnY,spawnZ) fadeCamera(client,true) setPlayerTeam (client, teamCops) giveWeapon (client, 31, 10000 ) giveWeapon (client, 24, 10000 ) giveWeapon (client, 25, 10000 ) giveWeapon (client, 29, 10000 ) giveWeapon (client, 17, 10000 ) giveWeapon (client, 42, 10000 ) setPlayerArmor (client, 0 ) setPlayerSkin (client, 280 ) setPlayerNametagColor (client, 101, 101, 215 ) end addEvent("assignCopTeam",true) addEventHandler("assignCopTeam",getRootElement(), assignCopTeam) function afterWasted() respawnPlayer(source, getPlayerTeam(source)) end function respawnPlayer(source, theTeam) local spawnX = 1552.4109 local spawnY = -1675.0485 local spawnZ = 16.1953 spawnPlayer(client,spawnX,spawnY,spawnZ) fadeCamera(client,true) setPlayerTeam (client, teamCops) giveWeapon (client, 31, 10000 ) giveWeapon (client, 24, 10000 ) giveWeapon (client, 25, 10000 ) giveWeapon (client, 29, 10000 ) giveWeapon (client, 17, 10000 ) giveWeapon (client, 42, 10000 ) setPlayerArmor (client, 0 ) setPlayerSkin (client, 280 ) setPlayerNametagColor (client, 101, 101, 215 ) end addEventHandler( "onPlayerWasted", getRootElement(), afterWasted ) and help....would be greatly appreciated (again )....
  11. ASiT

    Buttons...

    ooo thats makes sense all try that out thanks...
  12. ASiT

    Buttons...

    I have another problem (so many ) so this is what i want my gui to look like (made using gui editor)... http://img186.imageshack.us/my.php?image=mtascreen0003nm7.png so i made some changes because the code given didnt work until the code looked like this local localPlayer = getLocalPlayer() local localPlayerName = getPlayerName(localPlayer) local localRootElement = getRootElement() local newUser local passwordAttempts = 0 function CreateLoginWindow() wdwLogin = guiCreateWindow(0.375,0.350,0.300,0.250,"Log In v0.1.2",true) guiWindowSetSizable(wdwLogin,false) guiWindowSetMovable(wdwLogin,false) guiCreateLabel(0.080,0.200,0.250,0.250,"Username:",true,wdwLogin) guiCreateLabel(0.080,0.450,0.250,0.250,"Password:",true,wdwLogin) edtUser = guiCreateEdit(0.380,0.190,0.500,0.150,localPlayerName,true,wdwLogin) guiEditSetReadOnly(edtUser,true) edtPass = guiCreateEdit(0.380,0.440,0.500,0.150,"",true,wdwLogin) guiEditSetMaxLength(edtPass,20) guiEditSetMasked(edtPass,true) btnLogin = guiCreateButton(0.630,0.650,0.250,0.150,"Log In",true,wdwLogin) guiSetVisible(wdwLogin,false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() CreateLoginWindow() lblDisplayArea = guiCreateLabel(0.100,0.800,0.800,0.100,"",true) guiLabelSetHorizontalAlign(lblDisplayArea,"center",true) addEventHandler("onClientGUIClick",btnLogin,clientSubmitLogin,false) --Mouseclick on the Login button... addEventHandler("onClientGUIAccepted",edtPass,clientEnterLogin,false) --Hitting 'enter' key in password box... triggerServerEvent ("checkValidAct",localPlayer,localPlayerName) --Check if they have an account to log in to... end ) function clientNewUserHandler() --Called when no account exists for this players name... newUser = true guiSetText(lblDisplayArea,"No account exists for your username. Please create a password.") if(wdwLogin) then guiSetVisible(wdwLogin,true) guiBringToFront(edtPass) --Puts the cursor into the password box for typing... end showCursor(true) guiSetInputEnabled(true) end addEvent("clientNewUser",true) addEventHandler("clientNewUser",localRootElement,clientNewUserHandler) function clientReturningUserHandler() --Called when there is an existing account for this player's name... newUser = false guiSetText(lblDisplayArea,"You are using a registered nickname - please enter your password.") if(wdwLogin) then guiSetVisible(wdwLogin,true) guiBringToFront(edtPass) --Puts the cursor into the password box for typing... end showCursor(true) guiSetInputEnabled(true) end addEvent("clientReturningUser",true) addEventHandler("clientReturningUser",localRootElement,clientReturningUserHandler) function clientEnterLogin() if(newUser) then triggerServerEvent("SubmitCreate",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) else triggerServerEvent("SubmitLogin",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) end end function clientSubmitLogin(button) if(button == "left") then if(newUser) then triggerServerEvent("SubmitCreate",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) triggerClientEvent("SelectCreate", getRootElement()) else triggerServerEvent("SubmitLogin",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) triggerClientEvent("SelectCreate", getRootElement()) end end end function clientDisplayAreaHandler(theMessage) guiSetText(lblDisplayArea,theMessage) end addEvent("clientDisplayArea",true) addEventHandler("clientDisplayArea",localRootElement,clientDisplayAreaHandler) function clientWrongPasswordHandler(theMessage) passwordAttempts = passwordAttempts + 1 if(passwordAttempts > 3) then guiSetText(lblDisplayArea,"Too many incorrect password attempts. Please disconnect.") destroyElement(wdwLogin) triggerServerEvent("removePlayer",localPlayer) end end addEvent("clientWrongPassword",true) addEventHandler("clientWrongPassword",localRootElement,clientWrongPasswordHandler) function clientLoginSuccessHandler() guiSetInputEnabled(false) destroyElement(wdwLogin) destroyElement(lblDisplayArea) wdwLogin = nil newUser = nil lblDisplayArea = nil passwordAttempts = nil localPlayer = nil localPlayerName = nil localRootElement = nil createSelectWindow() end addEvent("clientLoginSuccess",true) addEventHandler("clientLoginSuccess",localRootElement,clientLoginSuccessHandler) function createSelectWindow() wdwSelect = guiCreateWindow(0,0,0.5,0.4,"Select a Character Class", true) tbpCharSelect = guiCreateTabPanel(0.0622,0.1086,0.8466,0.7629,true,wdwSelect) tabCops = guiCreateTab("Cops",tbpCharSelect) tabCivs = guiCreateTab("Civilians",tpbCharSelect) tabArmy = guiCreateTab("Army",tpbCharSelect) btnArmy = guiCreateButton(0.0165,0.8264,0.967,0.1504,"Join Team Army!",true,tabArmy) btnCivs = guiCreateButton(0.0165,0.8264,0.967,0.1504,"Join Team Civilians!",true,tabCivs) btnCops = guiCreateButton(0.0165,0.8264,0.967,0.1504,"Join Team Cops!",true,tabCops) memCops = guiCreateMemo(0.1293,0.1504,0.7503,0.6594,"Police Sample Text....",true,tabCops) memCivs = guiCreateMemo(0.1293,0.1504,0.7503,0.6594,"Civilian Sample Text...",true,tabCivs) memArmy = guiCreateMemo(0.1293,0.1504,0.7503,0.6594,"Army Sample Text...",true,tabArmy) lblCops = guiCreateLabel(0.294,0.0017,0.4144,0.1722,"Team Cops",true,tabCops) guiSetFont(lblCops,"sa-gothic") lblCivs = guiCreateLabel(0.294,0.0017,0.4144,0.1722,"Team Civilians",true,tabCivs) guiSetFont(lblCivs,"sa-gothic") lblArmy = guiCreateLabel(0.294,0.0017,0.4144,0.1722,"Team Army",true,tabArmy) guiSetFont(lblArmy,"sa-gothic") end but now when i run the script it comes out like this http://img262.imageshack.us/my.php?image=mtascreen0007ey4.png any help...?
  13. ASiT

    Buttons...

    ok sweet thanks works great ...
  14. ASiT

    Buttons...

    so with what ur saying to add createSelectWindow() in the login success the last 2 paragraph i guess you could call them should look like this...? function clientLoginSuccessHandler() guiSetInputEnabled(false) destroyElement(wdwLogin) destroyElement(lblDisplayArea) wdwLogin = nil newUser = nil lblDisplayArea = nil passwordAttempts = nil localPlayer = nil localPlayerName = nil localRootElement = nil showCursor(false) createSelectWindow() end addEvent("clientLoginSuccess",true) addEventHandler("clientLoginSuccess",localRootElement,clientLoginSuccessHandler) function createSelectWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwSelect = guiCreateWindow(X, Y, Width, Height, "Please Select a Class", true) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 btnCops = guiCreateButton(X, Y, Width, Height, "Cops", true, wdwSelect) Y = 0.5 btnRobs = guiCreateEdit(X, Y, Width, Height, "Robbers", true, wdwSelect) guiSetVisible(wdwSelect, false) end or do i leave the addEvent("SelectCreate", true) addEventHandler("SelectCreate", getRootElement(), createSelectWindow) in the code
  15. ASiT

    Buttons...

    heres what i have ... i took ur advice and added a triggerClientevent... tell me if this is how im supposed to do it...because this didnt work either local localPlayer = getLocalPlayer() local localPlayerName = getPlayerName(localPlayer) local localRootElement = getRootElement() local newUser local passwordAttempts = 0 function CreateLoginWindow() wdwLogin = guiCreateWindow(0.375,0.350,0.300,0.250,"Log In v0.1.2",true) guiWindowSetSizable(wdwLogin,false) guiWindowSetMovable(wdwLogin,false) guiCreateLabel(0.080,0.200,0.250,0.250,"Username:",true,wdwLogin) guiCreateLabel(0.080,0.450,0.250,0.250,"Password:",true,wdwLogin) edtUser = guiCreateEdit(0.380,0.190,0.500,0.150,localPlayerName,true,wdwLogin) guiEditSetReadOnly(edtUser,true) edtPass = guiCreateEdit(0.380,0.440,0.500,0.150,"",true,wdwLogin) guiEditSetMaxLength(edtPass,20) guiEditSetMasked(edtPass,true) btnLogin = guiCreateButton(0.630,0.650,0.250,0.150,"Log In",true,wdwLogin) guiSetVisible(wdwLogin,false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() CreateLoginWindow() lblDisplayArea = guiCreateLabel(0.100,0.800,0.800,0.100,"",true) guiLabelSetHorizontalAlign(lblDisplayArea,"center",true) addEventHandler("onClientGUIClick",btnLogin,clientSubmitLogin,false) --Mouseclick on the Login button... addEventHandler("onClientGUIAccepted",edtPass,clientEnterLogin,false) --Hitting 'enter' key in password box... triggerServerEvent ("checkValidAct",localPlayer,localPlayerName) --Check if they have an account to log in to... end ) function clientNewUserHandler() --Called when no account exists for this players name... newUser = true guiSetText(lblDisplayArea,"No account exists for your username. Please create a password.") if(wdwLogin) then guiSetVisible(wdwLogin,true) guiBringToFront(edtPass) --Puts the cursor into the password box for typing... end showCursor(true) guiSetInputEnabled(true) end addEvent("clientNewUser",true) addEventHandler("clientNewUser",localRootElement,clientNewUserHandler) function clientReturningUserHandler() --Called when there is an existing account for this player's name... newUser = false guiSetText(lblDisplayArea,"You are using a registered nickname - please enter your password.") if(wdwLogin) then guiSetVisible(wdwLogin,true) guiBringToFront(edtPass) --Puts the cursor into the password box for typing... end showCursor(true) guiSetInputEnabled(true) end addEvent("clientReturningUser",true) addEventHandler("clientReturningUser",localRootElement,clientReturningUserHandler) function clientEnterLogin() if(newUser) then triggerServerEvent("SubmitCreate",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) else triggerServerEvent("SubmitLogin",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) end end function clientSubmitLogin(button) if(button == "left") then if(newUser) then triggerServerEvent("SubmitCreate",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) triggerClientEvent("SelectCreate", getRootElement()) else triggerServerEvent("SubmitLogin",localRootElement,guiGetText(edtUser),guiGetText(edtPass)) triggerClientEvent("SelectCreate", getRootElement()) end end end function clientDisplayAreaHandler(theMessage) guiSetText(lblDisplayArea,theMessage) end addEvent("clientDisplayArea",true) addEventHandler("clientDisplayArea",localRootElement,clientDisplayAreaHandler) function clientWrongPasswordHandler(theMessage) passwordAttempts = passwordAttempts + 1 if(passwordAttempts > 3) then guiSetText(lblDisplayArea,"Too many incorrect password attempts. Please disconnect.") destroyElement(wdwLogin) triggerServerEvent("removePlayer",localPlayer) end end addEvent("clientWrongPassword",true) addEventHandler("clientWrongPassword",localRootElement,clientWrongPasswordHandler) function clientLoginSuccessHandler() guiSetInputEnabled(false) destroyElement(wdwLogin) destroyElement(lblDisplayArea) wdwLogin = nil newUser = nil lblDisplayArea = nil passwordAttempts = nil localPlayer = nil localPlayerName = nil localRootElement = nil showCursor(false) end addEvent("clientLoginSuccess",true) addEventHandler("clientLoginSuccess",localRootElement,clientLoginSuccessHandler) function createSelectWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwSelect = guiCreateWindow(X, Y, Width, Height, "Please Select a Class", true) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 btnCops = guiCreateButton(X, Y, Width, Height, "Cops", true, wdwSelect) Y = 0.5 btnRobs = guiCreateEdit(X, Y, Width, Height, "Robbers", true, wdwSelect) guiSetVisible(wdwSelect, false) end addEvent("SelectCreate", true) addEventHandler("SelectCreate", getRootElement(), createSelectWindow)
  16. ASiT

    Buttons...

    sorry about the double post ...( thought the first one was about something else that got answered didnt know i had included the same thing) but ya another question i have my first login in window once thats dissappears and logs u in i want another window to come up but so far everything ive tried hasnt worked and results in niether of the windows showing up ....the screen just stays black (and i know its not fadecamera() but do i just put another function CreateSelectWindow() at the bottom ...? and will that make it appear after the login...? or do i have to put something like addeventhandler("onClientGUIClick",btnLogin,CreateLoginWindow) in...? ( <--- i think thats what its supposed to say... any help...
  17. ASiT

    Buttons...

    hey i successfully have a login screen for my script but now i want to create a window that spawns after you log in. On this window i want to have 2 buttons that if you press one it spawns you one place and if you press the other it spawn u somewhere else ... does anyone know the code id use for this...? And since im so new do i put the code for this second code in the same .lua as the login screen ....any help would be greatly appreciated.... everything i try just doesnt work...
  18. ASiT

    Beginner scripter

    but for the fadecamera thing the gui doesnt even show up when i start the server and fadecamera isnt that used when you spawn and stuff im saying the gui doesnt even come up ...
  19. hey guys, i just started to try and get into scripting the gui and stuff for MTA and i ran into a problem ( mind you im a beginner and dont be too harsh if my script makes no sense at all) Its supposed to spawn a window that says login and once you type everything in and push the button another window comes up and has 2 buttons saying cops or robbers and so far i only have cops ... so if you push the button it spawns you and gives you weapons but it comes up to black screen... function CreateLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) guiSetVisible(wdwLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function CreateSelectWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwSelect = guiCreateWindow(X, Y, Width, Height, "Please Select A Character Class", true) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.25 btnCops = guiCreateButton(X, Y, Width, Height, "Cops", true, wdwSelect) Y = 0.5 btnRobs = guiCreateButton(X, Y, Width, Height, "Robbers", true, wdwSelect) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwSelect) guiSetVisible(wdwSelect, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function createTeamsOnStart () teamCivilians = createTeam ( "Civilians", 194, 194, 194 ) teamCops = createTeam ( "LSPD", 101, 101, 215 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) function () CreateLoginWindow() addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) outputChatBox("Welcome to My MTA DM Server, please log in. ") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) end showCursor(true) guiSetInputEnabled(true) end ) function clientSubmitLogin(button) if button == "left" then triggerServerEvent("SubmitLogin", getRootElement(), guiGetText(edtUser), guiGetText(edtPass)) guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(true) CreateSelectWindow() addEventHandler("onClientGUIClick", btnCops, assignCops, false) outputChatBox("Thankyou for selecting a class,Have fun!... ") if (wdwSelect ~= nil) then guiSetVisible(wdwSelect, true) end end end function joinHandler(username, password) outputChatBox("Welcome to My Server", client) end end addEvent("SubmitLogin", true) addEventHandler("SubmitLogin", getRootElement(), joinHandler) function assigncops() spawnPlayer ( player, 1552.4109, -1675.0485, 16.1953 ) giveWeapon ( player, 31, 10000 ) giveWeapon ( player, 24, 10000 ) giveWeapon ( player, 25, 10000 ) giveWeapon ( player, 29, 10000 ) giveWeapon ( player, 17, 10000 ) giveWeapon ( player, 42, 10000 ) setPlayerArmor ( player, 0 ) setPlayerSkin ( player, 280 ) setPlayerNametagColor ( player, 101, 101, 215 ) end
×
×
  • Create New...