Jump to content

How to I change team color from xml


freudo

Recommended Posts

This is team create function

function clanKur(isim,tag,renk,r,g,b) 
    local acc = getPlayerAccount(source) 
    local cash = tonumber(getAccountData(acc,"cash")) 
    local clan = getAccountData(acc,"clan") 
    if clan ~= "0" then 
        outputChatBox("Clandan ayrilmadan clan kuramazsiniz.",source,255,0,0,true) 
    else 
        local ic = 0 
        local tc = 0 
        for _,v in ipairs(clans) do 
            if tostring(v.isim) == tostring(isim) then 
                ic=1 
            end 
  
            if tostring(v.tag) == tostring(tag) then 
                tc=1 
            end 
        end 
  
        if ic == 1 then 
            triggerClientEvent(source,"addNotification",getRootElement(),"Böyle bir clan ismi kullanılmakta!", 2) 
        elseif tc==1 then 
            triggerClientEvent(source,"addNotification",getRootElement(),"Böyle bir clan tagı kullanılmakta!", 2) 
        else 
         if cash >= ClanParaAlc then 
            local xml = xmlLoadFile("clans.xml") 
            local node = xmlCreateChild(xml,"clan") 
            xmlNodeSetAttribute(node,"isim",isim) 
            xmlNodeSetAttribute(node,"tag",tag) 
            xmlNodeSetAttribute(node,"r",r) 
            xmlNodeSetAttribute(node,"g",g) 
            xmlNodeSetAttribute(node,"b",b) 
            xmlNodeSetAttribute(node,"color",renk) 
                    setAccountData(acc, "money", cash-ClanParaAlc) 
            setAccountData(acc,"clan",tag) 
            setAccountData(acc,"clankurucu","1") 
            setAccountData(acc,"clanyetkili","1") 
            xmlSaveFile(xml) 
            outputChatBox("#31cccc* "..getPlayerName(source).." #31ccccadlı oyuncu #ff3333"..tag.." "..isim.." #31ccccclanını kurdu.",getRootElement(),0,255,0,true) 
            triggerClientEvent(source,"addNotification",getRootElement(),isim.. " adlı klan başarıyla kuruldu!", 1) 
            triggerClientEvent(source,"clanKapat",source) 
            local team = createTeam(tostring(isim),tonumber(r),tonumber(g),tonumber(b)) 
            table.insert ( clans,{["tag"]=tostring(tag),["isim"]=tostring(isim),["r"]=tonumber(r),["g"]=tonumber(g),["b"]=tonumber(b),["team"]=team}) 
            setPlayerTeam(source,team) 
            else 
            outputChatBox("You dont have money",source,255,0,0,true) 
        end 
        end 
  
    end 
end 
addEvent("clanKur",true) 
addEventHandler("clanKur",getRootElement(),clanKur) 

How to I add team color changer function?

Can you help me?

Link to comment

Yes, I want to change out of the game.

I add guiEdit and button.

function coDevamRenk(btn) 
    if btn == "left" then 
        local renk = guiGetText(renkedit) 
        local r,g,b = getColorFromString(renk) 
        triggerServerEvent("clanColor",getLocalPlayer(),renk,tostring(r),tostring(g),tostring(b)) -- I cant create color changer function. 
    end 
end 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...