E-mail Posted October 1, 2011 Share Posted October 1, 2011 Hi all iam Making Gang_War Gamemode But i have stuck on This Bug local teamPolice local teamRoberes function createTeamsOnStart () teamAdmin = createTeam ( "Police", 0, 0, 255 ) teamPlayers = createTeam ( "Roberes", 200, 255, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) function setteam(player) local account = getPlayerAccount(player) if not account or isGuestAccount(account) then setPlayerTeam ( player, teamRoberes ) return end local accName = getAccountName ( account) if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then setPlayerTeam ( player, teamPolice) else setPlayerTeam ( player, teamRoberes ) end end function timer() setTimer(setteam,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),timer) addEventHandler("onPlayerJoin",getRootElement(),timer) i want The Player Select The Team Like if you want To Be Police Press F3 and if you want to Be Robers Press F5 and Save His Team With Acconect Data Link to comment
bandi94 Posted October 1, 2011 Share Posted October 1, 2011 where is theam teamRoberes only you add local teamRoberes but don't creatated a team .. where is teamPolice again you aded only local teamPolice use bimdKey("keyname","down",function name) and getPlayerAccount() setAccountData() getAccountData() Link to comment
E-mail Posted October 1, 2011 Author Share Posted October 1, 2011 The Script .... Please Fix it if you can function createTeamsOnStart () teamPolice = createTeam ( "Police", 0, 0, 255 ) teamFreeroamers = createTeam ( "Roberes", 255, 255, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) 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",root,setTeam) function save(player) local team = getPlayerTeam(player) local account = getPlayerAccount(player) if (team) and not isGuestAccount(account) then setAccountData(account, "team", getTeamName(team)) end end addEventHandler("onPlayerquit",root,setTeam Link to comment
SpUnKyMe Posted October 1, 2011 Share Posted October 1, 2011 addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function() teamPolice = createTeam ( "Police", 0, 0, 255 ) teamFreeroamers = createTeam ( "Roberes", 255, 255, 0 ) 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,source,"F3") bindKey(source,"F5","down",teamP,source,"F5") end) function teamP(player,team) if team == "F3" then setPlayerTeam(player,teamPolice) elseif team == "F5" then setPlayerTeam(player,teamFreeroamers) end unbindKey(player,"F3","down",teamP) unbindKey(player,"F5","down",teamP) end Link to comment
E-mail Posted October 1, 2011 Author Share Posted October 1, 2011 it save the Team But if if press F3 or F5 dont Move to Team Link to comment
SpUnKyMe Posted October 1, 2011 Share Posted October 1, 2011 Did you reconnect after starting/restarting the script ? Link to comment
E-mail Posted October 1, 2011 Author Share Posted October 1, 2011 its work but i have to quit to set on Team i need it when i bind F3-F5 Move to team JustLike BaseMode ! Link to comment
TAPL Posted October 1, 2011 Share Posted October 1, 2011 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 Link to comment
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