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