Jump to content

Sistema de gangues com tag e etc...


Recommended Posts

Eu tenho esse script de gangues que achei o melhor pois já joguei em servidores que possuía ele mas eu utilizo um sistema de tags por exemplo de níveis, começa lá em baixo com everyone e sobe para vip, Bope, ajudante, moderador... até console, mas quando dou /gangtag "nome da tag" o script simplesmente não faz nada, pelo que notei ele funciona normal pra criar a gang mas a tag não... Aqui o script de gang:  https://community.multitheftauto.com/index.php?p=resources&s=details&id=12014 e meu sistema de tags é esse http://mods-mta-online.blogspot.com.br/2014/09/tags-admin.html

Obrigado a todos que ajudarem eu agradeço de coração :3. É para meu servidor novo :3 (já montado mas sem gangs kk)

 

Link to comment
  • Other Languages Moderators

Amigo, creio que houve um equívoco. Você postou isso na sessão de Tutoriais.
A não ser que você esteja ensinando algo, esta não é a área correta para este post.
Se você quer ajuda com seu resource, favor postar em Programação em Lua e lá iremos lhe ajudar com quaisquer dúvidas que você tenha para melhorar seus resources.

Agradeço a compreensão.

Edited by Lord Henry
Link to comment
Quote

words = {}
SQLS3D = { qury = executeSQLQuery }
chatTime = {}
lastChatMessage = {}
addEventHandler("onPlayerChat", getRootElement(),
	function(text, msgtype, thePlayer)
    local account = getAccountName(getPlayerAccount(source))
    local name = getPlayerName(source)
    local root = getRootElement()
    local name = getPlayerName(source)
    local r,g,b = getPlayerNametagColor(source)
	local Account1 = getPlayerAccount ( source )
		local new = ""
		local iter = 0
		msg = string.gsub(text,"ـ","")
		for word in msg:gmatch("%S+") do
			iter = iter + 1
--			for i,swr in ipairs(words) do
--				local src = word:lower():gsub("%s","")
--				local src = src:gsub("#%x%x%x%x%x%x","")
--				local src = src:gsub("%c","")
--				local src = src:gsub("%p","")
--				local pat = swr:lower():gsub("%s","")
--				if src:find(pat) then
--					local replaceString = ""
--					for x=1,word:gsub("#%x%x%x%x%x%x",""):len() do
--						replaceString = replaceString.."*"
--					end
--					word = word:gsub(word,replaceString)
--				end
--			end
			if iter == 1 and word:len() > 0 then
				word = word:gsub("%a",string.upper,1)
			end
			new = new..word.." "
		end
		if new ~= "" then msg = new end
		text = msg
		if chatTime[source] and chatTime[source] + tonumber(1000) > getTickCount() then
			cancelEvent()
			outputChatBox("Espere 1 segundo para poder digitar novamente!", source, 255, 0, 0)
			return
		else
				chatTime[source] = getTickCount()
		end
		lastChatMessage[source] = text
		local r, g, b = getPlayerNametagColor(source)
		cancelEvent()
      if isObjectInACLGroup("user." .. account, aclGetGroup("Console")) then
	 cancelEvent(true)
        outputChatBox("#FFFF00★ #00FFFFDONO MDZ#FFFF00 ★" .. name ..":#00FF00 " .. text, root, 255, 255, 255, true)
        outputServerLog("CHAT: #595959|>|[ #00ffffDona#595959 ]|<| " .. name .. ": " .. text)
	
	elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then
		cancelEvent(true)
		outputChatBox("#000000>>>+[#FF0000ADMIN#000000]+<<<#FFFFFF "..name.." " .. text, root, 255, 255, 255, true)	

   elseif isObjectInACLGroup("user." .. account, aclGetGroup("SuperModerator")) then
		cancelEvent(true)
		outputChatBox("#000000$$$[#FFFF00*SMOD#000000]$$$#ffffff  " .. name ..": " .. text, root, 255, 255, 255, true)		
			
	elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then
		cancelEvent(true)
		outputChatBox("#FFFF00*MOD"..name..":#FFFF00 " .. text, root, 255, 255, 255, true)
		
	elseif isObjectInACLGroup("user." .. account, aclGetGroup("Ajudante")) then
		cancelEvent(true)
		outputChatBox("#1090E1AJUDANTE"..name..":#3F7A9F " .. text, root, 255, 255, 255, true)
				
	elseif isObjectInACLGroup("user." .. account, aclGetGroup("bope")) then
		cancelEvent(true)
		outputChatBox("#000000[#ff0000ƁØƤΣ#000000]"..name..":#FFFFFF " .. text, root, 255, 255, 255, true)
	
	elseif isObjectInACLGroup("user." .. account, aclGetGroup("Vip")) then
		cancelEvent(true)
		outputChatBox("#000000[#00ff00V#bebebe.#00ff00I#bebebe.#00ff00P#000000]#FFFFFF "..name.."#FFFFFF: " .. text, root, 255, 255, 255, true)
	
	elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then
	 cancelEvent(true)
		outputChatBox("#FFFFFF"..name..":#FFFFFF "..text, root, 255, 255, 255, true)
        outputServerLog("CHAT: " .. name .. ": " .. text)
		end
	end
	
)

 

-------------------------------------
---
--- Por '~FN|DaLesTe^'  
---
-------------------------------------

function getPlayerFromID(id)
return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id))
end
 
function getPlayerID(player)
return  getElementData(player,"id")
end
 
function criarGang ( source, commandName, ... )
local getaMoney =  getPlayerMoney (source)
local teamName = table.concat({...}, " ")
if teamName then
if getaMoney <300000 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 = getPlayerFromID (targetPlayer)
local geta = getPlayerFromID (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 o Jogador " ..getPlayerName(target).. " ID: "..targetPlayer,source, 255, 255, 255, true)
 outputChatBox("#43CD80[GANG] #FFFFFFVocê foi convidado para a gang #43CD80" ..getTeamName(gang).. " #FFFFFFuse #43CD80/gangaceitar #FFFFFFpara entrar na Gang: #ffffff "..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 | /gangcor CODE RGB | /gangtag | /gangconvidar ID/Nome | /gangabandonar | /gangsair | /gangdeletar", thePlayer, 255, 255, 255, true )
end
addCommandHandler ( "gang", gangCommands )

function gangName ( player, commandName, newName )
	local theTeam = getPlayerTeam ( player )
	setTeamName ( theTeam, newName )
	outputChatBox("A Gangue "..getTeamName(theTeam).." alterou o nome ["..newName.."]", root, 255, 0, 0)
end
addCommandHandler("gangnome", gangName )

function gangFarbe ( player, commandName, r, g, b )
	local team = getPlayerTeam ( player )
	setTeamColor ( team, r, g, b )
	outputChatBox("[INFO]  A gangue "..getTeamName(team).." alterou a cor da Gangue", source, 255, 255, 255, tonumber(r), tonumber(g), tonumber(b))
end
addCommandHandler("gangcor", gangFarbe )

addCommandHandler( "gangtag",
    function ( source, cmdname, tag )
        if tag and ( tag:len() > 3 or tag:len() == 0 ) then
            return outputChatBox("A tag deve ter no máximo 3 caracteres.", source, 230, 0, 0)
        end
        if getPlayerTeam(source) and tag then
            setPlayerName(source, "["..tag.."]"..getPlayerName(source))
        elseif not tag then
            outputChatBox("Sintaxe: /gangtag <tag da gangue>", source, 230, 0, 0)
        end
    end
)

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

 

Edited by VitorHHBR
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...