Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. Why you are doing addCommandHandler inside onPlayerJoin. here try this: (not sure it will make a diffrence at all) local skinsForEMI = {183,158,159,160,162,132,136} addEvent("buttonClicked",true) gamemodeStarted = false playersForIMI = {} playersForPOL = {} function setcolor(playerSource) outputChatBox("cona") setPlayerNametagColor(playerSource, 255, 10, 40) end addCommandHandler("nametagcolor", setcolor) function joinHandler(equipa) if (gamemodeStarted == false) then if(equipa == 'imigrante') then table.insert(playersForIMI, source) --setPlayerNametagColor(source, tonumber(205), tonumber(133), tonumber(63)) elseif(equipa == 'police') then table.insert(playersForPOL, source) --setPlayerNametagColor(source, 30, 144, 255) else local numberOfTeam = math.random(2) if numberOfTeam == 1 then table.insert(playersForIMI, source) else table.insert(playersForPOL, source) end end end end addEventHandler("buttonClicked", root, joinHandler) function playerJoin () local name = getPlayerName(source) for i, v in ipairs(getElementsByType("player")) do if (v ~= source) then outputChatBox("[" .. name .. "] has joined the server", v, 255, 64, 64) end end end addEventHandler ( "onPlayerJoin", getRootElement(), playerJoin ) function destroyBlipsWhenPlayerLeavesServer ( quitType) local name = getPlayerName(source) outputChatBox("[" .. name .. "] has left the server [" .. quitType .."]", getRootElement(), 255, 64, 64) if source then local attacheds = getAttachedElements ( source ) if ( attacheds ) then for k,element in ipairs(attacheds) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end end addEventHandler ( "onPlayerQuit", getRootElement(), destroyBlipsWhenPlayerLeavesServer ) function colocarDeNoite () setTime ( 1, 0) --setWeather ( 22 ) end addEventHandler ( "onResourceStart", getRootElement(), colocarDeNoite) segundos = 30 timerEnabled = false gamemodeStarted = false local mostrou = false addEvent("checkTwoPlayersOnMode", true) function checkTwoAndNotStartedRunIT () if gamemodeStarted == false then if timerEnabled == false then if(getPlayerCount() >= 1) then setTimer(escreve, 200, 1) triggerClientEvent("canShowGUISPAWN",getRootElement()) mostrou = true else outputChatBox("NOTE: This gamemode need at least 2 players online to start!", source) end else setElementData(source,"secondsRemaining",tostring(segundos)) triggerClientEvent ( source, "showDX", source ) triggerClientEvent(source,"canShowGUISPAWN",source) end else outputChatBox("You will need to wait the gamemode to finish, sorry", source) end end addEventHandler("checkTwoPlayersOnMode", getRootElement(), checkTwoAndNotStartedRunIT) function escreve () timerEnabled = true for i,v in pairs(getElementsByType("player")) do setElementData(v,"secondsRemaining",tostring(segundos)) triggerClientEvent ( v, "showDX", v ) if(mostrou ~= true) then triggerClientEvent(v,"canShowGUISPAWN",v) end end setTimer(countDown,1000,30) end function countDown() segundos = segundos -1 for i,v in pairs(getElementsByType("player")) do setElementData(v,"secondsRemaining",tostring(segundos)) end if segundos == 3 then triggerClientEvent("hadChosenTeam", getRootElement()) end if segundos == 0 then triggerClientEvent ( "hideDX", getRootElement() ) triggerClientEvent("hideSpawnGUI", getRootElement()) timerEnabled = false gamemodeStarted = true if(#playersForIMI==#playersForPOL or #playersForIMI == #playersForPOL + 1 or #playersForPOL == #playersForIMI + 1) then spawn() else outputChatBox("---Gamemode will run auto-balance---", getRootElement(), 255, 64, 64) autobalance() end end end function onStart () timerEnabled = false if(getPlayerCount() >= 2) then removeEventHandler ("checkTwoPlayersOnMode", getRootElement(), checkTwoAndNotStartedRunIT ) setTimer(escreve, 1500, 1) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStart ) function autobalance() if(#playersForIMI - #playersForPOL >= 2) then local sync = false local dif = #playersForIMI - #playersForPOL if(dif % 2 == 0) then while(sync ~= true) do if(#playersForIMI ~= #playersForPOL) then table.insert(playersForPOL, playersForIMI[#playersForIMI]) table.remove(playersForIMI, #playersForIMI) setPlayerTeam ( playersForPOL[#playersForPOL], team_policeSP ) outputChatBox(">>Auto-balance system changed your team!", playersForPOL[#playersForPOL], 255, 64, 64) else sync = true end end spawn() else while(sync ~= true) do if(#playersForIMI ~= #playersForPOL + 1) then table.insert(playersForPOL, playersForIMI[#playersForIMI]) table.remove(playersForIMI, #playersForIMI) setPlayerTeam ( playersForPOL[#playersForPOL], team_policeSP ) outputChatBox(">>Auto-balance system changed your team!", playersForPOL[#playersForPOL], 255, 64, 64) else sync = true end end spawn() end elseif(#playersForPOL - #playersForIMI >= 2) then local sync = false local dif = #playersForPOL - #playersForIMI if(dif % 2 == 0) then while(sync ~= true) do if(#playersForPOL ~= #playersForIMI) then table.insert(playersForIMI, playersForPOL[#playersForPOL]) table.remove(playersForPOL, #playersForPOL) setPlayerTeam ( playersForIMI[#playersForIMI], team_immigrantsSP ) outputChatBox(">>Auto-balance system changed your team!", playersForIMI[#playersForIMI], 255, 64, 64) else sync = true end end spawn() else while(sync ~= true) do if(#playersForPOL ~= #playersForIMI + 1) then table.insert(playersForIMI, playersForPOL[#playersForPOL]) table.remove(playersForPOL, #playersForPOL)
  2. Lol, you took the same and just added 0. Do what i told you load it with guieditor and then make it relative, copy the code, this should work.
  3. Then, next time, try before asking.
  4. Use 0.5 to center it. Or load the gui using guieditor, and print it in relative.
  5. If i remember correctly, the basemode resource is compiled right? Anyway, you can remove the command /gun. By making a new lua file in the basemode resource, put it in the meta, and add this line to the script file: removeCommandHandler("gun") If the wiki is right then: removeCommandHandler: This function removes a command handler, that is one that has been added using addCommandHandler. This function can only remove command handlers that were added by the resource that it is called in.
  6. Just the script file, that contains the command.
  7. Well, in that case, i'm positive that the problem is in the resource not the function. Post all the script then.
  8. JR10

    GUI Welcome Screen

    Do it on all windows: here is an explanation: local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 1279, 1023 local x = screenWidth/2 - windowWidth/2 local y = screenHeight/2 - windowHeight/2 guiFgWelcomeWindow = guiCreateWindow(x,y,windowWidth,windowHeight," R U L E S ! ",false) Now do the same with changing the window Width and height to the window's width and height.
  9. JR10

    GUI Welcome Screen

    I mean, you are creating 3 windows, and the one that appears to you might not be the one your fitting on all resolutions.
  10. JR10

    GUI Welcome Screen

    Are you sure, because you have 3 windows might be another one because this way works for me, and i can't find any problem.
  11. JR10

    GUI Welcome Screen

    Show me the client script maybe you did something wrong.
  12. It's an easy thing to search for the gate in the map editor.
  13. JR10

    GUI Welcome Screen

    What happens exactly, because yes i use this in all my gui's and it works.
  14. It should shows a bad argument @ outputChatBox and yes, it sends it to all players.
  15. JR10

    GUI Welcome Screen

    With some mathes you can fit the gui in the middle for all resolutions here : This is your window creation: guiFgWelcomeWindow = guiCreateWindow(77,262,1279,1023," R U L E S ! ",false) This is how to fit it in the middle for all resolutions: local screenWidth, screenHeight = guiGetScreenSize() local x, y = screenWidth/2 - 1279/2, screenHeight/2 - 1023/2 guiFgWelcomeWindow = guiCreateWindow(x,y,1279,1023," R U L E S ! ",false)
  16. function passwordChange(playerSource) if isGuestAccount(getPlayerAccount(playerSource)) then outputChatBox("Be kell jelentkezned hogy hasznalhasd ezt a parancsot", source) else triggerClientEvent(source, "onPassChangeStart", getRootElement()) end end addCommandHandler("jelszocsere", passwordChange) Source is not defined. Try this: function passwordChange(playerSource) if isGuestAccount(getPlayerAccount(playerSource)) then outputChatBox("Be kell jelentkezned hogy hasznalhasd ezt a parancsot", playerSource) else triggerClientEvent(playerSource, "onPassChangeStart", getRootElement()) end end
  17. JR10

    BANNER SCRIPT

    How i know?, well, it's just by the looking at it, both got client functions. and to output a message each 2 min do this: setTimer(outputChatBox, 120000, 0, "Visit Us At : [url=http://www.blabla.com]http://www.blabla.com[/url]")
  18. JR10

    BANNER SCRIPT

    You 've got to be kidding me, both are client sided scripts.
  19. Maybe try this: addEvent("colocarNrJogadores",true) function colocarJogadoresNoGUI(team_immigrantsSP, team_policeSP) setTimer(function() colocarNrAliveNoGUI(team_immigrantsSP,team_policeSP) end, 1000,0) end addEventHandler("colocarNrJogadores", getRootElement(), colocarJogadoresNoGUI) function colocarNrAliveNoGUI(team1, team2) local qtd = #getAlivePlayersInTeam(team1) or 0 guiSetText ( nrAliveEMI, tostring(qtd) ) local qtd2 = #getAlivePlayersInTeam(team2) or 0 guiSetText ( nrAlivePOL, tostring(qtd2) ) end function getAlivePlayersInTeam(theTeam) local theTable = { } local players = getPlayersInTeam(theTeam) for i,v in pairs(players) do if not isPlayerDead(v) then table.insert(theTable, v) end end return theTable end
  20. You are wrong, it's not what's visible and what's not, buttonExit will be this buttonExit = guiCreateButton(0.7005,0.6488,0.2005,0.2,"Kilepes",true,windowPassChange) Yes, right inside the block after the creation.
  21. try this: local windowLogin local editLoginUser local editLoginPass local loginToRegist local buttonLoginSubmit local windowRegist local editRegistUser local editRegistPass local registToLogin local buttonRegistSubmit local windowPassChange local editPassChangeNew local editPassChangeRe local buttonPassChangeSubmit local buttonExit addEventHandler("onClientResourceStart", resourceRoot, function () createLoginWindow() createRegistWindow() createPassChangeWindow() showLoginWindow() end ) addEvent("onLoginStart", true) addEventHandler("onLoginStart", getRootElement(), showLoginWindow) addEvent("onRegistStart", true) addEventHandler("onRegistStart", getRootElement(), showRegistWindow) addEvent("onPassChangeStart", true) addEventHandler("onPassChangeStart", getRootElement(), showPassChangeWindow) function showLoginWindow() if not windowLogin then outputChatBox("A bejelentkezo rendszer nem mukodik rendesen, kerlek jelentsd a weboldalon") outputChatBox("www."..webSite..".hu") end guiSetVisible(windowLogin, true) showCursor(true) guiSetInputEnabled(true) end function showRegistWindow() if not windowRegist then outputChatBox("A bejelentkezo rendszer nem mukodik rendesen, kerlek jelentsd a weboldalon") outputChatBox("www."..webSite..".hu") end guiSetVisible(windowRegist, true) showCursor(true) guiSetInputEnabled(true) end function showPassChangeWindow() if not windowPassChange then outputChatBox("Ez a funkcio jelenleg inaktiv, hamarosan vissza lesz allitva") end guiSetVisible(windowRegist, true) showCursor(true) guiSetInputEnabled(true) end function createLoginWindow() local GUIEditor_Label = {} windowLogin = guiCreateWindow(0.3484,0.3242,0.3,0.2,"Bejelentkezes",true) guiWindowSetSizable(windowLogin,false) GUIEditor_Label[1] = guiCreateLabel(0.1,0.2,0.4453,0.1268,"Felhasznalonev:",true,windowLogin) guiLabelSetColor(GUIEditor_Label[1],255, 255, 255) GUIEditor_Label[2] = guiCreateLabel(0.1,0.4,0.3281,0.0927,"Jelszo:",true,windowLogin) guiLabelSetColor(GUIEditor_Label[2],255, 255, 255) editLoginUser = guiCreateEdit(0.401,0.2,0.5,0.1024,"",true,windowLogin) guiEditSetMaxLength(editLoginUser,64) editLoginPass = guiCreateEdit(0.401,0.4,0.5,0.1024,"",true,windowLogin) guiEditSetMaxLength(editLoginPass,64) buttonLoginSubmit = guiCreateButton(0.099,0.6488,0.2005,0.2,"Elfogad",true,windowLogin) buttonLoginToRegist = guiCreateButton(0.349,0.6488,0.2995,0.2,"Regisztracio",true,windowLogin) buttonExit = guiCreateButton(0.7005,0.6488,0.2005,0.2,"Kilepes",true,windowLogin) addEventHandler("onClientGUIClick", buttonLoginToRegist, changeLoginToRegist, false) addEventHandler("onClientGUIClick", buttonPassChangeSubmit, submitPassChange, false) addEventHandler("onClientGUIClick", buttonExit, exitAuth, false) guiSetVisible(windowLogin, false) end function createRegistWindow() local GUIEditor_Label = {} windowRegist = guiCreateWindow(0.3484,0.3242,0.3,0.2,"Regisztracio",true) guiWindowSetSizable(windowRegist,false) GUIEditor_Label[1] = guiCreateLabel(0.1,0.2,0.4453,0.1268,"Felhasznalonev:",true,windowRegist) guiLabelSetColor(GUIEditor_Label[1],255, 255, 255) GUIEditor_Label[2] = guiCreateLabel(0.1,0.4,0.3281,0.0927,"Jelszo:",true,windowRegist) guiLabelSetColor(GUIEditor_Label[2],255, 255, 255) editRegistUser = guiCreateEdit(0.401,0.2,0.5,0.1024,"",true,windowRegist) guiEditSetMaxLength(editRegistUser,64) editRegistPass = guiCreateEdit(0.401,0.4,0.5,0.1024,"",true,windowRegist) guiEditSetMaxLength(editRegistPass,64) buttonRegistSubmit = guiCreateButton(0.099,0.6488,0.2005,0.2,"Elfogad",true,windowRegist) buttonRegistToLogin = guiCreateButton(0.349,0.6488,0.2995,0.2,"Bejelentkezes",true,windowRegist) buttonExit = guiCreateButton(0.7005,0.6488,0.2005,0.2,"Kilepes",true,windowRegist) addEventHandler("onClientGUIClick", buttonRegistToLogin, changeRegistToLogin, false) addEventHandler("onClientGUIClick", buttonLoginSubmit, submitLogin, false) addEventHandler("onClientGUIClick", buttonRegistSubmit, submitRegist, false) guiSetVisible(windowRegist, false) end function createPassChangeWindow() local GUIEditor_Label = {} windowPassChange = guiCreateWindow(0.3484,0.3242,0.3,0.2,"Jelszocsere",true) guiWindowSetSizable(windowPassChange,false) GUIEditor_Label[1] = guiCreateLabel(0.1,0.2,0.4453,0.1268,"Uj jelszo:",true,windowPassChange) guiLabelSetColor(GUIEditor_Label[1],255, 255, 255) GUIEditor_Label[2] = guiCreateLabel(0.1,0.4,0.3281,0.0927,"Megerosites:",true,windowPassChange) guiLabelSetColor(GUIEditor_Label[2],255, 255, 255) editPassChangeNew = guiCreateEdit(0.401,0.2,0.5,0.1024,"",true,windowPassChange) guiEditSetMaxLength(editPassChangeNew,64) editPassChangeRe = guiCreateEdit(0.401,0.4,0.5,0.1024,"",true,windowPassChange) guiEditSetMaxLength(editPassChangeRe,64) buttonPassChangeSubmit = guiCreateButton(0.099,0.6488,0.2005,0.2,"Csere",true,windowPassChange) buttonExit = guiCreateButton(0.7005,0.6488,0.2005,0.2,"Kilepes",true,windowPassChange) guiSetVisible(windowPassChange, false) end function changeLoginToRegist(button, state) if button == "left" and state == "up" then guiSetVisible(windowLogin, false) showRegistWindow() end end function changeRegistToLogin(button, state) if button == "left" and state == "up" then guiSetVisible(windowRegist, false) showLoginWindow() end end function exitAuth(button, state) if button == "left" and state == "up" then if windowLogin then guiSetVisible(windowLogin, false) end if windowRegist then guiSetVisible(windowRegist, false) end if windowPassChange then guiSetVisible(windowPassChange, false) end showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthExit", getLocalPlayer()) end end function submitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(editLoginUser) local password = guiGetText(editLoginPass) if string.len(username) == 0 or string.len(password) == 0 then outputChatBox("Mindket mezo kitoltese kotelezo") else guiSetVisible(windowLogin, false) showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthLogin", getLocalPlayer(), username, password) end end end function submitRegist(button, state) if button == "left" and state == "up" then local username = guiGetText(editRegistUser) local password = guiGetText(editRegistPass) if string.len(username) == 0 or string.len(password) == 0 then outputChatBox("Mindket mezo kitoltese kotelezo") elseif string.len(fiusernameeld1) < 4 then outputChatBox("A felhasznalonevnek minimum 4 karakter hosszunak kell lennie") else guiSetVisible(windowRegist, false) destroyElement(windowRegist) showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthRegist", getLocalPlayer(), username, password) end end end function submitPassChange(button, state) if button == "left" and state == "up" then local newpass = guiGetText(editPassChangeNew) local repass = guiGetText(editPassChangeRe) if string.len(newpass) == 0 or string.len(repass) == 0 then outputChatBox("Mindket mezo kitoltese kotelezo") elseif string.len(newpass) < 4 then outputChatBox("Az új jelszónak minimum 4 karakter hosszunak kell lennie") elseif newpass ~= repass then outputChatBox("Az új jelszó és a megerősítés nem egyeznek") else guiSetVisible(windowPassChange, false) showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthPassChange", getLocalPlayer(), newpass) end end end And btw, you have 3 buttons with the same variable, buttonExit.
  22. Post both server side and client side here between [lua] tags
  23. use /debugscript 3 and post any errors or warnings here.
  24. Yes, but it's not what he meant, if i'm right he meant adding the functions like: addEventHandler("onClientGUIClick", buttonLoginToRegist, changeLoginToRegist, false) addEventHandler("onClientGUIClick", buttonPassChangeSubmit, submitPassChange, false) addEventHandler("onClientGUIClick", buttonExit, exitAuth, false) addEventHandler("onClientGUIClick", buttonRegistToLogin, changeRegistToLogin, false) addEventHandler("onClientGUIClick", buttonLoginSubmit, submitLogin, false) addEventHandler("onClientGUIClick", buttonRegistSubmit, submitRegist, false) Did you add these functions? changeLoginToRegist submitPassChange exitAuth changeRegistToLogin submitLogin submitRegist
×
×
  • Create New...