Jump to content

Yasar

Members
  • Posts

    19
  • Joined

  • Last visited

Details

  • Location
    France

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Yasar's Achievements

Square

Square (6/54)

0

Reputation

  1. Salut , je voulais savoir si quelqu'un pouvait me donnée des "cours" de .lua , malgré après avoir lu : - https://wiki.multitheftauto.com/index.php?title=FR/Main_Page - http://wxlua.free.fr/Tutoriel_Lua/sommaire.php (ou certain truc que j'ai pas compris)
  2. Merci , des réponses mais tous c'qu'il y a sur le lien est-il utile ?
  3. Je serai obligé de toujours tapé upgrade ou il y a une autre solution ? Le scoreboard est bien lancé mais sa me mets quand même cette erreur
  4. Merci ! cela à fonctionné J'ai encore quelques erreurs dans la console voila les erreurs Ce que la console , m'affiche [2017-10-27 11:41:26] ERROR: [DayZ-MTA]\DayZ\group_system\gang_server.lua:5: exports: Call to non-running server resource (scoreboard) [string "?"] C'que j'ai addEventHandler("onResourceStart", resourceRoot, function() local columnName = get("column_name") exports.scoreboard:scoreboardAddColumn("gang", root, columnName:len() * 12, columnName) executeSQLCreateTable("gangs", "gang_name STRING, gang_leader STRING, gang_members, gang_subleaders STRING") executeSQLCreateTable("gang_members", "gang_name STRING, member_account STRING, added_by STRING") checkPlayerGroupDetails() for index, player in ipairs(getElementsByType("player")) do local gang = getAccountGang(getAccountName(getPlayerAccount(player))) setElementData(player, "gang", gang) --bindKey(player, get("panel_bind"), "down", showGangPanel) end end) 2. La console [2017-10-27 11:41:27] WARNING: VSM/Editor_Slots.lua [Client] is encoded in ANSI instead of UTF-8. Please convert your file to UTF-8. [2017-10-27 11:41:27] Some files in 'VSM' use deprecated functions. [2017-10-27 11:41:27] Use the 'upgrade' command to perform a basic upgrade of resources. [2017-10-27 11:41:27] ERROR: attempt to call a nil value [2017-10-27 11:41:27] ERROR: VSM\VSM_Server.lua_VSM:0: call: failed to call 'DayZ:addAddonInfo' [2017-10-27 11:41:27] WARNING: VSM\VSM_Server.lua_VSM:0: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] je ne sais pas comment convertir en UTF-8
  5. Bien , merci je corrige sa tous de suite Mais du coup l'erreur [2017-10-26 17:08:46] WARNING: [DayZ-MTA]\DayZ\login.lua:512: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [2017-10-26 17:08:46] WARNING: [DayZ-MTA]\DayZ\login.lua:566: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] Comment puis-je la réglé ?
  6. L'erreur : [2017-10-26 15:10:50] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:10:56] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:20] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:26] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:50] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:11:56] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:20] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:26] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:50] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:12:56] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:20] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:26] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:50] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:13:56] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:20] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:26] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:50] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:14:56] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:20] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:26] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:30] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:40] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:50] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:15:56] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:00] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:10] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:20] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:26] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:31] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:921: attempt to call global 'getPedControlState' (a nil value) [2017-10-26 15:16:31] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:954: attempt to call global 'getPedControlState' (a nil value) function checkTemperature2() for i,player in ipairs(getElementsByType("player")) do if getElementData(player,"logedin") then value = 0 if isElementInWater(player) then value = gameplayVariables["temperaturewater"] end if getPedControlState (player,"sprint") then ------- L'erreur 921 value = value+gameplayVariables["temperaturesprint"] end addPlayerStats (player,"temperature",value) end end end setTimer(checkTemperature2,10000,0) function checkThirsty() for i,player in ipairs(getElementsByType("player")) do if getElementData(player,"logedin") then value = 0 if getPedControlState (player,"sprint") then --- erreur 954 value = gameplayVariables["sprintthirst"] end addPlayerStats (player,"thirst",value) end end end setTimer(checkThirsty,10000,0) Cela m'a spam comme jamais
  7. Voici , d'autre erreur affiché [2017-10-26 14:50:21] WARNING: [DayZ-MTA]\DayZ\login.lua:512: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [2017-10-26 14:50:21] WARNING: [DayZ-MTA]\DayZ\login.lua:566: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] c'que j'ai function createVehicleOnServerStart() local vehicleManager = getAccount("vehicleManager","ds4f9$") for i = 1, (getAccountData(vehicleManager,"vehicleamount") or 0) do ------------------- Ligne 512 wastedVehicle = false vehicle = getAccount("vehicle_number_"..i,"ds4f9$") if not vehicle then break end if getAccountData(vehicle,"isExploded") == true then setAccountData(vehicle,"health",1000) wastedVehicle = true end local veh = createVehicle(getAccountData(vehicle,"model"),getAccountData(vehicle,"last_x"),getAccountData(vehicle,"last_y"),getAccountData(vehicle,"last_z"),getAccountData(vehicle,"last_rx"),getAccountData(vehicle,"last_ry"),getAccountData(vehicle,"last_rz")) vehCol = createColSphere(getAccountData(vehicle,"last_x"),getAccountData(vehicle,"last_y"),getAccountData(vehicle,"last_z"),4) attachElements ( vehCol, veh, 0, 0, 0 ) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementData(vehCol,"MAX_Slots",getAccountData(vehicle,"MAX_Slots")) setElementHealth(veh,getAccountData(vehicle,"health")) --vehicle_indentifikation xxx,yyy,zzz = getAccountData(vehicle,"spawn_x"),getAccountData(vehicle,"spawn_y"),getAccountData(vehicle,"spawn_z") setElementData(vehCol,"spawn",{getAccountData(vehicle,"model"),xxx,yyy,zzz}) if wastedVehicle then if getAccountData(vehicle,"model") == 497 then item_id = math.random(table.size(hunterSpawns)) xxx,yyy,zzz = hunterSpawns[item_id][1],hunterSpawns[item_id][2],hunterSpawns[item_id][3] end if getAccountData(vehicle,"model") == 487 then local item_id = math.random(table.size(maverikSpawns)) x,y,z = maverikSpawns[item_id][1],maverikSpawns[item_id][2],maverikSpawns[item_id][3] end setElementPosition(veh,xxx,yyy,zzz+1) setElementRotation(veh,0,0,0) --Engine + Tires + Tank Parts local tires,engine,parts = getVehicleAddonInfos (getElementModel(veh)) setElementData(vehCol,"Tire_inVehicle",math.random(0,tires)) setElementData(vehCol,"Engine_inVehicle",math.random(0,engine)) setElementData(vehCol,"Parts_inVehicle",math.random(0,parts)) end --others setElementData(vehCol,"fuel",getAccountData(vehicle,"fuel")) if not wastedVehicle then for i, data in ipairs(vehicleDataTable) do setElementData(vehCol,data[1],getAccountData(vehicle,data[1])) end else if getElementModel(veh) == 433 or getElementModel(veh) == 470 then for i,items in ipairs(lootItems["helicrashsides"]) do local randomNumber = math.random(1,10) if randomNumber == 5 then setElementData(vehCol,items[1],math.random(1,2)) end end end setElementData(vehCol,"fuel",10) end end for i = 1, (getAccountData(vehicleManager,"tentamount") or 0) do -------------- ligne 566 tentData = getAccount("tent_number_"..i,"ds4f9$") if not tentData then break end tent = createObject(3243,getAccountData(tentData,"last_x"),getAccountData(tentData,"last_y"),getAccountData(tentData,"last_z"),0,0,(getAccountData(tentData,"last_rz") or 0)) setObjectScale(tent,1.3) tentCol = createColSphere(getAccountData(tentData,"last_x"),getAccountData(tentData,"last_y"),getAccountData(tentData,"last_z"),4) attachElements ( tentCol, tent, 0, 0, 0 ) setElementData(tentCol,"parent",tent) setElementData(tent,"parent",tentCol) setElementData(tentCol,"tent",true) setElementData(tentCol,"vehicle",true) setElementData(tentCol,"MAX_Slots",100) for i, data in ipairs(vehicleDataTable) do setElementData(tentCol,data[1],getAccountData(tentData,data[1])) end end end
  8. Salut , voila c'que la console m'affiche après avoir démarré le serveur : [2017-10-26 11:48:35] WARNING: DayZ/survivorSystem_client.lua(Line 243) [Client] showPlayerHudComponent is deprecated and may not work in future versions. Please replace with setPlayerHudComponentVisible. [2017-10-26 11:48:35] WARNING: DayZ/survivorSystem_client.lua(Line 754) [Client] setControlState is deprecated and may not work in future versions. Please replace with setPedControlState. [2017-10-26 11:48:35] WARNING: DayZ/survivorSystem_client.lua(Line 1039) [Client] getControlState is deprecated and may not work in future versions. Please replace with getPedControlState. Voici la partie de la ligne 243 : function playerStatsClientSite() if getElementData(getLocalPlayer(),"logedin") then toggleControl ("radar",false) showPlayerHudComponent ("clock",false) ---cette ligne showPlayerHudComponent ("radar",false) showPlayerHudComponent ("money",false) showPlayerHudComponent ("health",false) showPlayerHudComponent ("area_name",false) showPlayerHudComponent ("vehicle_name",false) --showPlayerHudComponent ("weapon",false) --showPlayerHudComponent ("ammo",false) showPlayerHudComponent ("breath",false) if getElementData(getLocalPlayer(),"Map") >= 1 then toggleControl ("radar",true) end if getElementData(getLocalPlayer(),"GPS") >= 1 then showPlayerHudComponent ("radar",true) end if getElementData(getLocalPlayer(),"GPS") >= 1 then showPlayerHudComponent ("area_name",false) end if getElementData(getLocalPlayer(),"Watch") >= 1 then showPlayerHudComponent ("clock",true) end end end setTimer(playerStatsClientSite,1000,0) La ligne 754 : function playerGetDamageDayZ ( attacker, weapon, bodypart, loss ) cancelEvent() damage = 100 headshot = false if weapon == 37 then return end if getElementData(attacker,"zombie") then setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-gameplayVariables["zombiedamage"]) local number = math.random(1,7) if number == 4 then setElementData(getLocalPlayer(),"bleeding",getElementData(getLocalPlayer(),"bleeding") + math.floor(loss*10)) end end if weapon == 49 then if loss > 30 then playSound("sounds/brokenbone.mp3") setElementData(getLocalPlayer(),"brokenbone",true) setControlState ("jump",true) ----- cette ligne setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-math.floor(loss*10)) end 1039 ligne fading = 0 --- cette ligne fading2 = "up" local screenWidth,screenHeight = guiGetScreenSize() local screenW, screenH = guiGetScreenSize() Voila
  9. Bien , j'ai encore l'erreur après avoir remplace que les phrases dans les " " Je n'ai plus la case où je note le pseudo Le login client modifié resourceRoot = getResourceRootElement( getThisResource( ) ) localPlayer = getLocalPlayer() versionstring = "MTA:DayZ\nwww.mtadayz.net\n\nVersion: 0.6\nLast Update: 03.12.2013" infoTable = {} Login_Edit = {} marwinButtons = {} sx,sy = guiGetScreenSize() font = {} scale = 1 if sx < 1152 then scale = sx/1152 end if sx < 1024 then outputChatBox("Nous vous recommandons fortement d'utiliser au moins 1024x768 comme résolution", 255, 0, 0) end font[-1] = guiCreateFont( "font2.ttf", 8*scale ) font[0] = guiCreateFont( "font.ttf", 14*scale ) font[1] = guiCreateFont( "font.ttf", 18*scale ) font[2] = guiCreateFont( "font.ttf", 20*scale ) font[3] = guiCreateFont( "font.ttf", 24*scale ) --Button function createMarwinButton(x,y,widht,height,text,bool,parent,info) button = guiCreateStaticImage(x,y,widht,height,"images/button_standard.png", bool,parent or nil) table.insert(marwinButtons,button) guiBringToFront(button) label = guiCreateLabel(0,0,1,1,text,bool,button) guiBringToFront(label) setElementData(label,"parent",button) setElementData(button,"info",info) guiSetFont(label,font[1]) guiLabelSetVerticalAlign (label, "center") guiLabelSetHorizontalAlign (label, "center") addEventHandler("onClientMouseEnter",label,markButton,false) addEventHandler("onClientMouseLeave",label,unmarkButton,false) return label end function markButton () parent = getElementData(source,"parent") guiStaticImageLoadImage (parent,"images/button_mouse.png") setElementData(getLocalPlayer(),"clickedButton",parent) playSound("button.mp3") end function unmarkButton (b,s) parent = getElementData(source,"parent") guiStaticImageLoadImage (parent,"images/button_standard.png") setElementData(getLocalPlayer(),"clickedButton",false) end --Button end function build_loginWin() guiSetInputMode("no_binds_when_editing") showCursor(true) --transfer old login data to new secure place oldFile = xmlLoadFile("preferencesL.xml") confFile = xmlLoadFile("@preferencesL.xml") if not confFile and oldFile then confFile = xmlCreateFile("@preferencesL.xml","user") local usr = xmlNodeGetAttribute(oldFile,"Pseudo") local pass = xmlNodeGetAttribute(oldFile,"pass") xmlNodeSetAttribute(confFile, "Pseudo", usr) xmlNodeSetAttribute(confFile, "pass", pass) xmlSaveFile(confFile) end if oldFile then xmlUnloadFile(oldFile) end -- confFile = xmlLoadFile("@preferencesL.xml") if (confFile) then infoTable["account"] = xmlNodeGetAttribute(confFile,"Pseudo") infoTable["pass"] = xmlNodeGetAttribute(confFile,"pass") else confFile = xmlCreateFile("@preferencesL.xml","user") xmlNodeSetAttribute(confFile,"Pseudo","") xmlNodeSetAttribute(confFile,"pass","") infoTable["account"] = getPlayerName(localPlayer) infoTable["pass"] = "" end xmlSaveFile(confFile) --is this even needed? --[[confFile = xmlLoadFile("@preferences.xml") if (confFile) then xmlNodeSetAttribute(confFile,"username","") xmlNodeSetAttribute(confFile,"pass","") end]] --Create Window --Background background_front = guiCreateStaticImage( 0.2, 0.25, 0.6, 0.5, "images/background_1.png", true ) tab_front = guiCreateStaticImage( 0, 0, 1, 0.075, "images/tab.png", true ,background_front) --Header Text headline = guiCreateLabel(0,0.15,1,0.8,"MTA:DayZ I LOGIN PANEL",true,tab_front) guiSetFont(headline,font[2]) guiLabelSetHorizontalAlign (headline, "center") --Version guestInfo = guiCreateLabel(0.025, 0.1, 0.325, 0.3,versionstring,true,background_front) guiSetFont(guestInfo,font[1]) guiLabelSetHorizontalAlign (guestInfo, "center") guiLabelSetColor ( guestInfo,50,255,50) --Login --login_box = guiCreateStaticImage( 0.025, 0.1, 0.325, 0.85, "images/box_background.png", true , background_front) loginButton = createMarwinButton(0.1,0.825,0.175,0.1,"Login",true,background_front,"login") --Text loginInfo = guiCreateLabel(0.025, 0.46, 0.325, 0.175,"Login!",true,background_front) guiSetFont(loginInfo,font[1]) guiLabelSetHorizontalAlign (loginInfo, "center") guiLabelSetColor ( loginInfo,50,255,50) --Username username = guiCreateLabel(0.025, 0.55, 0.325, 0.04,"Pseudo",true,background_front) guiSetFont(username,font[0]) guiLabelSetHorizontalAlign (username, "center") --Edit Box Login_Edit[1] = guiCreateEdit(0.1, 0.6, 0.175, 0.055, infoTable["account"], true,background_front) --Password password = guiCreateLabel(0.025, 0.675, 0.325, 0.04,"Password",true,background_front) guiSetFont(password,font[0]) guiLabelSetHorizontalAlign (password, "center") loginIcon = guiCreateStaticImage( 0.1, 0.46, 0.03, 0.05, "images/login_icon.png", true , background_front) --Edit Box Login_Edit[2] = guiCreateEdit(0.1, 0.725, 0.175, 0.055, infoTable["pass"], true,background_front) guiEditSetMasked(Login_Edit[2],true) --Register --register_box = guiCreateStaticImage( 0.375, 0.45, 0.325, 0.5, "images/box_background.png", true , background_front) registerButton = createMarwinButton(0.45,0.825,0.175,0.1,"Register",true,background_front,"register") --Text registerInfo = guiCreateLabel(0.375, 0.15, 0.325, 0.1,"Register!",true,background_front) guiSetFont(registerInfo,font[1]) guiLabelSetHorizontalAlign (registerInfo, "center") guiLabelSetColor ( registerInfo,50,255,50) --Username username = guiCreateLabel(0.375, 0.25, 0.325, 0.04,"Pseudo",true,background_front) guiSetFont(username,font[0]) guiLabelSetHorizontalAlign (username, "center") --Edit Box Login_Edit[3] = guiCreateEdit(0.45, 0.3, 0.175, 0.055, "", true,background_front) --Password password = guiCreateLabel(0.375, 0.375, 0.325, 0.04,"Password",true,background_front) guiSetFont(password,font[0]) guiLabelSetHorizontalAlign (password, "center") loginIcon = guiCreateStaticImage( 0.45, 0.15, 0.03, 0.05, "images/signup_icon.png", true , background_front) --Edit Box Login_Edit[4] = guiCreateEdit(0.45, 0.425, 0.175, 0.055, "", true,background_front) guiEditSetMasked(Login_Edit[4],true) --Password #2 password2 = guiCreateLabel(0.375, 0.5, 0.325, 0.04,"Repeat password",true,background_front) guiSetFont(password2,font[0]) guiLabelSetHorizontalAlign (password2, "center") --Edit Box Login_Edit[5] = guiCreateEdit(0.45, 0.55, 0.175, 0.055, "", true,background_front) guiEditSetMasked(Login_Edit[5],true) --Gender --malebutton = guiCreateRadioButton(0.46, 0.65, 0.15, 0.05, "Male", true, background_front) --femalebutton = guiCreateRadioButton(0.46, 0.71, 0.15, 0.05, "Female", true, background_front) --News/Updates --News Headline newsH = guiCreateLabel(0.726, 0.115, 0.25, 0.05,"News:",true,background_front) guiSetFont(newsH,font[0]) guiLabelSetHorizontalAlign (newsH, "center") guiLabelSetColor ( newsH,50,255,50) --news_box1 news_box1 = guiCreateStaticImage( 0.73, 0.16, 0.244, 0.2, "images/news.png", true , background_front) guiSetAlpha(news_box1,0.8) news1 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box1) guiSetFont(news1,"default-bold-small") news_box1_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box1) guiSetVisible(news_box1_new,false) --news_box2 news_box2 = guiCreateStaticImage( 0.73, 0.36, 0.244, 0.2, "images/news.png", true , background_front) guiSetAlpha(news_box2,0.4) news2 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box2) guiSetFont(news2,"default-bold-small") news_box2_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box2) guiSetVisible(news_box2_new,false) --news_box3 news_box3 = guiCreateStaticImage( 0.73, 0.56, 0.244, 0.2, "images/news.png", true , background_front) guiSetAlpha(news_box3,0.8) news3 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box3) guiSetFont(news3,"default-bold-small") news_box3_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box3) guiSetVisible(news_box3_new,false) --news_box4 news_box4 = guiCreateStaticImage( 0.73, 0.76, 0.244, 0.19, "images/news.png", true , background_front) guiSetAlpha(news_box4,0.4) news4 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box4) guiSetFont(news4,"default-bold-small") news_box4_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box4) guiSetVisible(news_box4_new,false) --others news_box = guiCreateStaticImage( 0.726, 0.1, 0.25, 0.85, "images/box_background.png", true , background_front) guiCreateStaticImage(0.79, 0.114, 0.028, 0.045, "images/on.png", true , background_front) end --LOGIN function clickPanelButton (button, state) if button == "left" and state == "up" then local element = getElementData(getLocalPlayer(),"clickedButton") if element then local info = getElementData(element,"info") if info and info == "login" then local username = guiGetText(Login_Edit[1]) local password = guiGetText(Login_Edit[2]) if not (tostring(username) == "") and not (tostring(password) == "") then triggerServerEvent("onClientSendLoginDataToServer", getLocalPlayer(), username, password) else reason = "Mot de passe ou nom d'utilisateur manquant!" outputChatBox("[LOGIN ERROR]#FF9900 "..reason,255,255,255,true) end elseif info and info == "guest" then showLoginWindow(false) elseif info and info == "register" then local username = guiGetText(Login_Edit[3]) local pass1 = guiGetText(Login_Edit[4]) local pass2 = guiGetText(Login_Edit[5]) if not (tostring(username) == "") then if not (tostring(pass1) == "") then if pass1 == pass2 then triggerServerEvent("onClientSendRegisterDataToServer", getLocalPlayer(), username, pass1) else reason = "Les mots de passe ne correspondent pas" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end else reason = "Aucun mot de passe n'a été entré!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end else reason = "Aucun nom d'utilisateur n'a été entré!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end end end end end addEventHandler("onClientClick",getRootElement(),clickPanelButton) function onClientGetNews(text1,text2,text3,text4,bool1,bool2,bool3,bool4) --workaround fix for line breaks local text1 = string.gsub(text1, "<br>", "\n") local text2 = string.gsub(text2, "<br>", "\n") local text3 = string.gsub(text3, "<br>", "\n") local text4 = string.gsub(text4, "<br>", "\n") guiSetText(news1,text1) guiSetText(news2,text2) guiSetText(news3,text3) guiSetText(news4,text4) guiSetVisible(news_box1_new,bool1 == "true" and true or false) guiSetVisible(news_box2_new,bool2 == "true" and true or false) guiSetVisible(news_box3_new,bool3 == "true" and true or false) guiSetVisible(news_box4_new,bool4 == "true" and true or false) end addEvent("onClientGetNews",true) addEventHandler("onClientGetNews",getRootElement(),onClientGetNews) --BUILD WINDOW ON RESOURCE START addEventHandler("onClientResourceStart", resourceRoot, function () build_loginWin() guiSetVisible(background_front,false) showLoginWindow(true) guiSetInputMode("no_binds_when_editing") --playSound("winsound.mp3") fadeCamera (true) setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) triggerServerEvent("requestServerNews", localPlayer) end ) --onPlayerDoneLogin function hideLoginWindow(accountName, pass) showLoginWindow(false) toggleSavePassword(accountName, pass) end addEvent("onPlayerDoneLogin", true) addEventHandler("onPlayerDoneLogin", getRootElement(), hideLoginWindow) --toggle save password function toggleSavePassword(name, pass) confFile = xmlLoadFile("@preferencesL.xml") xmlNodeSetAttribute(confFile, "Pseudo", name) xmlNodeSetAttribute(confFile, "pass", pass) xmlSaveFile(confFile) end function showLoginWindow(bool) setElementData(getLocalPlayer(),"clickedButton",false) showCursor(bool) if bool then guiSetPosition(background_front,0.2, -0.75,true) addEventHandler("onClientRender",getRootElement(),rollLoginPanel) rollProgress = 1 rollIn = true guiSetInputMode("no_binds_when_editing") else guiSetPosition(background_front,0.2, 0.25,true) addEventHandler("onClientRender",getRootElement(),rollLoginPanel) rollProgress = 0 rollIn = false guiSetInputMode("allow_binds") end randomDirAnim = (math.random() > 0.5) and -1 or 1 useXAxis = (math.random() > 0.5) and true or false animType = useXAxis and "InBounce" or "InElastic" end --rollIn = true function rollLoginPanel () local eval if rollIn then if rollProgress > 0 then rollProgress = ((rollProgress * 1000) - 15)/1000 if rollProgress < 0 then rollProgress = 0 end eval = getEasingValue(rollProgress, animType) else removeEventHandler("onClientRender",getRootElement(),rollLoginPanel) return end else if rollProgress < 1 then rollProgress = ((rollProgress * 100) + 3)/100 if rollProgress > 1 then rollProgress = 1 end eval = getEasingValue(rollProgress, "InQuad") else removeEventHandler("onClientRender",getRootElement(),rollLoginPanel) return end end if useXAxis then guiSetPosition(background_front,0.2,0.25+randomDirAnim*eval,true) else guiSetPosition(background_front,0.2+randomDirAnim*eval,0.25,true) end guiSetVisible(background_front,true) end le login client pas modifié resourceRoot = getResourceRootElement( getThisResource( ) ) localPlayer = getLocalPlayer() versionstring = "MTA:DayZ\nwww.mtadayz.net\n\nVersion: 0.6\nLast Update: 03.12.2013" infoTable = {} Login_Edit = {} marwinButtons = {} sx,sy = guiGetScreenSize() font = {} scale = 1 if sx < 1152 then scale = sx/1152 end if sx < 1024 then outputChatBox("We highly recommend you to at least use 1024x768 as resolution", 255, 0, 0) end font[-1] = guiCreateFont( "font2.ttf", 8*scale ) font[0] = guiCreateFont( "font.ttf", 14*scale ) font[1] = guiCreateFont( "font.ttf", 18*scale ) font[2] = guiCreateFont( "font.ttf", 20*scale ) font[3] = guiCreateFont( "font.ttf", 24*scale ) --Button function createMarwinButton(x,y,widht,height,text,bool,parent,info) button = guiCreateStaticImage(x,y,widht,height,"images/button_standard.png", bool,parent or nil) table.insert(marwinButtons,button) guiBringToFront(button) label = guiCreateLabel(0,0,1,1,text,bool,button) guiBringToFront(label) setElementData(label,"parent",button) setElementData(button,"info",info) guiSetFont(label,font[1]) guiLabelSetVerticalAlign (label, "center") guiLabelSetHorizontalAlign (label, "center") addEventHandler("onClientMouseEnter",label,markButton,false) addEventHandler("onClientMouseLeave",label,unmarkButton,false) return label end function markButton () parent = getElementData(source,"parent") guiStaticImageLoadImage (parent,"images/button_mouse.png") setElementData(getLocalPlayer(),"clickedButton",parent) playSound("button.mp3") end function unmarkButton (b,s) parent = getElementData(source,"parent") guiStaticImageLoadImage (parent,"images/button_standard.png") setElementData(getLocalPlayer(),"clickedButton",false) end --Button end function build_loginWin() guiSetInputMode("no_binds_when_editing") showCursor(true) --transfer old login data to new secure place oldFile = xmlLoadFile("preferencesL.xml") confFile = xmlLoadFile("@preferencesL.xml") if not confFile and oldFile then confFile = xmlCreateFile("@preferencesL.xml","user") local usr = xmlNodeGetAttribute(oldFile,"username") local pass = xmlNodeGetAttribute(oldFile,"pass") xmlNodeSetAttribute(confFile, "username", usr) xmlNodeSetAttribute(confFile, "pass", pass) xmlSaveFile(confFile) end if oldFile then xmlUnloadFile(oldFile) end -- confFile = xmlLoadFile("@preferencesL.xml") if (confFile) then infoTable["account"] = xmlNodeGetAttribute(confFile,"username") infoTable["pass"] = xmlNodeGetAttribute(confFile,"pass") else confFile = xmlCreateFile("@preferencesL.xml","user") xmlNodeSetAttribute(confFile,"username","") xmlNodeSetAttribute(confFile,"pass","") infoTable["account"] = getPlayerName(localPlayer) infoTable["pass"] = "" end xmlSaveFile(confFile) --is this even needed? --[[confFile = xmlLoadFile("@preferences.xml") if (confFile) then xmlNodeSetAttribute(confFile,"username","") xmlNodeSetAttribute(confFile,"pass","") end]] --Create Window --Background background_front = guiCreateStaticImage( 0.2, 0.25, 0.6, 0.5, "images/background_1.png", true ) tab_front = guiCreateStaticImage( 0, 0, 1, 0.075, "images/tab.png", true ,background_front) --Header Text headline = guiCreateLabel(0,0.15,1,0.8,"MTA:DayZ I LOGIN PANEL",true,tab_front) guiSetFont(headline,font[2]) guiLabelSetHorizontalAlign (headline, "center") --Version guestInfo = guiCreateLabel(0.025, 0.1, 0.325, 0.3,versionstring,true,background_front) guiSetFont(guestInfo,font[1]) guiLabelSetHorizontalAlign (guestInfo, "center") guiLabelSetColor ( guestInfo,50,255,50) --Login --login_box = guiCreateStaticImage( 0.025, 0.1, 0.325, 0.85, "images/box_background.png", true , background_front) loginButton = createMarwinButton(0.1,0.825,0.175,0.1,"Login",true,background_front,"login") --Text loginInfo = guiCreateLabel(0.025, 0.46, 0.325, 0.175,"Login!",true,background_front) guiSetFont(loginInfo,font[1]) guiLabelSetHorizontalAlign (loginInfo, "center") guiLabelSetColor ( loginInfo,50,255,50) --Username username = guiCreateLabel(0.025, 0.55, 0.325, 0.04,"Username",true,background_front) guiSetFont(username,font[0]) guiLabelSetHorizontalAlign (username, "center") --Edit Box Login_Edit[1] = guiCreateEdit(0.1, 0.6, 0.175, 0.055, infoTable["account"], true,background_front) --Password password = guiCreateLabel(0.025, 0.675, 0.325, 0.04,"Password",true,background_front) guiSetFont(password,font[0]) guiLabelSetHorizontalAlign (password, "center") loginIcon = guiCreateStaticImage( 0.1, 0.46, 0.03, 0.05, "images/login_icon.png", true , background_front) --Edit Box Login_Edit[2] = guiCreateEdit(0.1, 0.725, 0.175, 0.055, infoTable["pass"], true,background_front) guiEditSetMasked(Login_Edit[2],true) --Register --register_box = guiCreateStaticImage( 0.375, 0.45, 0.325, 0.5, "images/box_background.png", true , background_front) registerButton = createMarwinButton(0.45,0.825,0.175,0.1,"Register",true,background_front,"register") --Text registerInfo = guiCreateLabel(0.375, 0.15, 0.325, 0.1,"Register!",true,background_front) guiSetFont(registerInfo,font[1]) guiLabelSetHorizontalAlign (registerInfo, "center") guiLabelSetColor ( registerInfo,50,255,50) --Username username = guiCreateLabel(0.375, 0.25, 0.325, 0.04,"Username",true,background_front) guiSetFont(username,font[0]) guiLabelSetHorizontalAlign (username, "center") --Edit Box Login_Edit[3] = guiCreateEdit(0.45, 0.3, 0.175, 0.055, "", true,background_front) --Password password = guiCreateLabel(0.375, 0.375, 0.325, 0.04,"Password",true,background_front) guiSetFont(password,font[0]) guiLabelSetHorizontalAlign (password, "center") loginIcon = guiCreateStaticImage( 0.45, 0.15, 0.03, 0.05, "images/signup_icon.png", true , background_front) --Edit Box Login_Edit[4] = guiCreateEdit(0.45, 0.425, 0.175, 0.055, "", true,background_front) guiEditSetMasked(Login_Edit[4],true) --Password #2 password2 = guiCreateLabel(0.375, 0.5, 0.325, 0.04,"Repeat password",true,background_front) guiSetFont(password2,font[0]) guiLabelSetHorizontalAlign (password2, "center") --Edit Box Login_Edit[5] = guiCreateEdit(0.45, 0.55, 0.175, 0.055, "", true,background_front) guiEditSetMasked(Login_Edit[5],true) --Gender --malebutton = guiCreateRadioButton(0.46, 0.65, 0.15, 0.05, "Male", true, background_front) --femalebutton = guiCreateRadioButton(0.46, 0.71, 0.15, 0.05, "Female", true, background_front) --News/Updates --News Headline newsH = guiCreateLabel(0.726, 0.115, 0.25, 0.05,"News:",true,background_front) guiSetFont(newsH,font[0]) guiLabelSetHorizontalAlign (newsH, "center") guiLabelSetColor ( newsH,50,255,50) --news_box1 news_box1 = guiCreateStaticImage( 0.73, 0.16, 0.244, 0.2, "images/news.png", true , background_front) guiSetAlpha(news_box1,0.8) news1 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box1) guiSetFont(news1,"default-bold-small") news_box1_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box1) guiSetVisible(news_box1_new,false) --news_box2 news_box2 = guiCreateStaticImage( 0.73, 0.36, 0.244, 0.2, "images/news.png", true , background_front) guiSetAlpha(news_box2,0.4) news2 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box2) guiSetFont(news2,"default-bold-small") news_box2_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box2) guiSetVisible(news_box2_new,false) --news_box3 news_box3 = guiCreateStaticImage( 0.73, 0.56, 0.244, 0.2, "images/news.png", true , background_front) guiSetAlpha(news_box3,0.8) news3 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box3) guiSetFont(news3,"default-bold-small") news_box3_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box3) guiSetVisible(news_box3_new,false) --news_box4 news_box4 = guiCreateStaticImage( 0.73, 0.76, 0.244, 0.19, "images/news.png", true , background_front) guiSetAlpha(news_box4,0.4) news4 = guiCreateLabel(0.025, 0.125, 1, 1,"-",true,news_box4) guiSetFont(news4,"default-bold-small") news_box4_new = guiCreateStaticImage( 0, 0, 0.15, 0.1, "images/new.png", true , news_box4) guiSetVisible(news_box4_new,false) --others news_box = guiCreateStaticImage( 0.726, 0.1, 0.25, 0.85, "images/box_background.png", true , background_front) guiCreateStaticImage(0.79, 0.114, 0.028, 0.045, "images/on.png", true , background_front) end --LOGIN function clickPanelButton (button, state) if button == "left" and state == "up" then local element = getElementData(getLocalPlayer(),"clickedButton") if element then local info = getElementData(element,"info") if info and info == "login" then local username = guiGetText(Login_Edit[1]) local password = guiGetText(Login_Edit[2]) if not (tostring(username) == "") and not (tostring(password) == "") then triggerServerEvent("onClientSendLoginDataToServer", getLocalPlayer(), username, password) else reason = "Missing Password or Username!" outputChatBox("[LOGIN ERROR]#FF9900 "..reason,255,255,255,true) end elseif info and info == "guest" then showLoginWindow(false) elseif info and info == "register" then local username = guiGetText(Login_Edit[3]) local pass1 = guiGetText(Login_Edit[4]) local pass2 = guiGetText(Login_Edit[5]) if not (tostring(username) == "") then if not (tostring(pass1) == "") then if pass1 == pass2 then triggerServerEvent("onClientSendRegisterDataToServer", getLocalPlayer(), username, pass1) else reason = "Passwords do not match!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end else reason = "No password was entered!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end else reason = "No username was entered!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end end end end end addEventHandler("onClientClick",getRootElement(),clickPanelButton) function onClientGetNews(text1,text2,text3,text4,bool1,bool2,bool3,bool4) --workaround fix for line breaks local text1 = string.gsub(text1, "<br>", "\n") local text2 = string.gsub(text2, "<br>", "\n") local text3 = string.gsub(text3, "<br>", "\n") local text4 = string.gsub(text4, "<br>", "\n") guiSetText(news1,text1) guiSetText(news2,text2) guiSetText(news3,text3) guiSetText(news4,text4) guiSetVisible(news_box1_new,bool1 == "true" and true or false) guiSetVisible(news_box2_new,bool2 == "true" and true or false) guiSetVisible(news_box3_new,bool3 == "true" and true or false) guiSetVisible(news_box4_new,bool4 == "true" and true or false) end addEvent("onClientGetNews",true) addEventHandler("onClientGetNews",getRootElement(),onClientGetNews) --BUILD WINDOW ON RESOURCE START addEventHandler("onClientResourceStart", resourceRoot, function () build_loginWin() guiSetVisible(background_front,false) showLoginWindow(true) guiSetInputMode("no_binds_when_editing") --playSound("winsound.mp3") fadeCamera (true) setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) triggerServerEvent("requestServerNews", localPlayer) end ) --onPlayerDoneLogin function hideLoginWindow(accountName, pass) showLoginWindow(false) toggleSavePassword(accountName, pass) end addEvent("onPlayerDoneLogin", true) addEventHandler("onPlayerDoneLogin", getRootElement(), hideLoginWindow) --toggle save password function toggleSavePassword(name, pass) confFile = xmlLoadFile("@preferencesL.xml") xmlNodeSetAttribute(confFile, "username", name) xmlNodeSetAttribute(confFile, "pass", pass) xmlSaveFile(confFile) end function showLoginWindow(bool) setElementData(getLocalPlayer(),"clickedButton",false) showCursor(bool) if bool then guiSetPosition(background_front,0.2, -0.75,true) addEventHandler("onClientRender",getRootElement(),rollLoginPanel) rollProgress = 1 rollIn = true guiSetInputMode("no_binds_when_editing") else guiSetPosition(background_front,0.2, 0.25,true) addEventHandler("onClientRender",getRootElement(),rollLoginPanel) rollProgress = 0 rollIn = false guiSetInputMode("allow_binds") end randomDirAnim = (math.random() > 0.5) and -1 or 1 useXAxis = (math.random() > 0.5) and true or false animType = useXAxis and "InBounce" or "InElastic" end --rollIn = true function rollLoginPanel () local eval if rollIn then if rollProgress > 0 then rollProgress = ((rollProgress * 1000) - 15)/1000 if rollProgress < 0 then rollProgress = 0 end eval = getEasingValue(rollProgress, animType) else removeEventHandler("onClientRender",getRootElement(),rollLoginPanel) return end else if rollProgress < 1 then rollProgress = ((rollProgress * 100) + 3)/100 if rollProgress > 1 then rollProgress = 1 end eval = getEasingValue(rollProgress, "InQuad") else removeEventHandler("onClientRender",getRootElement(),rollLoginPanel) return end end if useXAxis then guiSetPosition(background_front,0.2,0.25+randomDirAnim*eval,true) else guiSetPosition(background_front,0.2+randomDirAnim*eval,0.25,true) end guiSetVisible(background_front,true) end Le login server modifié local root = getRootElement() --LOGIN THE PLAYER FROM GUI function tryToLoginPlayer (username, password) local account = getAccount(username, password) if account then local accountName = getAccountName(account) logIn(source, account, password) triggerClientEvent(source,"onPlayerDoneLogin", source, accountName, password) triggerEvent("onPlayerDayZLogin", getRootElement(),username,pass,source) else outputChatBox("[LOGIN ERROR]#FF9900 Mot de passe ou nom d'utilisateur erroné!",source,255,255,255,true) end end addEvent("onClientSendLoginDataToServer", true) addEventHandler("onClientSendLoginDataToServer", root, tryToLoginPlayer) function tryToRegsiterPlayer(username, pass) if not getAccount(username) then theAccount = addAccount(username, pass) if (theAccount) then logIn(source, theAccount, pass) outputChatBox("Vous avez enregistré le compte avec succès'" ..username.. "' for player '" ..getPlayerName(source).. "'#FFFFFF with password '" ..pass.."'!", source, 255, 255, 255, true) triggerClientEvent(source,"onPlayerDoneLogin", source,username,pass) triggerEvent("onPlayerDayZRegister", getRootElement(),username,pass,source) triggerEvent("onPlayerDayZLogin", getRootElement(),username,pass,source) else reason = "Unknown Error!" outputChatBox("[LOGIN ERROR]#FF9900 "..reason,source,255,255,255,true) end else reason = "Le compte existe déjà!" outputChatBox("[LOGIN ERROR]#FF9900 "..reason,source,255,255,255,true) end end addEvent("onClientSendRegisterDataToServer", true) addEventHandler("onClientSendRegisterDataToServer", getRootElement(), tryToRegsiterPlayer) addEventHandler("onPlayerJoin", getRootElement(), function() fadeCamera(source, true) setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end) addEvent("requestServerNews", true) addEventHandler("requestServerNews", root, function() local text1 = get("news1") local text2 = get("news2") local text3 = get("news3") local text4 = get("news4") local bool1 = get("news1new") local bool2 = get("news2new") local bool3 = get("news3new") local bool4 = get("news4new") triggerClientEvent(source,"onClientGetNews",root,text1,text2,text3,text4,bool1,bool2,bool3,bool4) end ) Le login server pas modifié ocal root = getRootElement() --LOGIN THE PLAYER FROM GUI function tryToLoginPlayer (username, password) local account = getAccount(username, password) if account then local accountName = getAccountName(account) logIn(source, account, password) triggerClientEvent(source,"onPlayerDoneLogin", source, accountName, password) triggerEvent("onPlayerDayZLogin", getRootElement(),username,pass,source) else outputChatBox("[LOGIN ERROR]#FF9900 Wrong password or username!",source,255,255,255,true) end end addEvent("onClientSendLoginDataToServer", true) addEventHandler("onClientSendLoginDataToServer", root, tryToLoginPlayer) function tryToRegsiterPlayer(username, pass) if not getAccount(username) then theAccount = addAccount(username, pass) if (theAccount) then logIn(source, theAccount, pass) outputChatBox("You successfully registered account '" ..username.. "' for player '" ..getPlayerName(source).. "'#FFFFFF with password '" ..pass.."'!", source, 255, 255, 255, true) triggerClientEvent(source,"onPlayerDoneLogin", source,username,pass) triggerEvent("onPlayerDayZRegister", getRootElement(),username,pass,source) triggerEvent("onPlayerDayZLogin", getRootElement(),username,pass,source) else reason = "Unknown Error!" outputChatBox("[LOGIN ERROR]#FF9900 "..reason,source,255,255,255,true) end else reason = "Account already exists!" outputChatBox("[LOGIN ERROR]#FF9900 "..reason,source,255,255,255,true) end end addEvent("onClientSendRegisterDataToServer", true) addEventHandler("onClientSendRegisterDataToServer", getRootElement(), tryToRegsiterPlayer) addEventHandler("onPlayerJoin", getRootElement(), function() fadeCamera(source, true) setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end) addEvent("requestServerNews", true) addEventHandler("requestServerNews", root, function() local text1 = get("news1") local text2 = get("news2") local text3 = get("news3") local text4 = get("news4") local bool1 = get("news1new") local bool2 = get("news2new") local bool3 = get("news3new") local bool4 = get("news4new") triggerClientEvent(source,"onClientGetNews",root,text1,text2,text3,text4,bool1,bool2,bool3,bool4) end )
  10. Bien , j'ai remis le fichier de base
  11. Voila ce qu'il y a dans dans le login client --LOGIN function clickPanelButton (button, state) if button == "left" and state == "up" then local element = getElementData(getLocalPlayer(),"clickedButton") if element then local info = getElementData(element,"info") if info and info == "login" then local Pseudo = guiGetText(Login_Edit[1]) local Mot_de_passe = guiGetText(Login_Edit[2]) if not (tostring(Pseudo) == "") and not (tostring(Mot_de_passe) == "") then triggerServerEvent("onClientSendLoginDataToServer", getLocalPlayer(), Pseudo, Mot_de_passe) else reason = "Mot de passe ou nom d'utilisateur manquant!" outputChatBox("[LOGIN ERROR]#FF9900 "..reason,255,255,255,true) end elseif info and info == "guest" then showLoginWindow(false) elseif info and info == "register" then local Pseudo = guiGetText(Login_Edit[3]) local pass1 = guiGetText(Login_Edit[4]) local pass2 = guiGetText(Login_Edit[5]) if not (tostring(Pseudo) == "") then if not (tostring(pass1) == "") then if pass1 == pass2 then triggerServerEvent("onClientSendRegisterDataToServer", getLocalPlayer(), Pseudo, pass1) else reason = "Les mots de passe ne correspondent pas!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end else reason = "Aucun mot de passe n'a été entré!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end else reason = "Aucun nom d'utilisateur n'a été entré!" outputChatBox("[REGISTRATION ERROR]#FF9900 "..reason,255,255,255,true) end end end end end addEventHandler("onClientClick",getRootElement(),clickPanelButton) Voila dans le login server --LOGIN THE PLAYER FROM GUI function tryToLoginPlayer (Pseudo, Mot_de_passe) local account = getAccount(Pseudo, Mot_de_passe) if account then local accountName = getAccountName(account) logIn(source, account, Mot_de_passe) triggerClientEvent(source,"onPlayerDoneLogin", source, accountName, Mot_de_passe) triggerEvent("onPlayerDayZLogin", getRootElement(),Pseudo,pass,source) else outputChatBox("[LOGIN ERROR]#FF9900 Mot de passe ou nom d'utilisateur erroné!",source,255,255,255,true) end end addEvent("onClientSendLoginDataToServer", true) addEventHandler("onClientSendLoginDataToServer", root, tryToLoginPlayer)
  12. Ah , d'accord j'vais modifié sa tous de suite et voir Je débute donc j'espère que tu as pas rigolé derrière ton écran x) Bien , cela à réglé le plus gros soucis , mais j'ai encore un autre soucis c'est que la case où tu note ton Pseudo à disparu la console affiche [2017-10-25 10:45:44] WARNING: [DayZ-MTA]\login\login_server.lua:6: Bad argument @ 'getAccount' [Expected string at argument 1, got boolean] Voici après la modification function tryToLoginPlayer (Pseudo, Mot_de_passe) local account = getAccount(Pseudo, Mot_de_passe) if account then local accountName = getAccountName(account) logIn(source, account, Mot_de_passe) triggerClientEvent(source,"onPlayerDoneLogin", source, accountName, Mot_de_passe) triggerEvent("onPlayerDayZLogin", getRootElement(),Pseudo,pass,source) else outputChatBox("[LOGIN ERROR]#FF9900 Mot de passe ou nom d'utilisateur erroné!",source,255,255,255,true) end end addEvent("onClientSendLoginDataToServer", true) addEventHandler("onClientSendLoginDataToServer", root, tryToLoginPlayer)
×
×
  • Create New...