bandi94 Posted September 3, 2011 Share Posted September 3, 2011 this 1.1 whit team is f******** no autoteams for 1.1 so i start to make my own but when i see this simpel script not work then the 1.1 the script make's the team and output in chat box the "ok" but to set player team no! no debug error or something Teams={{"Demonic God's Team","|DGT|","#0000ff"}, } function ResourceStart(p) for i,data in pairs(Teams) do if not isElement(data[1]) or getElementType(data[1]) ~= "team" then local team = createTeam(data[1], getColorFromString(data[3])) end if string.find ( getPlayerName(p),data[2]) then setPlayerTeam(p,team) outputChatBox("ok") end end end addCommandHandler("teama",ResourceStart) Link to comment
Castillo Posted September 3, 2011 Share Posted September 3, 2011 Teams={ {"Demonic God's Team", "|DGT|", "#0000ff"}, } function ResourceStart(p) for i,data in pairs(Teams) do if not isElement(data[1]) then team = createTeam(data[1], getColorFromString(data[3])) end if string.find ( getPlayerName(p),data[2]) then setPlayerTeam(p,team) outputChatBox("ok") end end end addCommandHandler("teama",ResourceStart) I think your main error was that you we're checking if the team name string was a "team", which is impossible because it was not an element. Link to comment
bandi94 Posted September 3, 2011 Author Share Posted September 3, 2011 thx Solidsnake14 its working Link to comment
bandi94 Posted September 3, 2011 Author Share Posted September 3, 2011 ok now i edited and gaian i am here is the par of script what not work the v returns the player from difrent function like on nickchange join quit ... now no error but again he don't set the team i put after setPlayeTeam output getTeamName(team) to see if he get the team and yes it output the team name so again the setPlayerTeam function gets stuck thx function check(v) for o,data in pairs(Teams) do if string.find(getPlayerName(v),data[2]) then if not isElement(data[1]) then createTeam(data[1], getColorFromString(data[3])) end local team = getTeamFromName(data[1]) setPlayerTeam( v , team) for p,b in pairs(getAttachedElements(v)) do if getElementType(b)=="blip" then setBlipColor ( b, getColorFromString(data[3])) end end else setPlayerTeam(v , nil) end end end Link to comment
Castillo Posted September 3, 2011 Share Posted September 3, 2011 function check(player) for o, data in pairs(Teams) do if not getTeamFromName(data[1]) then createTeam(data[1], getColorFromString(data[3])) end if string.find(getPlayerName(player), data[2]) then local team = getTeamFromName(data[1]) setPlayerTeam( player, team) for p,b in pairs(getAttachedElements(player)) do if getElementType(b)=="blip" then setBlipColor ( b, getColorFromString(data[3])) end end else setPlayerTeam(player, nil) end end end Link to comment
bandi94 Posted September 3, 2011 Author Share Posted September 3, 2011 thx i don't test again my script but i think that need to work or maybe not the problem was i use onResourceStart in paris for all players check(v) and only when next map start players get set in team's and bk that .. but thx Link to comment
bandi94 Posted September 3, 2011 Author Share Posted September 3, 2011 ok its working fine whit 1 team like Teams={ {"Demonic God's Team", "|DGT|", "#0000ff"}, } but when i add 2 team or not working or make just 1 team and put 60% player in it it miss up how can i fix it ? 2 teams like Teams={ {"Demonic God's Team", "|DGT|", "#0000ff"}, {"THQ", "|THQ|", "#ee00ff"}, } thx for all Link to comment
Castillo Posted September 3, 2011 Share Posted September 3, 2011 I don't understand what do you mean, I would put a timer to set teams, as the team may not be created before setPlayerTeam is executed, and that would return setting team to nil. Link to comment
bandi94 Posted September 3, 2011 Author Share Posted September 3, 2011 i mean when in Teams i put this Teams={{"Demonic God's Team", "|DGT|", "#0000ff"}} this is 1 team and works fine when i put 2 teams like this Teams={{"Demonic God's Team", "|DGT|", "#0000ff"}, {"THQ", "|THQ|", "#ee00ff"},} its stop working not creating the team's or creates only the secound THQ and put 60% if player on server but they haven't the tag in name i think now you got me Link to comment
Cadu12 Posted September 5, 2011 Share Posted September 5, 2011 Teams={{"Demonic God's Team", "%|DGT%|", "#0000ff"}, {"THQ", "%|THQ%|", "#ee00ff"}} Official topic: viewtopic.php?f=108&t=35477 Link to comment
bandi94 Posted September 6, 2011 Author Share Posted September 6, 2011 Cadu12 not working in that way but solved i make in a difrent database and its working i upload it to comunity Link to comment
Cadu12 Posted September 6, 2011 Share Posted September 6, 2011 Then what are you using gamemode? Link to comment
Cadu12 Posted September 6, 2011 Share Posted September 6, 2011 Dude, add this line: function onChangeRaceState(newStateName) if newStateName == "Running" then for _,player in ipairs(getElementsByType("player")) do checkPlayerTeam(player) end end end addEvent("onRaceStateChanging", true) addEventHandler( "onRaceStateChanging", getRootElement(), onChangeRaceState) Link to comment
bandi94 Posted September 7, 2011 Author Share Posted September 7, 2011 its not problem whit chek its problem to get the Team Data but i say a time and i say again i du it whit another database and working fine you can dowload it from comunity here is the link and pls close this topic https://community.multitheftauto.com/ind ... ls&id=2833 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