Wei Posted May 5, 2012 Posted May 5, 2012 whats wrong here ? function setTeam() local account = getPlayerAccount(source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName(team)) -- sets players team end end addEventHandler("onPlayerLogin",root,setTeam) -- sets players team on login function save() local team = getPlayerTeam(source) -- Gets the players team local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then -- Checks to see if the player is a guest or not setAccountData(account, "team", getTeamName(team)) --saves team end end addEventHandler("onPlayerQuit", getRootElement(), save) -- saves team on quit Diet with russian vodka, lose 3 days in one week !
Kenix Posted May 5, 2012 Posted May 5, 2012 All is good. I not see mistakes. You create teams? http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Wei Posted May 5, 2012 Author Posted May 5, 2012 Yeah Diet with russian vodka, lose 3 days in one week !
Castillo Posted May 5, 2012 Posted May 5, 2012 You've set the script as server side on meta.xml, right? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Kenix Posted May 5, 2012 Posted May 5, 2012 And what the problem? /debugscript 3 ? http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Wei Posted May 5, 2012 Author Posted May 5, 2012 You've set the script as server side on meta.xml, right? ofc. And no debug errors. Onli some errors from login panel... Diet with russian vodka, lose 3 days in one week !
Jaysds1 Posted May 6, 2012 Posted May 6, 2012 try this: addEventHandler("onPlayerLogin",root,function() local team = getAccountData (getPlayerAccount(source), "team") -- gets players team if (team==getTeamName(getTeamFromName(team))) then setPlayerTeam(source, getTeamFromName(team)) -- sets players team end end) -- sets players team on login function save() local team = getPlayerTeam(source) -- Gets the players team local account = getPlayerAccount(source) if not isGuestAccount(account) then -- Checks to see if the player is a guest or not if(team)then setAccountData(account, "team", getTeamName(team)) --saves team end end end addEventHandler("onPlayerLogout", root, save) -- saves team on logout addEventHandler("onPlayerQuit", root, save) -- saves team on quit My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
X-SHADOW Posted May 6, 2012 Posted May 6, 2012 Here Use My Script you'r free to edit it addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function() teamPolice = createTeam ( "Police", 0, 0, 255 ) teamFreeroamers = createTeam ( "Roberes", 255, 255, 0 ) for id, player in ipairs(getElementsByType("player")) do bindKey(player,"F3","down",teamP,"Police") bindKey(player,"F5","down",teamP,"Roberes") end end) function setTeam() local account = getPlayerAccount(source) local team = getAccountData (account, "team") if team and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName(team)) end end addEventHandler("onPlayerLogin",getRootElement(),setTeam) function saveTeam() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then setAccountData(account, "team", getTeamName(team)) end end addEventHandler("onPlayerQuit",getRootElement(),saveTeam) addEventHandler("onPlayerJoin",getRootElement(), function() bindKey(source,"F3","down",teamP,"Police") bindKey(source,"F5","down",teamP,"Roberes") end) function teamP(player,key,state,team) if team == "Police" then setPlayerTeam(player,teamPolice) elseif team == "Roberes" then setPlayerTeam(player,teamFreeroamers) end end My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
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