Jump to content

TwiX!

Members
  • Posts

    905
  • Joined

  • Last visited

Everything posted by TwiX!

  1. ------------- -- AFK killer ------------- local MaxAFKtime = 30 local warnTime = 20 local v = 0 local AFKtime = 0 local sx,sy = guiGetScreenSize() local wEvent = false function rWarn() dxDrawImage( sx/2 - 300, sy/2 - 100, 600, 200, "img/warn.png") dxDrawText("You will be killed in "..tostring(tCount).." seconds",sx/2 - 255, sy/2 + 45,sx,sy,tocolor(255,186,0,255),1.01,"bankgothic") end function stopWarn() if(wEvent) then removeEventHandler("onClientRender", getRootElement(), rWarn) wEvent = false end end function imgHandler() stopWarn() end addEventHandler("onClientPlayerWasted",getLocalPlayer(),imgHandler) function checkMain() if isPedInVehicle ( getLocalPlayer() ) then aTimeAdd() end end function aTimeAdd() AFKtime = AFKtime + 1 local isFinished = getElementData ( getLocalPlayer(), "dead") if(isVehicleFrozen ( getPedOccupiedVehicle ( getLocalPlayer() )) and isFinished == false) then aTimeClear() end local isNew = getElementData (getLocalPlayer(), "state") if isNew == "waiting" or isNew == "dead" then aTimeClear() end if(getPedOccupiedVehicle ( getLocalPlayer() ) ~= false) then local player = getLocalPlayer() if(AFKtime >= MaxAFKtime) then if (afkCounter <= 2) then triggerServerEvent ( "afkWarn", player, 1, afkCounter) afkCounter = afkCounter+1 triggerServerEvent ( "afkSlap", player) stopWarn() elseif (afkCounter > 2) then triggerServerEvent ( "afkWarn", player, 1, afkCounter) triggerServerEvent ( "afkWarn", player, 2) afkCounter = 1 triggerServerEvent ( "afkKick", player , player) end elseif(AFKtime >= warnTime) then tCount = tCount - 1 if(not wEvent) then addEventHandler("onClientRender", getRootElement(), rWarn) wEvent = true end end end end setTimer ( checkMain, 1000, -1) function aTimeClear() AFKtime = 0 tCount = 11 stopWarn() end bindKey("accelerate","down",aTimeClear) bindKey("vehicle_left","down",aTimeClear) bindKey("vehicle_right","down",aTimeClear) bindKey("brake_reverse","down",aTimeClear) function onClientLoaded(res) triggerServerEvent("onClientLoaded",getLocalPlayer()) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),onClientLoaded) function loadSettings(maxtime, wtime ) MaxAFKtime = tonumber(maxtime) warnTime = tonumber(wtime) end addEvent( "onSettingsReady", true ) addEventHandler( "onSettingsReady", getRootElement(), loadSettings ) function setKBA(thePlayer) killedByAfk = 1 end function getKBA(thePlayer) if killedByAfk == 0 then thePlayer = getLocalPlayer() callServerFunction("earnMoney", thePlayer) end end function deathReset() if killedByAfk == 0 then afkCounter = 0 else end end addEventHandler("onClientPlayerWasted",getLocalPlayer(),deathReset) function resetKBA() killedByAfk = 0 end
  2. TwiX!

    save team

    u can edit your post
  3. TwiX!

    question

    he can call server and save in root (but if server will restarted , this will not work) so he can save it in xml or sql/msql or just make a check accounts.. but xml not good idea, if saved all on server and xml file > 3mb server will supre sloooow,
  4. TwiX!

    question

    local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then triggerServerEvent(source,"onSelect1",source) else outputChatBox("*"..getPlayerName(source).." welcome to Biohazard server", source) end end function selectskin() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} select = guiCreateWindow(150,126,306,198,"Welcome to Biohazard Serer",false) GUIEditor_Label[1] = guiCreateLabel(102,24,111,19,"Select your gender",false,select) GUIEditor_Button[1] = guiCreateButton(29,74,88,41,"Male",false,select) GUIEditor_Button[2] = guiCreateButton(188,74,88,41,"Female",false,select) GUIEditor_Label[2] = guiCreateLabel(18,139,230,22,"This will select your skin",false,select) GUIEditor_Label[3] = guiCreateLabel(17,162,244,26,"Only can chose when you join on first time",false,select) end addEvent( "onSelect", true ) addEventHandler( "onSelect", getLocalPlayer(), selectskin ) --server function TriGfor1Player ( source ) triggerClientEvent ( source, "onSelect", source ) end addEvent( "onSelect1", true ) addEventHandler( "onSelect1", getRootElement(), TriGfor1Player ) Client CAN'T CALL Client if u not want trigger just remove it and use local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then makeWindow() else outputChatBox("*"..getPlayerName(source).." welcome to Biohazard server", source) end end function makeWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} select = guiCreateWindow(150,126,306,198,"Welcome to Biohazard Serer",false) GUIEditor_Label[1] = guiCreateLabel(102,24,111,19,"Select your gender",false,select) GUIEditor_Button[1] = guiCreateButton(29,74,88,41,"Male",false,select) GUIEditor_Button[2] = guiCreateButton(188,74,88,41,"Female",false,select) GUIEditor_Label[2] = guiCreateLabel(18,139,230,22,"This will select your skin",false,select) GUIEditor_Label[3] = guiCreateLabel(17,162,244,26,"Only can chose when you join on first time",false,select) end
  5. server -- create our loginHandler function, with username and password parameters (passed from the client GUI). function loginHandler(username,password) -- check that the username and password are correct. local acc = getAccount(username, password) -- the player has succesfully logged in, so spawn them. if (acc) then logIn (source, acc, password) spawnPlayer (source, 1959.55, -1714.46, 10) fadeCamera(source, true) setCameraTarget(source) outputChatBox("Enjoy your time!", source) else -- if the username or password are not correct, output a message to the player. outputChatBox("invalid username and password. Please re-connect and try again.", source) end end -- define our costom event, and allow it to be triggered from the client ('true'). addEvent("submitLogin",true) -- add an event handler so that when submitLogin is triggered, the function loginHandler is called. addEventHandler("submitLogin",root, loginHandler) function registerPlayer(username,password, password2) outputChatBox( "Username:"..username.." Password: "..password.."password confirm"..password2, source ) -- if player not write username. if not (username == "") then -- if player not write password. if not (password == "") then -- verify that both passwords are the same. if (password == password2) then local account = getAccount (username,password) -- get account if ( not getAccount ( username ) ) then local accountAdded = addAccount(username, password) -- added with username and pass from client if (accountAdded) then -- if account added write message outputChatBox ( "Thank you " ..username.. ", You can now login with your username and password.", source ) -- upon succesfull creation of the account this function will be called to set the the register screen to invisible and the login screen to visible. triggerClientEvent(source,"closeRegister",getRootElement()) else -- if not -//- outputChatBox ( "Error creating account, contact the server admin.", source ) end else outputChatBox ( "This account already exists..", source ) end else outputChatBox ("The passwords do not match, please re-enter.") end else outputChatBox ( "Please enter a password", source ) end else outputChatBox ( "Please enter a username", source ) end end addEvent("registerPlayer",true) addEventHandler("registerPlayer",getRootElement(),registerPlayer) client function closeRegisterWindow() -- make the Register window invisible. guiSetVisible(wdwRegister, false) -- make the login window visible again. guiSetVisible(wdwLogin, true) end addEvent("closeRegister", true) addEventHandler("closeRegister", getRootElement(), closeRegisterWindow) some of your code by nextreme
  6. function registerWindowCancel(button,state) if(button == "left" and state == "up") then if (source == btnCancel) then guiSetVisible(wdwRegister, false) guiSetVisible(wdwLogin, false) end end end
  7. i not see the problem, code will work or i still do not understand you
  8. if xml file size >1mb , and 20players server will going down
  9. i can made it /rp/dm/fun/other gamemodes
  10. pls write here part of script, erros, or errors in /debugscript 3 and tell me what u want when register complited close window? if cansel close too?
  11. update my code and added descriptions what problem now?
  12. dude your function function registerPlayer(username, password) is server-side, you put it in client-side, check up my code..
  13. https://community.multitheftauto.com/index.php?p= ... ls&id=4059 Not his resource.. its my code viewtopic.php?f=91&t=41487 my post there ban him..
  14. u check state not check btn Because u just made a button, nothing more function registerPlayer1(button,state) if(button == "left" and state == "up") then if (source == btnRegister) then local username = guiGetText(edtUser) local password = guiGetText(edtPass) registerPlayer( username, password ) end end end or i'm not understand you if ( not getAccount ( username ) ) then add account SERVER ONLY FUNCTIONS u can Client: function registerPlayer1(button,state)--make function if(button == "left" and state == "up") then -- check button if (source == btnRegister) then -- if player pressed on this button local username = guiGetText(edtUser)--Get text from edtUser local password = guiGetText(edtPass) --get text from edtPass triggerServerEvent("regmePls",getLocalPlayer(),username,password) -- call server-side function (first name trigger,getLocalPlayer() - its you (we not want register all), username(with out text),password(with our text) end -- close btnRegister end -- Close check end -- Close function Server: addEvent("regmePls",true)--Made event for client function canRegister(username,password) -- Made function for server (our username/password[From client]) if not (username == "") then -- if player not write username if not (password == "") then -- if player not write password local account = getAccount (username,password) -- get account if (account == false) then -- if player not have account , we add him local accountAdded = addAccount(tostring(username),tostring(password)) -- added with username and pass from client if (accountAdded) then -- if account added write message outputChatBox ( "Thank you " .. getPlayerName ( source ) .. ", Ya estas Registrado ahora loggeate", source ) else -- if not -//- outputChatBox ( "Error creating account, contact the server admin.", source ) end else outputChatBox ( "This account already exists..", source end else outputChatBox ( "Please enter a password", source ) end else outputChatBox ( "Please enter a username", source ) end end addEventHandler("regmePls",getRootElement(),canRegister) -- add handler for 'source' and for function with our event name
  15. Почему вы ни когда не пользуетесь поиском... https://wiki.multitheftauto.com/wiki/TriggerClientEvent
  16. TwiX!

    question

    You can use account data also(If you're going to use accounts even). he can't use account if player not logged. to detect if the player join
  17. TwiX!

    question

    yes local firstTime = 0 function onLogin() if getElementData(source, "firstTime") == 1 then firstTime = 0 else setElementData ( source, "firstTime", 1 ) firstTime = 1 asd(source) end end addEventHandler("onPlayerJoin", getRootElement(), onLogin) function asd(source) if firstTime == 1 then outputChatBox("Player "..getPlayerName(source).."Joined first time!", getRootElement()) else outputChatBox("Player "..getPlayerName(source).."Just join on the server", getRootElement()) end end
  18. addEventHandler("onPlayerLogin", root, function () local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) then outputChatBox("Admin"..getPlayerName(source).." has logged in!", root,255,255,255) else outputChatBox("Player"..getPlayerName(source).." has logged in!", root,255,255,255) end end ) Server-Side only
  19. PASHOL NX!!!!!!!!!! don't be a idiot, lolz u russian ne viebivaus9 xuli
×
×
  • Create New...