Jump to content

Where is the problem?


SteeLRO

Recommended Posts

clanPlayers[] = {  
    "3R//",  
    "Name2",  
    "Name3"  
}  
  
local colorCodeRed[] = {255,0,0}  
local colorCodeGreen[] = {0,255,0}  
local colorCodeBlue[] = {0,0,255}  
  
setTimer(function()  
    if isInClan(source) == true then  
        setPlayerName(source,"3R//"..getPlayerName(source))    
    end   
end,1000,0)  
  
function isInClan(player)   
    local name = getPlayerName(player)  
    for i,v in ipairs (clanPlayers) do  
        if name == clanPlayers[1] then  
            return true  
        end  
    end  
    return false  
end   

Link to comment

I'm not sure, but this "[]" isn't needed at all.

    clanPlayers = { 
        "3R//", 
        "Name2", 
        "Name3" 
    } 
      
    local colorCodeRed = {255,0,0} 
    local colorCodeGreen = {0,255,0} 
    local colorCodeBlue = {0,0,255} 
      
    setTimer(function() 
        if isInClan(source) == true then 
            setPlayerName(source,"3R//"..getPlayerName(source))   
        end   
    end,1000,0) 
      
    function isInClan(player)   
        local name = getPlayerName(player) 
        for i,v in ipairs (clanPlayers) do 
            if name == clanPlayers[1] then 
                return true 
            else return false end 
        end 
    end   

Link to comment
  • Moderators
clanPlayers[] = {  
    "3R//",  
    "Name2",  
    "Name3"  
}  
  
local colorCodeRed[] = {255,0,0}  
local colorCodeGreen[] = {0,255,0}  
local colorCodeBlue[] = {0,0,255}  
  
setTimer(function()  
    if isInClan(source) == true then  
        setPlayerName(source,"3R//"..getPlayerName(source))    
    end   
end,1000,0)  
  
function isInClan(player)   
    local name = getPlayerName(player)  
    for i,v in ipairs (clanPlayers) do  
        if name == clanPlayers[1] then  
            return true  
        end  
    end  
    return false  
end   

Ok lol so first, it's not a proper way to ask help to a community ... For me it's just like if you threw your dirty clothes on your mom face to make her wash them. You would never do that so it's the same here. It's really disrespectfull. Even if you don't speak in english well, it's easy to say something like: "Hello everyone, I have a problem with my code. I want to add the clantag "3R//" to the players in my list if they don't have it yet. Here is the code:"

And only after said that you can paste your code between lua tags and also give us the errors from the server console or from /debugscript 3 (you need to be logged in) if there are any.

That said, I saw your script and I think I understood what you were trying to do. So here is it:

local clanTag = "3R//" 
local clanPlayers = { 
    "Name1", 
    "Name2", 
    "Name3" 
} 
  
local colorCodeRed = {255, 0, 0} 
local colorCodeGreen = {0, 255, 0} 
local colorCodeBlue = {0, 0, 255} 
  
setTimer(function() 
    for k, player in ipairs (getElementsByType("player")) do 
        if isInClan(player) and not hasClanTag(player) then 
            setPlayerName(player, clanTag..getPlayerName(player))   
        end 
    end 
end, 5000, 0) 
  
function hasClanTag(player)   
    local name = getPlayerName(player) 
    if name and string.find(name, clanTag) then 
        return true 
    end 
    return false 
end   
  
function isInClan(player) 
    local name = getPlayerName(player) or "" 
    for i, v in ipairs (clanPlayers) do 
        if name == clanPlayers[i] then 
            return true 
        end 
    end 
    return false 
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...