Senze Posted January 7, 2010 Posted January 7, 2010 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)
Senze Posted January 7, 2010 Author Posted January 7, 2010 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)
subenji99 Posted January 7, 2010 Posted January 7, 2010 https://wiki.multitheftauto.com/wiki/SetAccountData Syntax bool setAccountData ( account theAccount, string key, string value ) You're attempting to set (and later, compare to) an element not a string.
subenji99 Posted January 7, 2010 Posted January 7, 2010 https://wiki.multitheftauto.com/wiki/SetAccountData Syntax bool setAccountData ( account theAccount, string key, string value ) You're attempting to set (and later, compare to) an element not a string.
Dark Dragon Posted January 9, 2010 Posted January 9, 2010 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.
Dark Dragon Posted January 9, 2010 Posted January 9, 2010 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now