Jump to content

[Help] Script Not Work


Death

Recommended Posts

resourceRoot = getResourceRootElement ( getThisResource ( ) ) 
Niveis = {
    [ '1 ' ] = 'Convidado' ,
    [ '2 ' ] = 'Membro' ,
    [ '3 ' ] = 'Comandante' ,
    [ '4 ' ] = 'Sub-Lider ' ,
   [ '5 ' ] = 'Lider'
}
 
permissoes = {
   [ 'Convidado' ] = { } ,
   [ ' ] = { } ,
   ['Comandante'] = {},
   ['Sub-Lider'] = {},
   ['Lider'] = {}
}
 
xLevels = {
   ['Convidado'] = '1',
   ['Membro'] = '2',
   ['Comandante'] = '3',
   ['Sub-Lider'] = '4',
   ['Lider'] = '5'
}
 
local gangs = {}
local members = {}
 
local rootNode = xmlLoadFile("gangs.xml")
local children = xmlNodeGetChildren(rootNode)
if children == false then
   return
end
 
for _,node in pairs(children) do
   local attributes = xmlNodeGetAttributes(node)
   if attributes.name and attributes.colorR then
       local name = attributes.name
       local colorRed = attributes.colorR
       local colgangreen = attributes.colgang
       local colorBlue = attributes.colorB
       local gangTag = attributes.tag
       local sublider = attributes.sublider
       local skin = attributes.skin
       local baseName = attributes.baseName
 
       gangs[name] = {}
       gangs[name]['name'] = tostring(name)
       gangs[name]['baseName'] = tostring(baseName)
       gangs[name]['tag'] = tostring(gangTag)
       gangs[name]['subLider'] = tostring(subLider)
       gangs[name]['skin'] = skin
 
       gangs[name]['color'] = {}
       gangs[name]['color']['r'] = tostring(colorRed)
       gangs[name]['color']['g'] = tostring(colgangreen)
       gangs[name]['color']['b'] = tostring(colorBlue)
 
       --createTeam(name, tonumber(col[1]), tonumber(col[2]), tonumber(col[3]))
   end
end
 
local rootNodem = xmlLoadFile("members.xml")
local childrenm = xmlNodeGetChildren(rootNodem)
if childrenm == false then
   return
end
for _m,nodem in pairs(childrenm) do
   local attributesm = xmlNodeGetAttributes(nodem)
   if attributesm.gangName and attributesm.accName and attributesm.level then
       local accName = attributesm.accName
       local gangName = attributesm.gangName
       local accLevel = attributesm.level
 
       members[accName] = {}
 
       members[accName]['gangName'] = gangName
       members[accName]['level'] = accLevel
       members[accName]['accName'] = accName
   end
end
 
function getPlayerFromID(id)
return call(getResourceFromName("gameid"), "getPlayerFromID", tonumber(id))
end
 
function getPlayerID(player)
return  getElementData(player,"id")
end
 
function onStart()
   call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Level",5,5,0.10)
end
addEventHandler("onResourceStart",resourceRoot,onStart)
 
function gang (thePlayer,commandName,mode,playerid,...)
       if mode == "convidar" then
           if getPlayerTeam(thePlayer) then
               if playerid and getPlayerFromID(playerid) ~= thePlayer then
                   CONVITE = getElementData(getPlayerFromID(playerid),"CONVITE")
                   if CONVITE == false then
                       outputChatBox("Convite Enviado.",thePlayer)
                       outputChatBox("#A020F0[GANG] #ffffffVocê recebeu um convite para entrar na Gang "..getTeamName(getPlayerTeam(thePlayer)).."#00ff00! Digite /gang aceitar ou /gang recusar.",getPlayerFromID(playerid),255,255,255,true)
                       setElementData(getPlayerFromID(playerid),"CONVITE",true)
                       setElementData(getPlayerFromID(playerid),"GANGCONVITE",getPlayerTeam(thePlayer))
                       setElementData(getPlayerFromID(playerid),"PLAYERSENDCONVITE",thePlayer)
                       Timer = setTimer(function()
                           setElementData(thePlayer,"CONVITE",false)
                           removeElementData(getPlayerFromID(playerid),"GANGCONVITE")
                           removeElementData(getPlayerFromID(playerid),"PLAYERSENDCONVITE")
                           outputChatBox("#A020F0[GANG] #ffffffSeu Convite Expirou.",getPlayerFromID(playerid))
                           end,120000,1)
                   elseif CONVITE == true then
                       outputChatBox("#A020F0[GANG] #ffffffEsse jogador já recebeu um convite para juntar-se a Gang",thePlayer,255,255,255,true)
                   end
               end
           else
           outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)
           end
 
       elseif mode == "aceitar" then
           gang = getElementData(thePlayer,"GANGCONVITE")
           if gang then
               outputChatBox("#A020F0[GANG] #ffffffBem vindo a Gang "..getTeamName(gang),thePlayer,255,255,255,true)
               setPlayerTeam(thePlayer,gang)
               setElementData(thePlayer,"CONVITE",false)
               setElementData(thePlayer,"Level","Convidado")
               r,g,b = getTeamColor(gang)
               setPlayerNametagColor ( thePlayer, r, g, b )
               removeElementData(thePlayer,"GANGCONVITE")
               killTimer(Timer)
               for i,v in ipairs(getPlayersInTeam ( gang )) do
                   outputChatBox("#A020F0[GANG] #ffffff"..getPlayerName(thePlayer).." entrou em sua Gang: ("..Levels['1']..")",v,255,255,255,true)
               end
           else
               outputChatBox("#A020F0[GANG] #ffffffVocê não foi convidado para nenhuma Gang.",thePlayer,255,255,255,true)
           end
 
       elseif mode == "recusar" then
           gang = getElementData(thePlayer,"GANGCONVITE")
           if gang then
               playersend = getElementData(thePlayer,"PLAYERSENDCONVITE")
               outputChatBox("#A020F0[GANG] #ffffffVocê recusou o convite da Gang "..getTeamName(gang),thePlayer,255,255,255,true)
               outputChatBox("#A020F0[GANG] #ffffff"..getPlayerName(thePlayer).." recusou o seu convite para juntar-se a Gang",playersend,255,255,255,true)
               setElementData(thePlayer,"CONVITE",false)
               removeElementData(thePlayer,"GANGCONVITE")
               removeElementData(thePlayer,"PLAYERSENDCONVITE")
           else
               outputChatBox("#A020F0[GANG] #ffffffVocê não foi convidado para nenhuma Gang.",thePlayer,255,255,255,true)
           end
 
       elseif mode == "level" then
           if getPlayerTeam(thePlayer) then
               if playerid then
                   level = ...
                   if level then
                   setPlayerLevel(thePlayer,getPlayerFromID(playerid),level)
                   end
               end
           else
           outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)
           end
 
       elseif mode == "tag" then
           if getPlayerTeam(thePlayer) then
               if tonumber(xLevels[getAccountLevel(thePlayer)]) >= 3 then
                   if playerid then
                       tag = playerid
                       if tag:len() <= 4 then
                           setgangTag(thePlayer,getPlayerTeam(thePlayer),tag)
                           for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                               outputChatBox("#A020F0[GANG] #ffffffTag da gang setada para ["..tag.."] por "..getPlayerName(thePlayer),v,255,255,255,true)
                               setElementData(thePlayer,"gang.tag","["..tag.."]")
                           end
                       else
                           outputChatBox("#A020F0[GANG] #ffffff O Máximo permitido de letras são 4!",thePlayer,255,255,255,true)
                           return
                       end
                   else
                       outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang tag [tag]",thePlayer,255,255,255,true)
                   end
               else
                   outputChatBox("#A020F0[GANG] #ffffffSomente o Lider,Sub-Lider ou Comandante pode alterar a tag da Gang.",thePlayer,255,255,255,true)
               end
           else
               outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)setgangColor(gang,r,g,b)
           end
 
       elseif mode == "skin" then
           if getPlayerTeam(thePlayer) then
               if getPlayerMoney(thePlayer) >= 10000 then
                   if tonumber(xLevels[getAccountLevel(thePlayer)]) >= 3 then
                       if playerid then
                           skin = playerid
                           setgangSkin(getPlayerTeam(thePlayer),skin)
                           takeMoney(thePlayer,10000)
                           for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                               outputChatBox("#A020F0[GANG] #ffffffSkin da Gang setada para "..skin.." por "..getPlayerName(thePlayer),v,255,255,255,true)
                           end
                       else
                           outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang skin [skin]",thePlayer,255,255,255,true)
                       end
                   else
                       outputChatBox("#A020F0[GANG] #ffffffSomente o Lider,Sub-Lider ou Comandante pode alterar a skin da Gang.",thePlayer,255,255,255,true)
                   end
               else
                   outputChatBox("#A020F0[GANG] #ffffffÉ necessario $10k para mudar a cor da Gang.",thePlayer,255,255,255,true)
               end
           else
               outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)setgangColor(gang,r,g,b)
           end
 
       elseif mode == "cor" then
           if getPlayerTeam(thePlayer) then
               if getPlayerMoney(thePlayer) >= 20000 then
                   if tonumber(xLevels[getAccountLevel(thePlayer)]) >= 3 then
                       if playerid then
                           cor1 = playerid
                           color = { ... }
                           if color[1] and color[2] then
                               setgangColor(getPlayerTeam(thePlayer),cor1,color[1],color[2])
                               takeMoney(thePlayer,20000)
                           else
                           outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang cor [r] [g] [b] | Exemplo /gang cor 255 0 0 = #ff0000Vermelho.",thePlayer,255,255,255,true)
                           end
                           for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                               outputChatBox("[GANG] Cor da Gang setada por "..getPlayerName(thePlayer),v,cor1,color[1],color[2],true)
                           end
                       else
                           outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang cor [r] [g] [b] | Exemplo /gang cor 255 0 0 = #ff0000Vermelho.",thePlayer,255,255,255,true)
                       end
                   else
                       outputChatBox("#A020F0[GANG] #ffffffSomente o Lider,Sub-Lider ou Comandante pode alterar a cor da Gang.",thePlayer,255,255,255,true)
                   end
               else
                   outputChatBox("#A020F0[GANG] #ffffffÉ necessario $20k para mudar a cor da Gang.",thePlayer,255,255,255,true)
               end
           else
               outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)setgangColor(gang,r,g,b)
           end
 
       elseif mode == "kick" then
           if getPlayerTeam(thePlayer) then
               if playerid and ... and reason then
                   reason = table.concat({...}, " ")
                   if gangKickPlayer(thePlayer,getPlayerFromID(playerid)) then
                       for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                           outputChatBox(getPlayerName(getPlayerFromID(playerid)).." saiu da Gang. [KIKADO] (Motvio: "..reason..")",v,255,255,255,true)
                       end
                       outputChatBox("#A020F0[GANG] #ffffffVocê chutou o jogador "..getPlayerName(getPlayerFromID(playerid)).." da Gang.",thePlayer,255,255,255,true)
                       setElementData(getPlayerFromID(playerid),"ingangBought","false")
