Jump to content

Why the player doesnt spawn ?


iFoReX

Recommended Posts

Posted

why the player doesnt spawn when I activate the resource ?

----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onResourceStart",resourceRoot,function(thePlayer) 
local acc = getAccountName(getPlayerAccount(thePlayer)) 
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
local posX = getAccountData(thePlayer,"PosX") 
local posY = getAccountData(thePlayer,"PosY") 
local posZ = getAccountData(thePlayer,"PosZ") 
local Skin = getAccountData(thePlayer,"Skin") 
local dim = getAccountData(thePlayer,"Dimension") 
local int = getAccountData(thePlayer,"Int") 
local theTeam = getTeamFromName("Admin") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(thePlayer,247.04785, 1860.30615, 14.08401,0,282,0,0,getPlayerTeam(theTeam)) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(thePlayer,posX,posY,posZ,0,Skin,dim,int,theTeam) 
end 
elseif not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
local theTeamE = getTeamFromName("Todos") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(thePlayer,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(thePlayer,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
end 
end 
end 
) 
  
addEventHandler("onPlayerQuit",root,function() 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
      local posX,PosY,PosZ = getElementPosition(source) 
      setAccountData(source,"PosX",posX) 
      setAccountData(source,"PosY",posY) 
      setAccountData(source,"PosZ",posZ) 
      local skin = getElementModel(source) 
      setAccountData(source,"Skin",skin) 
      local dim = getElementDimension(source) 
      setAccountData(source,"Dimension",dim) 
      local int = getElementInterior(source) 
      setAccountData(source,"Int",int) 
    end 
end 
) 

Posted

Where is set 'accName' variable? I only see 'acc'. Try to rename it.

local acc = getAccountName(getPlayerAccount(thePlayer)) -- acc 
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then --accName ???? 

Posted

Again doesnt work :/

----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onResourceStart",resourceRoot,function(thePlayer) 
local acc = getAccountName(getPlayerAccount(thePlayer)) 
if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then 
local posX = getAccountData(thePlayer,"PosX") 
local posY = getAccountData(thePlayer,"PosY") 
local posZ = getAccountData(thePlayer,"PosZ") 
local Skin = getAccountData(thePlayer,"Skin") 
local dim = getAccountData(thePlayer,"Dimension") 
local int = getAccountData(thePlayer,"Int") 
local theTeam = getTeamFromName("Admin") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(thePlayer,247.04785, 1860.30615, 14.08401,0,282,0,0,getPlayerTeam(theTeam)) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(thePlayer,posX,posY,posZ,0,Skin,dim,int,theTeam) 
end 
elseif not isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then 
local theTeamE = getTeamFromName("Todos") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(thePlayer,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(thePlayer,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
end 
end 
end 
) 
  
addEventHandler("onPlayerQuit",root,function() 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
      local posX,PosY,PosZ = getElementPosition(source) 
      setAccountData(source,"PosX",posX) 
      setAccountData(source,"PosY",posY) 
      setAccountData(source,"PosZ",posZ) 
      local skin = getElementModel(source) 
      setAccountData(source,"Skin",skin) 
      local dim = getElementDimension(source) 
      setAccountData(source,"Dimension",dim) 
      local int = getElementInterior(source) 
      setAccountData(source,"Int",int) 
    end 
end 
) 

Posted

What is the console saying? Any errors? Warnings? Your variable thePlayer in the first function is not declared too. I suppose that the error is because of trying to get the account from some variable 'thePlayer' which is not declared like I said. If you want to spawn player upon his connecting to the server then you should use 'onPlayerJoin' or 'onPlayerLogin' events instead of 'onResourceStart'. But if you want to spawn him on your resource starts then I advice you to go through your all alive players in order to spawn them. Use lua loop for that.

Posted
----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onPlayerLogin",root,function(thePlayer) 
local acc = getAccountName(getPlayerAccount(thePlayer)) 
if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then 
local posX = getAccountData(thePlayer,"PosX") 
local posY = getAccountData(thePlayer,"PosY") 
local posZ = getAccountData(thePlayer,"PosZ") 
local Skin = getAccountData(thePlayer,"Skin") 
local dim = getAccountData(thePlayer,"Dimension") 
local int = getAccountData(thePlayer,"Int") 
local theTeam = getTeamFromName("Admin") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(thePlayer,247.04785, 1860.30615, 14.08401,0,282,0,0,getPlayerTeam(theTeam)) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(thePlayer,posX,posY,posZ,0,Skin,dim,int,theTeam) 
end 
elseif not isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then 
local theTeamE = getTeamFromName("Todos") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(thePlayer,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(thePlayer,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
end 
end 
end 
) 
  
addEventHandler("onPlayerQuit",root,function() 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
      local posX,PosY,PosZ = getElementPosition(source) 
      setAccountData(source,"PosX",posX) 
      setAccountData(source,"PosY",posY) 
      setAccountData(source,"PosZ",posZ) 
      local skin = getElementModel(source) 
      setAccountData(source,"Skin",skin) 
      local dim = getElementDimension(source) 
      setAccountData(source,"Dimension",dim) 
      local int = getElementInterior(source) 
      setAccountData(source,"Int",int) 
    end 
end 
) 
  

doesnt work :/

Posted

You code is not enough. Try this one:

----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onPlayerLogin",root,function() 
local acc = getAccountName(getPlayerAccount(source)) 
if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then 
local posX = getAccountData(source,"PosX") 
local posY = getAccountData(source,"PosY") 
local posZ = getAccountData(source,"PosZ") 
local Skin = getAccountData(source,"Skin") 
local dim = getAccountData(source,"Dimension") 
local int = getAccountData(source,"Int") 
local theTeam = getTeamFromName("Admin") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(source,247.04785, 1860.30615, 14.08401,0,282,0,0,getPlayerTeam(theTeam)) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeam) 
end 
elseif not isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then 
local theTeamE = getTeamFromName("Todos") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
end 
end 
end 
) 
  
addEventHandler("onPlayerQuit",root,function() 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
      local posX,PosY,PosZ = getElementPosition(source) 
      setAccountData(source,"PosX",posX) 
      setAccountData(source,"PosY",posY) 
      setAccountData(source,"PosZ",posZ) 
      local skin = getElementModel(source) 
      setAccountData(source,"Skin",skin) 
      local dim = getElementDimension(source) 
      setAccountData(source,"Dimension",dim) 
      local int = getElementInterior(source) 
      setAccountData(source,"Int",int) 
    end 
end 
) 

Posted

Try this

----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onPlayerLogin",root,function() 
local acc = getPlayerAccount(source) 
if isObjectInACLGroup ("user."..tostring(acc), aclGetGroup ( "Admin" ) ) then 
local posX = getAccountData(acc,"PosX") 
local posY = getAccountData(acc,"PosY") 
local posZ = getAccountData(acc,"PosZ") 
local Skin = getAccountData(acc,"Skin") 
local dim = getAccountData(acc,"Dimension") 
local int = getAccountData(acc,"Int") 
local theTeam = getTeamFromName("Admin") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(source,247.04785, 1860.30615, 14.08401,0,282,0,0,getPlayerTeam(theTeam)) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeam) 
end 
elseif not isObjectInACLGroup ("user."..tostring(acc), aclGetGroup ( "Admin" ) ) then 
local theTeamE = getTeamFromName("Todos") 
if not posX and not posY and not posZ and not Skin and not dim and not int then 
spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
elseif posX and posY and posZ and Skin and dim and int then 
spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
end 
end 
end 
) 
  
