Jump to content

setPlayerTeam after Resource Restart


Senze

Recommended Posts

Posted

hey Guys the Problem is this when a player on my Server is allways in a team and restart the resource later.

The Playerteam will reset. I ve do something but nothings happen :/

maybe you can help me something :-)

function ResourceStop()
for k, player in ipairs(getElementsByType("player")) do
 
local acc = getAccount(getPlayerName(player))
if acc then
local playername = getPlayerName(player)
local team = getPlayerTeam(playername)
 
if team == lspd then
setAccountData(acc, "rpg.Team", lspd)
end
end
end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), ResourceStop)
 
function ResourceRestart()
for k, player in ipairs(getElementsByType("player")) do
 
local acc = getAccount(getPlayerName(player))
if acc then
local team = getAccountData(acc, "rpg.Team")
local playername = getPlayerName(player)
 
if team == lspd then
setPlayerTeam(player, lspd)
end
end
end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), ResourceRestart)

Posted

hey Guys the Problem is this when a player on my Server is allways in a team and restart the resource later.

The Playerteam will reset. I ve do something but nothings happen :/

maybe you can help me something :-)

function ResourceStop()
for k, player in ipairs(getElementsByType("player")) do
 
local acc = getAccount(getPlayerName(player))
if acc then
local playername = getPlayerName(player)
local team = getPlayerTeam(playername)
 
if team == lspd then
setAccountData(acc, "rpg.Team", lspd)
end
end
end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), ResourceStop)
 
function ResourceRestart()
for k, player in ipairs(getElementsByType("player")) do
 
local acc = getAccount(getPlayerName(player))
if acc then
local team = getAccountData(acc, "rpg.Team")
local playername = getPlayerName(player)
 
if team == lspd then
setPlayerTeam(player, lspd)
end
end
end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), ResourceRestart)

Posted

from what i can tell, you try to satisfy functions which require a player element with a string containing the players nick. getPlayerName is only useful for output functions like outputChatBox or dxDrawText. functions like getPlayerTeam expect your to give them the player element.

Posted

from what i can tell, you try to satisfy functions which require a player element with a string containing the players nick. getPlayerName is only useful for output functions like outputChatBox or dxDrawText. functions like getPlayerTeam expect your to give them the player element.

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