Jump to content

[HELP] My DayZ Login screen is bugged


sackforever

Recommended Posts

Add This

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10 
function joinHandler() 
    spawnPlayer(source, spawnX, spawnY, spawnZ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox("Welcome to My Server", source) 
end 
addEventHandler("onPlayerLogin", getRootElement(), joinHandler) 
  

Change the first x,y,z to the Location you want

Link to comment
function playerLogin(username, pass, player) 
  local playerID = getAccountData(getPlayerAccount(player), "playerID") 
  account = getPlayerAccount(player) 
  local x, y, z = getAccountData(account, "last_x"), getAccountData(account, "last_y"), getAccountData(account, "last_z") 
  local skin = getAccountData(account, "skin") 
  createZombieTable(player) 
  if getAccountData(account, "isDead") then 
    spawnDayZPlayer(player) 
    return 
  end 
  spawnPlayer(player, x, y, z, math.random(0, 360), skin, 0, 0) 
  fadeCamera(player, false) 
  setCameraTarget(player, player) 
  playerCol = createColSphere(x, y, z, 1.5) 
  setElementData(player, "playerCol", playerCol) 
  attachElements(playerCol, player, 0, 0, 0) 
  setElementData(playerCol, "parent", player) 
  setElementData(playerCol, "player", true) 
  for i, data in ipairs(playerDataTable) do 
    local elementData = getAccountData(account, data[1]) 
    if not elementData and data[1] ~= "brokenbone" and data[1] ~= "pain" and data[1] ~= "cold" and data[1] ~= "infection" and data[1] ~= "currentweapon_1" and data[1] ~= "currentweapon_2" and data[1] ~= "currentweapon_3" then 
      if data[1] == "bandit" then 
      else 
        elementData = 0 
      end 
    end 
    setElementData(player, data[1], elementData) 
  end 
  setElementData(player, "logedin", true) 
  local weapon = getElementData(player, "currentweapon_1") 
  if weapon then 
    local ammoData, weapID = getWeaponAmmoType(weapon) 
    giveWeapon(player, weapID, getElementData(player, ammoData), true) 
  end 
  local weapon = getElementData(player, "currentweapon_2") 
  if weapon then 
    local ammoData, weapID = getWeaponAmmoType(weapon) 
    giveWeapon(player, weapID, getElementData(player, ammoData), false) 
  end 
  local weapon = getElementData(player, "currentweapon_3") 
  if weapon then 
    local ammoData, weapID = getWeaponAmmoType(weapon) 
    giveWeapon(player, weapID, getElementData(player, ammoData), false) 
  end 
  setElementModel(player, getElementData(player, "skin")) 
  setElementData(player, "admin", getAccountData(account, "admin") or false) 
  setElementData(player, "supporter", getAccountData(account, "supporter") or false) 
  triggerClientEvent(player, "onClientPlayerDayZLogin", player) 
end 
addEvent("onPlayerDayZLogin", true) 
addEventHandler("onPlayerDayZLogin", getRootElement(), playerLogin) 
Skins = {} 

Link to comment
  • Moderators

Well, there is nothing wrong in this code (just some bad copied-pasted instructions that could be in a seperate function to make this code cleaner.

There can be 2 possibilities:

- Another resource is conflicting with the dayz spawn system.

- There is a code client-side that moves the player's camera. Try to check every functions that is "attached" with the event "onClientPlayerDayZLogin". But first try to comment the line 277:

triggerClientEvent(player, "onClientPlayerDayZLogin", player) 

and check if it solves the problem. If it doesn't then there are a lot of chances to be the 1st possibility.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...