Jump to content

o q tem de errado nesse script?


Death

Recommended Posts

Não ta dando pra renomear a gang

não ta dando pra mudar a cor da gang e nem dá pra definir o lider da gang alguem pode ajudar.Obrigado :D

local connection = executeSQLQuery ( "CREATE TABLE IF NOT EXISTS gangs ( gangName TEXT, leader TEXT, color TEXT )" ) 
  
  
local cost = 20000 
local maxStr = 20 
  
function gangIsLeader ( uPlayer, uTeam ) 
    local select = executeSQLQuery ( "SELECT leader FROM gangs WHERE gangName = '" .. uTeam .. "' " ); 
    if ( select[1]["leader"] == uPlayer ) then 
        return true; 
    else 
        return false; 
    end 
end 
  
function gangSetLeader ( uTeam, uPlayer ) 
    executeSQLQuery ( "UPDATE gangs SET leader = '" .. uPlayer .. "' WHERE gangName = '" .. uTeam .. "' ") 
    return true 
end 
  
addCommandHandler ( 'gang', 
    function ( uPed, uCommand, uSub, uArg1, uArg2, uArg3, uArg4 ) 
        if ( uSub == 'criar' ) then 
            if ( not uArg1 ) then outputChatBox ( '#1e90ff[GANG] #ffffff- Syntax: /gang criar  [  ]', uPed, 255, 255, 255, true ); return end 
            if ( getPlayerMoney ( uPed ) < cost ) then 
                outputChatBox ( "#1e90ff[GANG] #ffffff- Você não tem dinheiro suficiente! Preço: $" .. cost, uPed, 255, 255, 255, true ); 
            elseif ( string.len ( uArg1 ) > maxStr ) then 
                outputChatBox ( "#1e90ff[GANG] #ffffff- O Nome da Gang nao pode ter mais de " .. maxStr .. " caracteres!", uPed, 255, 255, 255, true ); 
            else 
                if ( getPlayerTeam ( uPed ) ) then outputChatBox ( "#1e90ff[GANG] #ffffff- Voce ja esta em uma Gang!", uPed, 255, 255, 255, true ); return end 
                if ( not getTeamFromName ( uArg1 ) ) then 
                    createTeam ( uArg1, uArg2 or 255, uArg3 or 255, uArg4 or 255 ); 
                    setPlayerTeam ( uPed, getTeamFromName ( uArg1 ) ); 
                    outputChatBox ( '#1e90ff[GANG] #ffffff- Você criou a gang ' .. uArg1.. ' com suceso', uPed, 255, 255, 255, true ); 
                    takePlayerMoney ( uPed, cost ); 
                    if ( uArg2 and uArg3 and uArg4 ) then 
                        executeSQLQuery ( "INSERT INTO gangs VALUES ( '" .. uArg1 .. "', '" .. getPlayerName ( uPed ) .. "', '" .. uArg2 .. "," .. uArg3 .. "," .. uArg4 .. "' ") 
                    else 
                        executeSQLQuery ( "INSERT INTO gangs VALUES ( '" .. uArg1 .. "', '" .. getPlayerName ( uPed ) .. "', '255, 255, 255' ) ") 
                    end 
                end 
            end 
        end 
        if ( uSub == 'nome' ) then 
            if ( not getPlayerTeam ( uPed ) ) then return end 
            if ( not uArg1 or not uArg2 ) then outputChatBox ( '#1e90ff[GANG] #ffffff- Syntax: /gang nome ', uPed, 255, 255, 255, true ); return end 
            if ( not gangIsLeader ( getPlayerName(uPed), tostring ( uArg1 ) ) ) then outputChatBox ( "#1e90ff[GANG] #ffffff- Voce nao e o lider da Gang!", uPed, 255, 255, 255, true ); return end 
            outputChatBox ( '#1e90ff[GANG] #ffffff-Nome da gang atualizado para ' .. uArg1.. ' com sucesso', uPed, 255, 255, 255, true ); 
            setTeamName ( getTeamFromName ( getPlayerTeam ( uPed ) ), uArg1 ); 
        end 
        if ( uSub == 'cor' ) then 
            if ( not uArg1 or not uArg2 or not uArg3 ) then outputChatBox ( '#1e90ff[GANG] #ffffff-Syntax: /gang cor ', uPed, 255, 255, 255, true ); return end 
            setTeamColor ( getTeamFromName ( getPlayerTeam ( uPed ) ), uArg1, uArg2, uArg3 ); 
            outputChatBox ( '#1e90ff[GANG] #ffffff-Cor da gang atualizada para ' .. uArg1.. ' com sucesso', uPed, 255, 255, 255, true ); 
        end 
        if ( uSub == 'lider' ) then 
            if ( not getPlayerTeam ( uPed ) ) then outputChatBox ( "#1e90ff[GANG] #ffffff- Você não está em um Gang!", uPed, 255, 255, 255, true ); return end 
            if ( not uArg1 or not getPlayerFromName ( uArg1 ) ) then outputChatBox ( "#1e90ff[GANG] #ffffff- Syntax: /gang lider ", uPed, 255, 255, 255, true ); return end 
            if ( not getTeamName ( getPlayerTeam ( uArg1 ) ) == getTeamName ( getPlayerTeam ( uPed ) ) ) then outputChatBox ( "#1e90ff[GANG] #ffffff- Voce nao pode definir o lider com jogador de outra gangue!", uPed, 255, 255, 255, true ); return end 
            if ( not gangIsLeader ( getPlayerName ( uPed ), getTeamName ( getPlayerTeam ( uPed ) ) ) ) then outputChatBox ( "#1e90ff[GANG] #ffffffVoce nao e o lider da gang!", uPed, 255, 255, 255, true ); return end 
            gangSetLeader ( getTeamName ( getPlayerTeam ( uPed ) ), uArg1 ); 
            outputChatBox ( '#1e90ff[GANG] #ffffff-A gang 'getTeamName ( getPlayerTeam ( uPed ) ) ..'definiu' .. uArg1.. ' como lider da gang', uPed, 255, 255, 255, true ); 
        end 
        if ( uSub == 'convite' ) then 
                if ( not uArg1 ) then outputChatBox ( "#1e90ff[GANG] #ffffff- Syntax: /gang convite ", uPed, 255, 255, 255, true ); return end 
                if ( not getPlayerFromName ( uArg1 ) ) then outputChatBox ( "#1e90ff[GANG] #ffffff- Jogador nao encontrado!", uPed, 255, 255, 255, true ); return end 
                outputChatBox ( 'Voce convidou ' .. uArg1 .. '! Aguarde resposta.', uPed, 255, 255, 255, true ); 
                outputChatBox ( 'Voce foi convidado para ' .. getTeamName ( getPlayerTeam ( uPed ) ) .. ' por ' .. getPlayerName ( uPed ), getPlayerFromName ( uArg1 ), 255, 255, 255, true ); 
                addCommandHandler ( 'gang', 
                    function ( player, command, subCommand ) 
                        if ( subCommand == 'aceitar' ) then 
                            if ( getPlayerTeam ( uPed ) ) then 
                                setPlayerTeam ( player, getPlayerTeam ( uPed ) ); 
                                outputChatBox ( "Voce esta agora na Gang " .. getTeamName ( getPlayerTeam ( uPed ) ), player, 255, 255, 255, true ); 
                                outputChatBox ( getPlayerName ( player ) .. ' aceitou seu convite!', uPed, 255, 255, 255, true ); 
                            end 
                        elseif ( subCommand == 'recusar' ) then 
                            outputChatBox ( 'Voce recusou o convite de ' .. getPlayerName ( uPed ), player, 255, 255, 255, true ); 
                            outputChatBox ( getPlayerName ( player ) .. ' recusou seu convite!', uPed, 255, 255, 255, true ); 
                        end 
                    end 
                ) 
                setTimer ( 
                    function ( ) 
                        removeCommandHandler ( 'gang' ); 
                    end, 
                30000, 1 ) 
        end 
        if ( uSub == 'sair' ) then 
            outputChatBox ( getPlayerName ( player ) .. ' Saiu da gang', uPed, 255, 255, 255, true ); 
            if ( countPlayersInTeam ( getPlayerTeam ( uPed ) ) == 1 ) then 
                destroyElement ( getPlayerTeam ( uPed ) ); 
            end 
            setPlayerTeam ( uPed, nil ); 
        end 
    end 
) 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...