addEventHandler("onPlayerQuit",root,function() 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
      local posX,PosY,PosZ = getElementPosition(source) 
      setAccountData(playeraccount,"PosX",posX) 
      setAccountData(playeraccount,"PosY",posY) 
      setAccountData(playeraccount,"PosZ",posZ) 
      local skin = getElementModel(source) 
      setAccountData(playeraccount,"Skin",skin) 
      local dim = getElementDimension(source) 
      setAccountData(playeraccount,"Dimension",dim) 
      local int = getElementInterior(source) 
      setAccountData(playeraccount,"Int",int) 
    end 
end 
) 
  

Posted

ElMota, Lonely4's code should work because I messed up account with player in my example. That's what happens if you're trying to edit someone's code not in-game :? And that's why I asked you to show your server log.

I appear in Mount chilliad and doesnt set the team :/

Change this line:

spawnPlayer(source,247.04785, 1860.30615, 14.08401,0,282,0,0,getPlayerTeam(theTeam)) 

To this:

spawnPlayer(source,247.04785, 1860.30615, 14.08401,0,282,0,0,theTeam) 

Posted

try

----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onPlayerLogin",root,function(_,acc) 
     local accName = getAccountName(acc) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          local posX = getAccountData(acc,"PosX") 
          local posY = getAccountData(acc,"PosY") 
          local posZ = getAccountData(ac,"PosZ") 
          local Skin = getAccountData(acc,"Skin") 
          local dim = getAccountData(acc,"Dimension") 
          local int = getAccountData(acc,"Int") 
          local theTeam = getTeamFromName("Admin") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,247.04785, 1860.30615, 14.08401,0,282,0,0,theTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeam) 
          end 
     else 
          local theTeamE = getTeamFromName("Todos") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
          end 
     end 