Link to comment

READ BEFORE POSTING IN SCRIPTING FORUM

and Look at line 12, just add " ' " :

  
    resourceRoot = getResourceRootElement ( getThisResource ( ) )
    Niveis = {
        [ '1 ' ] = 'Convidado' ,
        [ '2 ' ] = 'Membro' ,
        [ '3 ' ] = 'Comandante' ,
        [ '4 ' ] = 'Sub-Lider ' ,
       [ '5 ' ] = 'Lider'
    }
     
    permissoes = {
       [ 'Convidado' ] = { } ,
       [ ' '] = { } ,
       ['Comandante'] = {},
       ['Sub-Lider'] = {},
       ['Lider'] = {}
    }
     
    xLevels = {
       ['Convidado'] = '1',
       ['Membro'] = '2',
       ['Comandante'] = '3',
       ['Sub-Lider'] = '4',
       ['Lider'] = '5'
    }
     
    local gangs = {}
    local members = {}
     
    local rootNode = xmlLoadFile("gangs.xml")
    local children = xmlNodeGetChildren(rootNode)
    if children == false then
       return
    end
     
    for _,node in pairs(children) do
       local attributes = xmlNodeGetAttributes(node)
       if attributes.name and attributes.colorR then
           local name = attributes.name
           local colorRed = attributes.colorR
           local colgangreen = attributes.colgang
           local colorBlue = attributes.colorB
           local gangTag = attributes.tag
           local sublider = attributes.sublider
           local skin = attributes.skin
           local baseName = attributes.baseName
     
           gangs[name] = {}
           gangs[name]['name'] = tostring(name)
           gangs[name]['baseName'] = tostring(baseName)
           gangs[name]['tag'] = tostring(gangTag)
           gangs[name]['subLider'] = tostring(subLider)
           gangs[name]['skin'] = skin
     
           gangs[name]['color'] = {}
           gangs[name]['color']['r'] = tostring(colorRed)
           gangs[name]['color']['g'] = tostring(colgangreen)
           gangs[name]['color']['b'] = tostring(colorBlue)
     
           --createTeam(name, tonumber(col[1]), tonumber(col[2]), tonumber(col[3]))
       end
    end
     
    local rootNodem = xmlLoadFile("members.xml")
    local childrenm = xmlNodeGetChildren(rootNodem)
    if childrenm == false then
       return
    end
    for _m,nodem in pairs(childrenm) do
       local attributesm = xmlNodeGetAttributes(nodem)
       if attributesm.gangName and attributesm.accName and attributesm.level then
           local accName = attributesm.accName
           local gangName = attributesm.gangName
           local accLevel = attributesm.level
     
           members[accName] = {}
     
           members[accName]['gangName'] = gangName
           members[accName]['level'] = accLevel
           members[accName]['accName'] = accName
       end
    end
     
    function getPlayerFromID(id)
    return call(getResourceFromName("gameid"), "getPlayerFromID", tonumber(id))
    end
     
    function getPlayerID(player)
    return  getElementData(player,"id")
    end
     
    function onStart()
       call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Level",5,5,0.10)
    end
    addEventHandler("onResourceStart",resourceRoot,onStart)
     
    function gang (thePlayer,commandName,mode,playerid,...)
           if mode == "convidar" then
               if getPlayerTeam(thePlayer) then
                   if playerid and getPlayerFromID(playerid) ~= thePlayer then
                       CONVITE = getElementData(getPlayerFromID(playerid),"CONVITE")
                       if CONVITE == false then
                           outputChatBox("Convite Enviado.",thePlayer)
                           outputChatBox("#A020F0[GANG] #ffffffVocê recebeu um convite para entrar na Gang "..getTeamName(getPlayerTeam(thePlayer)).."#00ff00! Digite /gang aceitar ou /gang recusar.",getPlayerFromID(playerid),255,255,255,true)
                           setElementData(getPlayerFromID(playerid),"CONVITE",true)
                           setElementData(getPlayerFromID(playerid),"GANGCONVITE",getPlayerTeam(thePlayer))
                           setElementData(getPlayerFromID(playerid),"PLAYERSENDCONVITE",thePlayer)
                           Timer = setTimer(function()
                               setElementData(thePlayer,"CONVITE",false)
                               removeElementData(getPlayerFromID(playerid),"GANGCONVITE")
                               removeElementData(getPlayerFromID(playerid),"PLAYERSENDCONVITE")
                               outputChatBox("#A020F0[GANG] #ffffffSeu Convite Expirou.",getPlayerFromID(playerid))
                               end,120000,1)
                       elseif CONVITE == true then
                           outputChatBox("#A020F0[GANG] #ffffffEsse jogador já recebeu um convite para juntar-se a Gang",thePlayer,255,255,255,true)
                       end
                   end
               else
               outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)
               end
     
           elseif mode == "aceitar" then
               gang = getElementData(thePlayer,"GANGCONVITE")
               if gang then
                   outputChatBox("#A020F0[GANG] #ffffffBem vindo a Gang "..getTeamName(gang),thePlayer,255,255,255,true)
                   setPlayerTeam(thePlayer,gang)
                   setElementData(thePlayer,"CONVITE",false)
                   setElementData(thePlayer,"Level","Convidado")
                   r,g,b = getTeamColor(gang)
                   setPlayerNametagColor ( thePlayer, r, g, b )
                   removeElementData(thePlayer,"GANGCONVITE")
                   killTimer(Timer)
                   for i,v in ipairs(getPlayersInTeam ( gang )) do
                       outputChatBox("#A020F0[GANG] #ffffff"..getPlayerName(thePlayer).." entrou em sua Gang: ("..Levels['1']..")",v,255,255,255,true)
                   end
               else
                   outputChatBox("#A020F0[GANG] #ffffffVocê não foi convidado para nenhuma Gang.",thePlayer,255,255,255,true)
               end
     
           elseif mode == "recusar" then
               gang = getElementData(thePlayer,"GANGCONVITE")
               if gang then
                   playersend = getElementData(thePlayer,"PLAYERSENDCONVITE")
                   outputChatBox("#A020F0[GANG] #ffffffVocê recusou o convite da Gang "..getTeamName(gang),thePlayer,255,255,255,true)
                   outputChatBox("#A020F0[GANG] #ffffff"..getPlayerName(thePlayer).." recusou o seu convite para juntar-se a Gang",playersend,255,255,255,true)
                   setElementData(thePlayer,"CONVITE",false)
                   removeElementData(thePlayer,"GANGCONVITE")
                   removeElementData(thePlayer,"PLAYERSENDCONVITE")
               else
                   outputChatBox("#A020F0[GANG] #ffffffVocê não foi convidado para nenhuma Gang.",thePlayer,255,255,255,true)
               end
     
           elseif mode == "level" then
               if getPlayerTeam(thePlayer) then
                   if playerid then
                       level = ...
                       if level then
                       setPlayerLevel(thePlayer,getPlayerFromID(playerid),level)
                       end
                   end
               else
               outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)
               end
     
           elseif mode == "tag" then
               if getPlayerTeam(thePlayer) then
                   if tonumber(xLevels[getAccountLevel(thePlayer)]) >= 3 then
                       if playerid then
                           tag = playerid
                           if tag:len() <= 4 then
                               setgangTag(thePlayer,getPlayerTeam(thePlayer),tag)
                               for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                                   outputChatBox("#A020F0[GANG] #ffffffTag da gang setada para ["..tag.."] por "..getPlayerName(thePlayer),v,255,255,255,true)
                                   setElementData(thePlayer,"gang.tag","["..tag.."]")
                               end
                           else
                               outputChatBox("#A020F0[GANG] #ffffff O Máximo permitido de letras são 4!",thePlayer,255,255,255,true)
                               return
                           end
                       else
                           outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang tag [tag]",thePlayer,255,255,255,true)
                       end
                   else
                       outputChatBox("#A020F0[GANG] #ffffffSomente o Lider,Sub-Lider ou Comandante pode alterar a tag da Gang.",thePlayer,255,255,255,true)
                   end
               else
                   outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)setgangColor(gang,r,g,b)
               end
     
           elseif mode == "skin" then
               if getPlayerTeam(thePlayer) then
                   if getPlayerMoney(thePlayer) >= 10000 then
                       if tonumber(xLevels[getAccountLevel(thePlayer)]) >= 3 then
                           if playerid then
                               skin = playerid
                               setgangSkin(getPlayerTeam(thePlayer),skin)
                               takeMoney(thePlayer,10000)
                               for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                                   outputChatBox("#A020F0[GANG] #ffffffSkin da Gang setada para "..skin.." por "..getPlayerName(thePlayer),v,255,255,255,true)
                               end
                           else
                               outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang skin [skin]",thePlayer,255,255,255,true)
                           end
                       else
                           outputChatBox("#A020F0[GANG] #ffffffSomente o Lider,Sub-Lider ou Comandante pode alterar a skin da Gang.",thePlayer,255,255,255,true)
                       end
                   else
                       outputChatBox("#A020F0[GANG] #ffffffÉ necessario $10k para mudar a cor da Gang.",thePlayer,255,255,255,true)
                   end
               else
                   outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)setgangColor(gang,r,g,b)
               end
     
           elseif mode == "cor" then
               if getPlayerTeam(thePlayer) then
                   if getPlayerMoney(thePlayer) >= 20000 then
                       if tonumber(xLevels[getAccountLevel(thePlayer)]) >= 3 then
                           if playerid then
                               cor1 = playerid
                               color = { ... }
                               if color[1] and color[2] then
                                   setgangColor(getPlayerTeam(thePlayer),cor1,color[1],color[2])
                                   takeMoney(thePlayer,20000)
                               else
                               outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang cor [r] [g] [b] | Exemplo /gang cor 255 0 0 = #ff0000Vermelho.",thePlayer,255,255,255,true)
                               end
                               for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                                   outputChatBox("[GANG] Cor da Gang setada por "..getPlayerName(thePlayer),v,cor1,color[1],color[2],true)
                               end
                           else
                               outputChatBox("#A020F0[GANG] #ffffffUso correto. /gang cor [r] [g] [b] | Exemplo /gang cor 255 0 0 = #ff0000Vermelho.",thePlayer,255,255,255,true)
                           end
                       else
                           outputChatBox("#A020F0[GANG] #ffffffSomente o Lider,Sub-Lider ou Comandante pode alterar a cor da Gang.",thePlayer,255,255,255,true)
                       end
                   else
                       outputChatBox("#A020F0[GANG] #ffffffÉ necessario $20k para mudar a cor da Gang.",thePlayer,255,255,255,true)
                   end
               else
                   outputChatBox('#A020F0[GANG] #ffffffVocê não possui uma Gang!',thePlayer,255,255,255,true)setgangColor(gang,r,g,b)
               end
     
           elseif mode == "kick" then
               if getPlayerTeam(thePlayer) then
                   if playerid and ... and reason then
                       reason = table.concat({...}, " ")
                       if gangKickPlayer(thePlayer,getPlayerFromID(playerid)) then
                           for i,v in ipairs(getPlayersInTeam ( getPlayerTeam(thePlayer) )) do
                               outputChatBox(getPlayerName(getPlayerFromID(playerid)).." saiu da Gang. [KIKADO] (Motvio: "..reason..")",v,255,255,255,true)
                           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...