Jump to content

Gang


xeon17

Recommended Posts

Scripts is working good , but i got so much bugs any help please?

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() 
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[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) 
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[GANG]#F08080 Você não pertence a nenhuma gang",source, 255, 255, 255, true) 
else 
 outputChatBox("#F4A460[GANG]#F08080 Convite de recrutamento enviado para "..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 
addCommandHandler("gangconvite", enviarGang) 
  
function Recrutamento(source) 
 local gangConvite = getElementData(source, "gangConvite") 
 if isElement(gangConvite) then 
  outputChatBox("#F4A460[GANG]#F08080 Você entrou na gang "..getTeamName(gang),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) 
  

Bugs :

[2014-01-24 22:32:27] WARNING: GangPRO\server.lua:72: Bad argument @ 'getPlayerFromName' 
[2014-01-24 22:32:27] WARNING: GangPRO\server.lua:73: Bad argument @ 'getPlayerName' [Expected element at argument 1, got boolean] 
[2014-01-24 22:32:27] WARNING: GangPRO\server.lua:75: Bad argument @ 'getTeamFromName' 
[2014-01-24 22:32:27] WARNING: GangPRO\server.lua:76: Bad 'team' pointer @ 'getTeamName'(1) 
[2014-01-24 22:32:27] WARNING: GangPRO\server.lua:78: Bad argument @ 'setElementData' [Expected element at argument 1, got boolean] 
[2014-01-24 22:32:27] ERROR: GangPRO\server.lua:82: attempt to concatenate local 'targetPlayer' (a nil value) 
[2014-01-24 22:32:31] WARNING: GangPRO\server.lua:73: Bad argument @ 'getPlayerName' [Expected element at argument 1, got boolean] 
[2014-01-24 22:32:31] WARNING: GangPRO\server.lua:75: Bad argument @ 'getTeamFromName' 
[2014-01-24 22:32:31] WARNING: GangPRO\server.lua:76: Bad 'team' pointer @ 'getTeamName'(1) 
[2014-01-24 22:32:31] WARNING: GangPRO\server.lua:78: Bad argument @ 'setElementData' [Expected element at argument 1, got boolean] 
[2014-01-24 22:32:31] WARNING: GangPRO\server.lua:83: Bad argument @ 'outputChatBox' [Expected element at argument 2, got boolean] 
[2014-01-24 22:32:34] WARNING: GangPRO\server.lua:72: Bad argument @ 'getPlayerFromName' 
[2014-01-24 22:32:34] WARNING: GangPRO\server.lua:73: Bad argument @ 'getPlayerName' [Expected element at argument 1, got boolean] 
[2014-01-24 22:32:34] WARNING: GangPRO\server.lua:75: Bad argument @ 'getTeamFromName' 
[2014-01-24 22:32:34] WARNING: GangPRO\server.lua:76: Bad 'team' pointer @ 'getTeamName'(1) 
[2014-01-24 22:32:34] WARNING: GangPRO\server.lua:78: Bad argument @ 'setElementData' [Expected element at argument 1, got boolean] 
[2014-01-24 22:32:34] ERROR: GangPRO\server.lua:82: attempt to concatenate local 'targetPlayer' (a nil value) 

Link to comment
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 ) 

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