end) 
  
addEventHandler("onPlayerQuit",root,function() 
      local playeraccount = getPlayerAccount(source) 
      if (playeraccount) and not isGuestAccount(playeraccount) then 
           local posX,PosY,PosZ = getElementPosition(source) 
           setAccountData(playeraccount,"PosX",posX) 
           setAccountData(playeraccount,"PosY",posY) 
           setAccountData(playeraccount,"PosZ",posZ) 
           local skin = getElementModel(source) 
           setAccountData(playeraccount,"Skin",skin) 
           local dim = getElementDimension(source) 
           setAccountData(playeraccount,"Dimension",dim) 
           local int = getElementInterior(source) 
           setAccountData(playeraccount,"Int",int) 
     end 
end) 

Posted

I appear in team Todos I doesnt appear in team Admin :/

----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onPlayerLogin",root,function(_,acc) 
     local accName = getAccountName(acc) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          local posX = getAccountData(acc,"PosX") 
          local posY = getAccountData(acc,"PosY") 
          local posZ = getAccountData(ac,"PosZ") 
          local Skin = getAccountData(acc,"Skin") 
          local dim = getAccountData(acc,"Dimension") 
          local int = getAccountData(acc,"Int") 
          local theTeam = getTeamFromName("Admin") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,247.04785, 1860.30615, 14.08401,0,282,0,0,theTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeam) 
          end 
     else 
          local theTeamE = getTeamFromName("Todos") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
          end 
     end 
end) 
  
addEventHandler("onPlayerQuit",root,function() 
     local playeraccount = getPlayerAccount (source) 
      if (playeraccount) and not isGuestAccount(playeraccount) then 
           local posX,PosY,PosZ = getElementPosition(source) 
           setAccountData(playeraccount,"PosX",posX) 
           setAccountData(playeraccount,"PosY",posY) 
           setAccountData(playeraccount,"PosZ",posZ) 
           local skin = getElementModel(source) 
           setAccountData(playeraccount,"Skin",skin) 
           local dim = getElementDimension(source) 
           setAccountData(playeraccount,"Dimension",dim) 
           local int = getElementInterior(source) 
           setAccountData(playeraccount,"Int",int) 
     end 
end) 
  

Posted

