Jump to content

HeK

Members
  • Posts

    185
  • Joined

  • Last visited

Everything posted by HeK

  1. I only say thank you when the discussion is done.. Sorry.. Why do you want full code? It's just a client side login panel.
  2. It doesn't hide the stuff before login..
  3. Only thing it shows is WARNING: uip_login\client.lua:292: Bad argument @ 'removeEventHandler' [Expected element at argument 2]
  4. Renkon, it didn't work.
  5. Yeah, it's working. I think it was a problem with "play" script, when i reconneted it didn't work. Thanks.
  6. It worked, but that only works when the resource starts, when a friend or when i reconnect, it only shows the panel, no "Camera View".
  7. I'm trying to disable minimap/area name on my login panel, but it is disabled, but when a player logins it's still disabled. How to fix it? addEventHandler("onClientResourceStart",resourceRoot, function() showPlayerHudComponent("radar" ,false) showPlayerHudComponent("area_name" ,false) end)
  8. Hum, there's still a black screen behind the panel, i did that for the camera and it didn't work.
  9. HeK

    [HELP]Save script

    Well, i really didn't understand, could you make an example or something?
  10. Sorry for my stupidity. It's fixed. Thanks again.
  11. Should i just add that to the client script? Because i did and it didn't work.
  12. One more thing, when players disconnect the vehicles stay in game, is there any way to fix that?
  13. addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( hitElement == localPlayer ) then createVehGui ( hitElement ) if ( MainGui ~= nil ) then guiSetVisible ( MainGui, true ) showCursor ( true ) guiSetInputEnabled ( true ) setElementFrozen ( hitElement, true ) end end end
  14. I have been trying some stuff but none worked, i need to check if the player is in a vehicle and when he touches the marker, it shouldn't open the GUI. local vehicles = { } addEvent ( "spawnvehicle", true ) addEventHandler ( "spawnvehicle", root, function ( vehID ) if ( isElement ( vehicles [ source ] ) ) then destroyElement ( vehicles [ source ] ) end vehicles [ source ] = createVehicle ( vehID, getElementPosition ( source ) ) if ( vehicles [ source ] ) then setVehicleColor ( vehicles [ source ], 240, 240, 240 ) end setTimer ( warpPedIntoVehicle, 200, 1, source, vehicles [ source ] ) triggerClientEvent ( source, "closeWindow", root ) end )
  15. HeK

    [HELP]Save script

    Then how should i do it? Any tips?
  16. This script saves: money, skin, int, dem, health, armor, etc. But the only thing it doesn't save is "TEAM" i have tried doing some stuff, but can't get it to work. function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-team") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim, playerTeam) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) setCameraTarget (source, source) fadeCamera(source, true, 2.0) setPlayerNametagColor (source, R, G, B) else spawnPlayer (source, -2263.802734375, 2303.1708984375, 4.8202133178711, 0,78, 0, 0) setPlayerMoney (source, 100000) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then savePlayerWeapons(source) local x,y,z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) setAccountData (account, "funmodev2-team", getPlayerTeam (source)) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then savePlayerWeapons(source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 1606.9819335938, 1817.4609375, 10.8203125, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) function onSpawn() if not( isGuestAccount (getPlayerAccount(source)) ) then loadPlayerWeapons(source) end end addEventHandler ("onPlayerSpawn", getRootElement(), onSpawn) function savePlayerWeapons(player) local account = getPlayerAccount(player) if isGuestAccount(account) then return end local weaponsString = "" for index = 0, 12 do local weapon = getPedWeapon(player, index) local ammo = getPedTotalAmmo(player, index) if ammo > 0 then weaponsString = weaponsString..";"..weapon..","..ammo end end setAccountData(account, "weapons", weaponsString) end function loadPlayerWeapons(player) local account = getPlayerAccount(player) if isGuestAccount(account) then return end local weaponsString = getAccountData(account, "weapons") takeAllWeapons(player) for index, wData in pairs(split(weaponsString, ";")) do local weapon, ammo = unpack(split(wData, ",")) weapon, ammo = tonumber(weapon), tonumber(ammo) if weapon and weapon ~= 0 and ammo and ammo ~= 0 then giveWeapon(player, weapon, ammo) end end end
  17. I have a login script that has a black background, i already disabled that function but it is still there. I'd like the player to see a "place" for example Vinewood (got code from wiki) and the login panel in the middle. This is the setCameraMatrix code. function setCameraOnPlayerJoin() -- slowly fade the camera in to make the screen visible fadeCamera(source, true, 5) -- set the player's camera to a fixed position, looking at a fixed point setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) The whole login panel (client side). wdwLogin_Pannel = {} tabPannel_Main = {} tab_Login = {} tab_Register = {} GuestEnable = false function setCameraOnPlayerJoin() fadeCamera(source, true, 5) setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayer) function open_log_reg_pannel() if not(isElement(wdwLogin_Pannel)) then local sWidth,sHeight = guiGetScreenSize() local Width,Height = 480,400 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"Union of Individual Players - Login Panel",false) guiWindowSetSizable(wdwLogin_Pannel,false) tabPannel_Main = guiCreateTabPanel(9,23,500,400,false,wdwLogin_Pannel) tab_Login = guiCreateTab("Login",tabPannel_Main) lbl_Login = guiCreateLabel(103,72,42,19,"Login:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Login,"center") guiLabelSetHorizontalAlign(lbl_Login,"right",false) guiSetFont(lbl_Login,"default-bold-small") edit_Login = guiCreateEdit(156,72,169,23,"",false,tab_Login) edit_password = guiCreateEdit(156,106,169,23,"",false,tab_Login) guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) guiCreateStaticImage ( 63, 220, 350, 100, "uiplogo.png", false, tab_Login) lbl_Password = guiCreateLabel(48,106,96,19,"Password:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Password,"center") guiLabelSetHorizontalAlign(lbl_Password,"right",false) guiSetFont(lbl_Password,"default-bold-small") lbl_top_info = guiCreateLabel(109,6,250,60,"Please insert your username and password.",false,tab_Login) guiLabelSetColor(lbl_top_info,0,100,255) guiLabelSetVerticalAlign(lbl_top_info,"center") guiLabelSetHorizontalAlign(lbl_top_info,"center",false) checkbox_save = guiCreateCheckBox(329,110,100,20,"(Save)",false,false,tab_Login) guiSetFont(checkbox_save,"default-small") btn_Login = guiCreateButton(164,162,147,41,"Login",false,tab_Login) guiSetFont(btn_Login,"default-bold-small") login_tab_error_msg = guiCreateLabel(31,131,419,25,"Error_login_tab",false,tab_Login) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") tab_Register = guiCreateTab("Register",tabPannel_Main) lbl_account_name = guiCreateLabel(43,39,119,21,"Account Name:",false,tab_Register) guiLabelSetVerticalAlign(lbl_account_name,"center") guiLabelSetHorizontalAlign(lbl_account_name,"right",false) guiSetFont(lbl_account_name,"default-bold-small") edit_account_name = guiCreateEdit(172,40,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit_account_name,25) lbl__reg_tab_password = guiCreateLabel(43,71,119,21,"Password:",false,tab_Register) guiLabelSetVerticalAlign(lbl__reg_tab_password,"center") guiLabelSetHorizontalAlign(lbl__reg_tab_password,"right",false) guiSetFont(lbl__reg_tab_password,"default-bold-small") edit__reg_tab_password = guiCreateEdit(172,71,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_password,25) edit__reg_tab_Repassword = guiCreateEdit(172,102,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) lvl_reg_tab_Repassword = guiCreateLabel(43,102,119,21,"Repeat password:",false,tab_Register) guiLabelSetVerticalAlign(lvl_reg_tab_Repassword,"center") guiLabelSetHorizontalAlign(lvl_reg_tab_Repassword,"right",false) guiSetFont(lvl_reg_tab_Repassword,"default-bold-small") btn_reg_tab_register = guiCreateButton(153,161,174,42,"Confirm & register!",false,tab_Register) guiSetFont(btn_reg_tab_register,"default-bold-small") reg_tab_error_msg = guiCreateLabel(66,129,364,31,"Error_reg_ttab",false,tab_Register) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") guiSetVisible(wdwLogin_Pannel,true) guiSetInputEnabled(true) showCursor(true) guiSetText(reg_tab_error_msg, "") guiSetText(login_tab_error_msg, "") local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) end addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin) addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister) if GuestEnable == true then addEventHandler("onClientGUIClick",btnGuest,onClickGuest) end else --destroyElement(wdwLogin_Pannel) --guiSetInputEnabled(false) --wdwLogin_Pannel = nil --showCursor(false) end end function start_cl_resource() open_log_reg_pannel() end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource) function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtnLogin(button,state) if(button == "left" and state == "up") then if (source == btn_Login) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end function onClickBtnRegister(button,state) if(button == "left" and state == "up") then if (source == btn_reg_tab_register) then username = guiGetText(edit_account_name) password = guiGetText(edit__reg_tab_password) passwordConfirm = guiGetText(edit__reg_tab_Repassword) triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm) end end end function Error_msg(Tab, Text) if Tab == "Login" then
  18. Thanks, solved all my problems.
  19. I'm trying to make the perfect ColCuboid for my gate, but it's not perfect, it only opens in a little part, i don't really understand how it works. gate1 = createObject(980, -2289.8000488281, -1699.9000244141, 480.79998779297, 0, 0, 14) col1 = createColCuboid(-2290, -1699.8000488281, 479.29998779297, 8, 15, 10)
  20. Problem fixed, thanks igthomas.
  21. Doesn't show anything about the removemodel script.
  22. Still doesn't work, and i even used a radius of 100000000.
×
×
  • Create New...