Jump to content

[HELP]


MaRcell

Recommended Posts

I'm good with a problem with my gang system when the player dies he leaves the gang o.O someone could help ?

function criarGang ( source, commandName, teamName ) 
local getaMoney =  getPlayerMoney (source) 
if teamName then 
if getaMoney <400000 then 
outputChatBox("#F4A460[sERVER]#F08080 Você não tem dinheiro suficiente para criar uma gang Valor 4.000$",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,400000 ) 
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("#F4A460[sERVER]#F08080 Gang criada com sucesso!! Valor 4.000$",source, 255, 255, 255, true) 
end 
end 
else 
outputChatBox("#F4A460[sERVER]#F08080 Uso correto: /fundargang [nome]",source,255,255,255,true) 
end 
end 
addCommandHandler("fundargang",criarGang) 
  
addEventHandler("onPlayerLogin",root,function() 
local team = getAccountData (getPlayerAccount(source), "team")  
if (team==getTeamName(getTeamFromName(team))) then 
setPlayerTeam(source, getTeamFromName(team))  
end 
end)  
  
    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("#F4A460[sERVER]#F08080 Você saiu da gang",source,255,255,255,true) 
else 
outputChatBox("#F4A460[sERVER]#F08080 Você não tem gang",source,255,255,255,true) 
end 
end 
addCommandHandler("abandonargang", sairDaGang) 
  
  
function desfazerGang (source) 
local playerVeri = getPlayerTeam (source) 
  
if (playerVeri) then 
  
destroyElement (playerVeri) 
outputChatBox("#F4A460[sERVER]#F08080 Você deletou sua gang",source,255,255,255,true) 
else 
outputChatBox("#F4A460[sERVER]#F08080 Você não tem gang",source,255,255,255,true) 
end 
end 
addCommandHandler("deletargang", desfazerGang) 
  
function enviarGang(source,cmd,targetPlayer) 
local target = getPlayerFromName (targetPlayer) 
local geta = getPlayerName (target) 
gang = getPlayerTeam (source) 
local getName = getTeamFromName(source) 
lala = getTeamName(source) 
local convidado = true 
setElementData(target, "gangConvite", gang, false) 
if gang == getName then 
 outputChatBox("#F4A460[sERVER]#F08080 Você não pertence a nenhuma gang",source, 255, 255, 255, true) 
else 
 outputChatBox("#F4A460[sERVER]#F08080 Convite de recrutamento enviado para "..targetPlayer,source, 255, 255, 255, true) 
 outputChatBox("#F4A460[sERVER]#F08080 Você foi convidado para o recrutamento digite /aceitargang Gang: "..getTeamName(gang),target, 255, 255, 255, true) 
 end 
end 
addCommandHandler("recrutargang", enviarGang) 
  
function Recrutamento(source) 
 local gangConvite = getElementData(source, "gangConvite") 
 if isElement(gangConvite) then 
  outputChatBox("#F4A460[sERVER]#F08080 Você entrou na gang "..getTeamName(gang),source, 255, 255, 255, true) 
  setPlayerTeam (source, gangConvite) 
 else 
  outputChatBox("#F4A460[sERVER]#F08080 Você não foi convidado para nenhuma gang",source, 255, 255, 255, true) 
 end 
end 
addCommandHandler("aceitargang",Recrutamento) 
  
  
  
  

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...