gokalpfirat Posted August 25, 2011 Share Posted August 25, 2011 When i start autoteams at 1.1 it doesnt works why? Link to comment
CapY Posted August 25, 2011 Share Posted August 25, 2011 try to use /upgrade function .. Link to comment
gokalpfirat Posted August 25, 2011 Author Share Posted August 25, 2011 I use it already Link to comment
gokalpfirat Posted August 25, 2011 Author Share Posted August 25, 2011 How you can fix? Link to comment
CapY Posted August 25, 2011 Share Posted August 25, 2011 I dont know , im still trying to fix it . Link to comment
gokalpfirat Posted August 26, 2011 Author Share Posted August 26, 2011 ------------ -- Events -- ------------ function playerJoined() check(source) end addEventHandler("onPlayerJoin",getRootElement(),playerJoined) function playerChangedNick(oldNick,newNick) -- Use timer to wait until the nick really has changed setTimer(check,1000,1,source) end addEventHandler("onPlayerChangeNick",getRootElement(),playerChangedNick) function playerQuit() removePlayerFromTeam(source) end addEventHandler("onPlayerQuit",getRootElement(),playerQuit) -- Check for ACL Groups on login/logout function loggedIn() check(source) end addEventHandler("onPlayerLogin",getRootElement(),loggedIn) function loggedOut() check(source) end addEventHandler("onPlayerLogout",getRootElement(),loggedOut) -- Holds the teams as defined in the settings local teams = {} --- -- Reads the settings and creates the teams if enabled. -- function initiate() local rootNode = getResourceConfig("config.xml") local children = xmlNodeGetChildren(rootNode) if children == false then return end for _,node in pairs(children) do local attributes = xmlNodeGetAttributes(node) local name = attributes.name local color = {getColorFromString(attributes.color)} if not color[1] then color = {255,255,255} end teams[name] = attributes teams[name].color = color if not toboolean(get("noEmptyTeams")) then teams[name].team = createTeam(name,unpack(color)) end end for k,v in pairs(getElementsByType("player")) do check(v) end end addEventHandler("onResourceStart",getResourceRootElement(),initiate) --------------- -- Functions -- --------------- --- -- Checks the player's nick and ACL Groups and sets his team if necessary. -- -- @param player player: The player element -- function check(player) if not isElement(player) or getElementType(player) ~= "player" then debug("No player") return end local nick = getPlayerName(player) local accountName = getAccountName(getPlayerAccount(player)) for name,data in pairs(teams) do local tagMatch = false local aclGroupMatch = false if data.tag ~= nil and string.find(nick,data.tag,1,true) then tagMatch = true end if data.aclGroup ~= nil and accountName and isObjectInACLGroup("user."..accountName,aclGetGroup(data.aclGroup)) then aclGroupMatch = true end if data.required == "both" then if tagMatch and aclGroupMatch then addPlayerToTeam(player,name) return end else if tagMatch or aclGroupMatch then addPlayerToTeam(player,name) return end end end removePlayerFromTeam(player) setPlayerTeam(player,nil) end --- -- Adds a player to the team appropriate for the name. -- It is not checked if the team is really defined in the table, since -- it should only be called if it is. -- -- Creates the team if it doesn't exist. -- -- @param player player: The player element -- @param string name: The name of the team -- function addPlayerToTeam(player,name) local team = teams[name].team if not isElement(team) or getElementType(team) ~= "team" then team = createTeam(teams[name].name,unpack(teams[name].color)) teams[name].team = team end setPlayerTeam(player,team) debug("Added player '"..getPlayerName(player).."' to team '"..name.."'") end --- -- Removes a player from a team. Also checks if any team -- needs to be removed. -- -- @param player player: The player element -- function removePlayerFromTeam(player) setPlayerTeam(player,nil) debug("Removed player '"..getPlayerName(player).."' from team") if toboolean(get("noEmptyTeams")) then for k,v in pairs(teams) do local team = v.team if isElement(team) and getElementType(team) == "team" then if countPlayersInTeam(team) == 0 then destroyElement(team) end end end end end --- -- Converts a string-boolean into a boolean. -- -- @param string string: The string (e.g. "false") -- @return true/false Returns false if the string is "false" or evaluates to false (nil/false), true otherwise -- function toboolean(string) if string == "false" or not string then return false end return true end ----------- -- Debug -- ----------- -- Little debug function to turn on/off debug setElementData(getResourceRootElement(),"debug",true) function debug(string) if getElementData(getResourceRootElement(),"debug") then outputDebugString("autoteams: "..string) end end This is the normal code but what i must change for be compaitable with 1.1 Link to comment
bandi94 Posted August 26, 2011 Share Posted August 26, 2011 i have same problem and some script not working in MTA 1.1 and the admin panel gives a laot of warnings (original admin panel what comes whit MTA 1.1) so the 1.1 ver is the best .. somebody can fix the auteams and the admin panel ghis guiSetText Warning Link to comment
bandi94 Posted August 26, 2011 Share Posted August 26, 2011 on debugscript 3 its shows removed player form team added player to team but no team in tab or admin panel under setTeam i haved some problems whit geoip after i encoded it to UTF-8 its works tryed whit autoteams but not worked and no error on debug script 3 somebody succeed to fix it or has some idea where is the problem ? Link to comment
Killerbee_x. Posted August 28, 2011 Share Posted August 28, 2011 Anyone already succeeded? Link to comment
bandi94 Posted August 28, 2011 Share Posted August 28, 2011 hmm tuday MTA get an pach whit name gui skin and team bugs fixed so i think it was a MTA 1.1 bug not autoteam problem i can't test it i need to whait the host to update the server for the new pach Link to comment
bandi94 Posted August 28, 2011 Share Posted August 28, 2011 i am not shure but i think is a MTA 1.1 team bug not script error/bug bk i check some server what befor have team's .. and not this autoteams resource and now they haven't team so i think is an MTA 1.1 bug(game don;t create set team's for players ) Link to comment
SDK Posted August 28, 2011 Share Posted August 28, 2011 It's fixed already, http://code.google.com/p/mtasa-blue/sou ... ail?r=3091 Link to comment
Ant4rt1c Posted August 29, 2011 Share Posted August 29, 2011 It's fixed already, http://code.google.com/p/mtasa-blue/sou ... ail?r=3091 i don't understand you '-' what i need to do? Link to comment
Cadu12 Posted August 29, 2011 Share Posted August 29, 2011 (edited) I did created myself it toady and works Tags = { {"%=FoX%=", "=FoX= Members", "#770000", nil}, {"%|T%|", "Testing Members", "#555555", nil}, {"%[FG%]", "[FG] Members", "#770000", nil} } function onResourceStartAutoteams() for name, data in ipairs(Tags) do --outputChatBox(" TEST: " .. name .. " " .. data[1] .. " " .. data[2] ) -- This is only for Test for id, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player), data[1]) then --outputChatBox( "Founded: " .. getPlayerName(players) .. " as " .. data[2]) -- This is only for Test if not isElement(data[2]) or getElementType(data[2]) ~= "team" then creatingTeam = createTeam( data[2], getColorFromString ( data[3] ) ) if creatingTeam then outputDebugString( "Autoteams: Added team '" .. data[2] .. "'." ) data[4] = creatingTeam end end setTimer(function() for name, data in ipairs(Tags) do for id, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player), data[1]) then movedteam = setPlayerTeam ( player, data[4] ) if not movedteam then MoveToTeam = getTeamFromName( data[2] ) outputDebugString( "Autoteams: Set '" .. getPlayerName(player) .. "' to team as '" .. data[2] .. "'." ) setPlayerTeam ( player, MoveToTeam ) return end outputDebugString( "Autoteams: Set '" .. getPlayerName(player) .. "' to team as '" .. data[2] .. "'." ) end end end end, 1000, 1) end end end end addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStartAutoteams ) function onPlayerChangeNickAutoteams() setTimer(checkPlayerTeam, 1000, 1, source) end addEventHandler("onPlayerChangeNick", getRootElement(), onPlayerChangeNickAutoteams) function onPlayerJoinAutoteams() setTimer(checkPlayerTeam, 1000, 1, source) end addEventHandler( "onPlayerJoin", getRootElement(), onPlayerJoinAutoteams ) function onPlayerQuitAutoteams() -- Remove teams if players are not team returnPlayerTeam = getPlayerTeam( source ) if returnPlayerTeam then setPlayerTeam( source, nil ) if countPlayersInTeam(returnPlayerTeam) == 0 then destroyElement(returnPlayerTeam) end end end addEventHandler( "onPlayerQuit", getRootElement(), onPlayerQuitAutoteams ) function checkPlayerTeam(player) local publicplayer = player for name, data in ipairs(Tags) do if string.find(getPlayerName(player), data[1]) then if not isElement(data[4]) or getElementType(data[4]) ~= "team" then creatingTeam = createTeam( data[2], getColorFromString ( data[3] ) ) if creatingTeam then outputDebugString( "Autoteams: Added team '" .. data[2] .. "'." ) data[4] = creatingTeam end end setTimer(function() for name, data in ipairs(Tags) do if string.find(getPlayerName(player), data[1]) then movedteam = setPlayerTeam ( publicplayer, data[4] ) if not movedteam then MoveToTeam = getTeamFromName( data[2] ) outputDebugString( "Autoteams: Set '" .. getPlayerName(publicplayer) .. "' to team as '" .. data[2] .. "'." ) setPlayerTeam ( publicplayer, MoveToTeam ) return end outputDebugString( "Autoteams: Set '" .. getPlayerName(publicplayer) .. "' to team as '" .. data[2] .. "'." ) end end end, 2000, 1) else -- Remove teams if players are not team returnPlayerTeam = getPlayerTeam( player ) if returnPlayerTeam then setPlayerTeam( player, nil ) if countPlayersInTeam(returnPlayerTeam) == 0 then destroyElement(returnPlayerTeam) end end end end end Add credis if you used Edited August 29, 2011 by Guest Link to comment
SnoopCat Posted August 29, 2011 Share Posted August 29, 2011 this is clien side or server side? Link to comment
CapY Posted August 29, 2011 Share Posted August 29, 2011 Not working , it's a server side. Link to comment
Cadu12 Posted August 29, 2011 Share Posted August 29, 2011 (edited) @SnoopCat Its server side @Capy: [FG] -> %[FG%] Tags = { {"%=FoX%=", "=FoX= Members", "#770000", nil}, {"%|T%|", "Testing Members", "#555555", nil} {"%[FG%]", "[FG] Members", "#770000", nil}, } Edited August 29, 2011 by Guest Link to comment
Cadu12 Posted August 29, 2011 Share Posted August 29, 2011 Edit: Fixed, it was string.find bugged, copy again my post Edit2: WTF IS THAT BUGGED, I did pressed "Edit" then he made post Link to comment
CapY Posted August 29, 2011 Share Posted August 29, 2011 Works on Play resource ? Wait .. the teams list is seen on Scoreboard and tag in Chatbox ? Link to comment
Cadu12 Posted August 29, 2011 Share Posted August 29, 2011 Yes and, What do you mean? if you mean chat tag "[FG]Capy"? if yes then yes if you have any ideas, viewtopic.php?f=108&t=35477 Link to comment
Ant4rt1c Posted August 29, 2011 Share Posted August 29, 2011 TY for the script but you can't just fix the another? this lack some things and it's hard to use 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