'~DaLesTe^' Posted April 15, 2015 Share Posted April 15, 2015 Example: local resourceRoot = getResourceRootElement(getThisResource()) Levels = { ['1'] = 'Convidado', ['2'] = 'Membro', ['3'] = 'Comandante', ['4'] = 'Sub-Lider', ['5'] = 'Lider' } permissions = { ['Convidado'] = {}, ['Membro'] = {}, ['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 gangs[name] = {} gangs[name]['name'] = tostring(name) gangs[name]['tag'] = tostring(gangTag) gangs[name]['subLider'] = tostring(subLider) 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 onStart() call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Level",5,5,0.10) end addEventHandler("onResourceStart",resourceRoot,onStart) Gang Script: function criarGang ( source, commandName, teamName ) local getaMoney = getPlayerMoney (source) if teamName then if getaMoney <5000 then outputChatBox("#7d26cd[sERVER] #FF0000Você não tem dinheiro suficiente para criar uma gang valor 5000$",source,255,255,255,true) else if ( getPlayerTeam(source) ~= false ) and ( countPlayersInTeam(getPlayerTeam(source)) == 1 ) then destroyElement(getPlayerTeam(source)) outputChatBox("#F4A460[sERVER]#F08080 Sua gang antiga foi deletada e foi criada uma nova!",source,255,255,255,true) end local newTeam = createTeam ( teamName) if newTeam then takePlayerMoney (source,300 ) local getGang = getTeamName ( newTeam ) setTeamColor (newTeam,math.random(0,255), math.random(0,255), math.random(0,255)) setPlayerTeam ( source, newTeam ) local playerTeam = getPlayerTeam( source ) outputChatBox("#43CD80[GANG] #FFFFFFGang criada com sucesso!",source, 255, 255, 255, true) end end else outputChatBox("#43CD80[GANG] #FFFFFFUso correto: /gangcriar [nome]",source,255,255,255,true) end end addCommandHandler("gangcriar",criarGang) addEventHandler("onPlayerLogin",root,function() local team = getAccountData (getPlayerAccount(source), "team") if (team==getTeamName(getTeamFromName(team))) then setPlayerTeam(source, getTeamFromName(team)) end end) function save() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if not isGuestAccount(account) then if(team)then setAccountData(account, "team", getTeamName(team)) end end end addEventHandler("onPlayerLogout", root, save) addEventHandler("onPlayerQuit", root, save) function sairDaGang(source) local playerTeam = getPlayerTeam (source) if (playerTeam) then setPlayerTeam (source, nil) outputChatBox("#43CD80[GANG] #FFFFFFVocê saiu da gang",source,255,255,255,true) else outputChatBox("#43CD80[GANG] #ffffffVocê não tem gang",source,255,255,255,true) end end addCommandHandler("gangsair", sairDaGang) function desfazerGang (source) local playerVeri = getPlayerTeam (source) if (playerVeri) then destroyElement (playerVeri) outputChatBox("#43CD80[GANG] #FFFFFFVocê deletou sua gang",source,255,255,255,true) else outputChatBox("#43CD80[GANG] #FFFFFFVocê não tem gang",source,255,255,255,true) end end addCommandHandler("gangdeletar", desfazerGang) function enviarGang(source,cmd,targetPlayer) local target = getPlayerFromParticalName (targetPlayer) local geta = getPlayerFromName (target) gang = getPlayerTeam (source) local getName = getTeamFromName(source) lala = getTeamName(source) local convidado = true setElementData(target, "gangConvite", gang, false) if gang == getName then outputChatBox("#43CD80[GANG] #FFFFFFVocê não pertence a nenhuma gang",source, 255, 255, 255, true) else outputChatBox("#43CD80[GANG] #FFFFFFConvite de recrutamento enviado para "..targetPlayer,source, 255, 255, 255, true) outputChatBox("#FF0000[GANG] #AAAAAAVocê foi convidado para a gang #fff000" ..getTeamName(gang).. " #aaaaaa use #FFF000/gangaceitar #AAAAAApara entrar na Gang: #7d26cd "..getTeamName(gang),target, 255, 255, 255, true) end end addCommandHandler("gangconvidar", enviarGang) function Recrutamento(source) local gangConvite = getElementData(source, "gangConvite") if isElement(gangConvite) then outputChatBox("#43CD80[GANG] #FFFFFFVocê entrou na gang "..getTeamName(gang),source, 255, 255, 255, true) setPlayerTeam (source, gangConvite) else outputChatBox("#43CD80[GANG] #FFFFFFVocê não foi convidado para nenhuma gang",source, 255, 255, 255, true) end end addCommandHandler("gangaceitar",Recrutamento) function gangCommands(thePlayer) outputChatBox ( "#7d26cd[GANG] #ffffffUse /gangcriar ||sair|>Player<|aceitar|deletar|sair|convidar||", thePlayer, 255, 255, 255, true ) end addCommandHandler ( "gang", gangCommands ) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Link to comment
'~DaLesTe^' Posted April 15, 2015 Author Share Posted April 15, 2015 What's wrong with this? i would like to make could add a post to the gang member as / gangclass Leader / Commander / Member etc .. Link to comment
Enargy, Posted April 15, 2015 Share Posted April 15, 2015 What's wrong with this? i would like to make could add a post to the gang member as / gangclass Leader / Commander / Member etc .. we do not support resources stolen. Link to comment
'~DaLesTe^' Posted April 16, 2015 Author Share Posted April 16, 2015 Not a stolen resource 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