Ook Now I appear in admin team but I spawn in SF background :/

----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onPlayerLogin",root,function(_,acc) 
fadeCamera(source,true) 
setCameraTarget(source) 
     local accName = getAccountName(acc) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          local posX = getAccountData(acc,"PosX") 
          local posY = getAccountData(acc,"PosY") 
          local posZ = getAccountData(acc,"PosZ") 
          local Skin = getAccountData(acc,"Skin") 
          local dim = getAccountData(acc,"Dimension") 
          local int = getAccountData(acc,"Int") 
          local theTeam = getTeamFromName("Admin") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,theTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeam) 
          end 
     else 
          local theTeamE = getTeamFromName("Todos") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
          end 
     end 
end) 
  
addEventHandler("onPlayerQuit",root,function() 
     local playeraccount = getPlayerAccount (source) 
      if (playeraccount) and not isGuestAccount(playeraccount) then 
           local posX,PosY,PosZ = getElementPosition(source) 
           setAccountData(playeraccount,"PosX",posX) 
           setAccountData(playeraccount,"PosY",posY) 
           setAccountData(playeraccount,"PosZ",posZ) 
           local skin = getElementModel(source) 
           setAccountData(playeraccount,"Skin",skin) 
           local dim = getElementDimension(source) 
           setAccountData(playeraccount,"Dimension",dim) 
           local int = getElementInterior(source) 
           setAccountData(playeraccount,"Int",int) 
     end 
end) 
  
addEventHandler("onPlayerWasted",root,function(_,acc,killer) 
if killer ~= acc then 
local accName = getAccountName(acc) 
if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,theTeam) 
elseif not isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
end 
end 
end 
) 
  

Posted
----SPAWN-System-By-ElMota--- 
  
createTeam("Admin",180,0,0) 
createTeam("Todos",0,180,0) 
addEventHandler("onPlayerLogin",root,function(_,acc) 
fadeCamera(source,true) 
setCameraTarget(source) 
     local accName = getAccountName(acc) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          local posX = getAccountData(acc,"PosX") 
          local posY = getAccountData(acc,"PosY") 
          local posZ = getAccountData(acc,"PosZ") 
          local Skin = getAccountData(acc,"Skin") 
          local dim = getAccountData(acc,"Dimension") 
          local int = getAccountData(acc,"Int") 
          local theTeam = getTeamFromName("Admin") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,theTeam) 
          end 
     else 
          local theTeamE = getTeamFromName("Todos") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,theTeamE) 
          end 
     end 
end) 
  
addEventHandler("onPlayerQuit",root,function() 
     local playeraccount = getPlayerAccount (source) 
      if (playeraccount) and not isGuestAccount(playeraccount) then 
           local posX,PosY,PosZ = getElementPosition(source) 
           setAccountData(playeraccount,"PosX",posX) 
           setAccountData(playeraccount,"PosY",posY) 
           setAccountData(playeraccount,"PosZ",posZ) 
           local skin = getElementModel(source) 
           setAccountData(playeraccount,"Skin",skin) 
           local dim = getElementDimension(source) 
           setAccountData(playeraccount,"Dimension",dim) 
           local int = getElementInterior(source) 
           setAccountData(playeraccount,"Int",int) 
     end 
end) 
  
addEventHandler("onPlayerWasted",root,function(_,acc,killer) 
if killer ~= acc then 
local accName = getAccountName(acc) 
if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,theTeam) 
elseif not isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,theTeamE) 
end 
end 
end 
) 

Posted
----SPAWN-System-By-ElMota--- 
  
AdminTeam = createTeam("Admin",180,0,0) 
TodosTeam = createTeam("Todos",0,180,0) 
  
