-
Posts
314 -
Joined
-
Last visited
Everything posted by gokalpfirat
-
Adopt-a-Resource: Update Abandoned Community Scripts
gokalpfirat replied to Ransom's topic in Scripting
Please update autoteams to 1.1 -
MTA:SA 1.1 Released: Harder, Better, Stronger, Faster
gokalpfirat replied to darkdreamingdan's topic in News
I think there should be a program or another thing that can change scripts to compaitable with 1.1 -
------------ -- 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
-
MTA:SA 1.1 Released: Harder, Better, Stronger, Faster
gokalpfirat replied to darkdreamingdan's topic in News
Someof servers decided dont change server to 1.1 -
When i start autoteams at 1.1 it doesnt works why?
-
MTA:SA 1.1 Released: Harder, Better, Stronger, Faster
gokalpfirat replied to darkdreamingdan's topic in News
update? -
MTA:SA 1.1 Released: Harder, Better, Stronger, Faster
gokalpfirat replied to darkdreamingdan's topic in News
I upgrade my server to 1.1 too. But voice chat is too laggy. When i close voice chat it is laggy again. And there is so much bugs for servers. And i cant see someof my scripts at resource browser. When i start some script like autoteams they dont work. Client is gooood. Server is wooorrst -
Which function takes screenshot in 1.1 ?
-
I cant try it because i get error and countdown not starts whem map opens.
-
When player wins it must write that if player team wins Team Name wins! Player Name is final survivor. But dont work
-
modes/destructionderby.lua function DestructionDerby:handleFinishActivePlayer(player) -- Update ranking board for player being removed if not self.rankingBoard then self.rankingBoard = RankingBoard:create() self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) end local timePassed = self:getTimePassed() self.rankingBoard:add(player, timePassed) -- Do remove finishActivePlayer(player) -- Update ranking board if one player left local activePlayers = getActivePlayers() if #activePlayers == 1 then if getPlayerTeam(activePlayers[1]) then local playersTeam = getPlayerTeam(activePlayers[1]) self.rankingBoard:add(activePlayers[1], timePassed) showMessage2(getTeamName(playersTeam).. ' win!', 0, 255, 0) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) else self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) end end util_server.lua g_Messages = {} -- { player = { display = display, textitem = textitem, timer = timer } } function showMessage(text, r, g, b, player) local ypos = 0.25 if not player then player = g_Root ypos = 0.35 end if g_Messages[player] then TimerManager.destroyTimersFor("message",player) else g_Messages[player] = { display = textCreateDisplay(), textitem = textCreateTextItem('', 0.5, ypos, 'medium', 255, 0, 0, 255, 3.0, 'center', 'center', 128) } end local display = g_Messages[player].display local textitem = g_Messages[player].textitem textDisplayAddText(display, textitem) textItemSetText(textitem, text) textItemSetColor(textitem, r or 255, g or 0, b or 0, 255) if player == g_Root then for i,player in ipairs(getElementsByType('player')) do textDisplayAddObserver(display, player) end else textDisplayAddObserver(display, player) end TimerManager.createTimerFor("raceresource","message",player):setTimer(destroyMessage, 8000, 1, player) end function showMessage2(text, r, g, b, player) local ypos = 0.25 if not player then player = g_Root ypos = 0.35 end if g_Messages[player] then TimerManager.destroyTimersFor("message",player) else g_Messages[player] = { display = textCreateDisplay(), textitem = textCreateTextItem('', 0.5, ypos+1, 'medium', 255, 0, 0, 255, 3.0, 'center', 'center', 128) } end local display = g_Messages[player].display local textitem = g_Messages[player].textitem textDisplayAddText(display, textitem) textItemSetText(textitem, text) textItemSetColor(textitem, r or 255, g or 0, b or 0, 255) if player == g_Root then for i,player in ipairs(getElementsByType('player')) do textDisplayAddObserver(display, player) end else textDisplayAddObserver(display, player) end TimerManager.createTimerFor("raceresource","message",player):setTimer(destroyMessage, 8000, 1, player) end Where is the problem and please fix
-
Now works Thanks
-
Hi. Which function in acl is allowing s.mod to get access Manage ACL?
-
Works but ":" is not my hex color.
-
When i use function hideJack(player,command,who,...) local targetPlayer = getPlayerFromName ( who ) local r, g, b = getPlayerNametagColor ( player ) local hexColor = string.format ( "#%02X%02X%02X", r, g, b ) if targetPlayer then local message = table.concat({...}, " ") outputChatBox(getPlayerName(targetPlayer )..""..hexcolor..":"..message ,root,255,255,255,true) end end addCommandHandler("yaziasda",hideJack) I get chat/server.lua:40 attempt to concetenate global 'hexcolor' (a nil value)
-
No i dont say it i say like in normal chat if your name is #ff0000JR10: Hi. And in normal chat ":"is your hex color in your name how can i do it for my code?
-
No no when normal players say somethin ":" is the players latest hex code color like my name #ff000Gokalp then : should #ff0000 how can i do this.
-
I found a one more problem how can i change the color of ":" to the players last hex code.
-
It works thanks ;D
-
I dont want to use full name. But i use getPlayerFromName