addEventHandler("onPlayerLogin",root,function(_,acc) 
fadeCamera(source,true) 
setCameraTarget(source) 
     local accName = getAccountName(acc) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          local posX = getAccountData(acc,"PosX") 
          local posY = getAccountData(acc,"PosY") 
          local posZ = getAccountData(acc,"PosZ") 
          local Skin = getAccountData(acc,"Skin") 
          local dim = getAccountData(acc,"Dimension") 
          local int = getAccountData(acc,"Int") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,AdminTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,AdminTeam) 
          end 
     else 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,TodosTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,dim,int,TodosTeam) 
          end 
     end 
end) 
  
addEventHandler("onPlayerQuit",root,function() 
     local playeraccount = getPlayerAccount (source) 
      if (playeraccount) and not isGuestAccount(playeraccount) then 
           local posX,PosY,PosZ = getElementPosition(source) 
           setAccountData(playeraccount,"PosX",posX) 
           setAccountData(playeraccount,"PosY",posY) 
           setAccountData(playeraccount,"PosZ",posZ) 
           local skin = getElementModel(source) 
           setAccountData(playeraccount,"Skin",skin) 
           local dim = getElementDimension(source) 
           setAccountData(playeraccount,"Dimension",dim) 
           local int = getElementInterior(source) 
           setAccountData(playeraccount,"Int",int) 
     end 
end) 
  
addEventHandler("onPlayerWasted",root,function(_,killer) 
     local accName = getAccountName(getPlayerAccount(source)) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,AdminTeam) 
     else 
          spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,AdminTeam) 
     end 
end) 

Posted
when I login I appear in sf background, but when I dead I appear in the good positions c:

i think this is what were saved at the account data.

get a good position when you quit, and when you login you will be at it.

Posted

So, you saved the positions and when you quit and login/join, you spawn in the same position but not in the position you want to spawn in?

Posted

Fixed

----SPAWN-System-By-ElMota--- 
  
AdminTeam = createTeam("Admin",180,0,0) 
TodosTeam = createTeam("Todos",0,180,0) 
  
addEventHandler("onPlayerLogin",root,function(_,acc) 
fadeCamera(source,true) 
setCameraTarget(source) 
     local accName = getAccountName(acc) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          local posX = getAccountData(acc,"PosX") 
          local posY = getAccountData(acc,"PosY") 
          local posZ = getAccountData(acc,"PosZ") 
          local Skin = getAccountData(acc,"Skin") 
          local dim = getAccountData(acc,"Dimension") 
          local int = getAccountData(acc,"Int") 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,AdminTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,int,dim,AdminTeam) 
          end 
     else 
          if not posX and not posY and not posZ and not Skin and not dim and not int then 
               spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,TodosTeam) 
          elseif posX and posY and posZ and Skin and dim and int then 
               spawnPlayer(source,posX,posY,posZ,0,Skin,int,dim,TodosTeam) 
          end 
     end 
end) 
  
addEventHandler("onPlayerQuit",root,function() 
     local playeraccount = getPlayerAccount (source) 
      if (playeraccount) and not isGuestAccount(playeraccount) then 
           local posX,PosY,PosZ = getElementPosition(source) 
           setAccountData(playeraccount,"PosX",PosX) 
           setAccountData(playeraccount,"PosY",PosY) 
           setAccountData(playeraccount,"PosZ",PosZ) 
           local skin = getElementModel(source) 
           setAccountData(playeraccount,"Skin",skin) 
           local dim = getElementDimension(source) 
           setAccountData(playeraccount,"Dimension",dim) 
           local int = getElementInterior(source) 
           setAccountData(playeraccount,"Int",int) 
     end 
end) 
  
addEventHandler("onPlayerWasted",root,function(_,killer) 
     local accName = getAccountName(getPlayerAccount(source)) 
     if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
          spawnPlayer(source,247.00835, 1859.81372, 14.08401,0,282,0,0,AdminTeam) 
     else 
          spawnPlayer(source,-342.89999389648,1541.8000488281,74.900001525879,0,16,0,0,AdminTeam) 
     end 
end) 

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...