Jump to content

Ajuda com script


Death

Recommended Posts

Preciso de ajuda com um script tipo quero colocar armas e veiculos especiais numa gangzona e quero que so a gang que dominou a gangzona possa pegar ja ta pronta as gangzonas areas de gang e etc so preciso saber como fazer o script para que as armas e veiculos seja da gang que dominar a gangzona. grato a quem me ajudar :D

local gotArea = false 
local area = { } 
local theArea = { } 
  
local gangZones = { 
    ['Idlewood'] = { lx = '2082.80542', by = '-1680.55737', x = '100', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['The Strip'] = { lx = '2073.0205078125', by = '977.7392578125', x = '150', y = '140', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['The High Roller'] = { lx = '1837.7880859375', by = '1283.57421875', x = '200', y = '150', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Prickle Pine'] = { lx = '1779.185546875', by = '2588.5498046875', x = '150', y = '70', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['The emerald isle'] = { lx = '2035.6689453125', by = '2203.5849609375', x = '90', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Redsands West'] = { lx = '1572.6806640625', by = '2278.0654296875', x = '150', y = '105', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Restricted Area'] = { lx = '97.1474609375', by = '1810.4609375', x = '300', y = '400', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Las Barrancas'] = { lx = '-739.9501953125', by = '1512.8017578125', x = '60', y = '70', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Downtown'] = { lx = '-1961.099609375', by = '1086.1806640625', x = '100', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Calton Heights'] = { lx = '-2133.96484375', by = '905.4677734375', x = '120', y = '50', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Doherty'] = { lx = '-2149.521484375', by = '114.1318359375', x = '160', y = '200', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Santa Maria Beach'] = { lx = '164.44921875', by = '-1883.685546875', x = '130', y = '130', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Richman'] = { lx = '279.5078125', by = '-1254.232421875', x = '100', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Rodeo'] = { lx = '475.87109375', by = '-1575.8994140625', x = '80', y = '120', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Marina'] = { lx = '668.58984375', by = '-1734.75390625', x = '90', y = '270', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Vinewood'] = { lx = '732.2734375', by = '-1400.37890625', x = '75', y = '70', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Market'] = { lx = '1058.390625', by = '-1285.640625', x = '100', y = '150', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Verdant Bluffs'] = { lx = '1211.4580078125', by = '-2076.1806640625', x = '100', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Willowfield'] = { lx = '1966.9111328125', by = '-2110.3642578125', x = '200', y = '140', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Los Santos International'] = { lx = '2056.7900390625', by = '-2412.576171875', x = '100', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Ocean Docks'] = { lx = '2385.2265625', by = '-2671.23046875', x = '200', y = '200', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['East Beach'] = { lx = '2642.80859375', by = '-1513.5625', x = '90', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Ganton'] = { lx = '2452.4921875', by = '-1687.8232421875', x = '40', y = '40', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Palomino Creek'] = { lx = '2217.69921875', by = '-111.955078125', x = '300', y = '300', r = '0', g = '0', b = '0', a = '180', visible = root }; 
    ['Ocean Flats'] = { lx = '-2701.412109375', by = '-65.107421875', x = '100', y = '100', r = '0', g = '0', b = '0', a = '180', visible = root }; 
} 
  
local areas = { 
    ['Idlewood'] = { x = '2082.80542', y = '-1680.55737', width = '100', height = '100', visible = root }; 
    ['The Strip'] = { x = '2073.0205078125', y = '977.7392578125', width = '150', height = '140', visible = root }; 
    ['The High Roller'] = { x = '1837.7880859375', y = '1283.57421875', width = '200', height = '150', visible = root }; 
    ['Prickle Pine'] = { x = '1779.185546875', y = '2588.5498046875', width = '150', height = '70', visible = root }; 
    ['The emerald isle'] = { x = '2035.6689453125', y = '2203.5849609375', width = '90', height = '100', visible = root }; 
    ['Redsands West'] = { x = '1572.6806640625', y = '2278.0654296875', width = '150', height = '105', visible = root }; 
    ['Restricted Area'] = { x = '97.1474609375', y = '1810.4609375', width = '300', height = '400', visible = root }; 
    ['Las Barrancas'] = { x = '-739.9501953125', y = '1512.8017578125', width = '60', height = '70', visible = root }; 
    ['Downtown'] = { x = '-1961.099609375', y = '1086.1806640625', width = '100', height = '100', visible = root }; 
    ['Calton Heights'] = { x = '-2133.96484375', y = '905.4677734375', width = '120', height = '50', visible = root }; 
    ['Doherty'] = { x = '-2149.521484375', y = '114.1318359375', width = '160', height = '200', visible = root }; 
    ['Santa Maria Beach'] = { x = '164.44921875', y = '-1883.685546875', width = '130', height = '130', visible = root }; 
    ['Richman'] = { x = '279.5078125', y = '-1254.232421875', width = '100', height = '100', visible = root }; 
    ['Rodeo'] = { x = '475.87109375', y = '-1575.8994140625', width = '80', height = '120', visible = root }; 
    ['Marina'] = { x = '668.58984375', y = '-1734.75390625', width = '90', height = '270', visible = root }; 
    ['Vinewood'] = { x = '732.2734375', y = '-1400.37890625', width = '75', height = '70', visible = root }; 
    ['Market'] = { x = '1058.390625', y = '-1285.640625', width = '100', height = '150', visible = root }; 
    ['Verdant Bluffs'] = { x = '1211.4580078125', y = '-2076.1806640625', width = '100', height = '100', visible = root }; 
    ['Willowfield'] = { x = '1966.9111328125', y = '-2110.3642578125', width = '200', height = '140', visible = root }; 
    ['Los Santos International'] = { x = '2056.7900390625', y = '-2412.576171875', width = '100', height = '100', visible = root }; 
    ['Ocean Docks'] = { x = '2385.2265625', y = '-2671.23046875', width = '200', height = '200', visible = root }; 
    ['East Beach'] = { x = '2642.80859375', y = '-1513.5625', width = '90', height = '100', visible = root }; 
    ['Ganton'] = { x = '2452.4921875', y = '-1687.8232421875', width = '40', height = '40', visible = root }; 
    ['Palomino Creek'] = { x = '2217.69921875', y = '-111.955078125', width = '300', height = '300', visible = root }; 
    ['Ocean Flats'] = { x = '-2701.412109375', y = '-65.107421875', width = '100', height = '100', visible = root }; 
} 
  
addEventHandler ( 'onResourceStart', resourceRoot, 
    function ( ) 
        for _, zone in pairs ( gangZones ) do 
            area[_] = createRadarArea ( zone.lx, zone.by, zone.x, zone.y, zone.r, zone.g, zone.b, zone.a, zone.visible ); 
        end 
  
        for _, area in pairs ( areas ) do 
            theArea[_] = createColRectangle ( area.x, area.y, area.width, area.height ); 
            addEventHandler ( 'onColShapeHit', theArea[_], onHitGangZone ); 
            addEventHandler ( 'onColShapeLeave', theArea[_], onLeaveGangZone ); 
        end 
    end 
) 
  
function onHitGangZone ( player ) 
    if ( isPedInVehicle ( player ) ) then outputChatBox ( 'Você não pode ficar nesta área, com um veículo!', player, 255, 255, 255, false ); return end 
    if ( not getPlayerTeam ( player ) ) then return end 
            local x, y, z = getElementPosition ( player ); 
            local zone = getZoneName ( x, y, z, false ); 
            zon = zone:gsub ( ' ', '-' ) 
            list = xmlLoadFile ( "list.xml" ); 
            node = xmlFindChild ( list, zon, 0 ); 
            triggerClientEvent ( 'onAnnChange', root, getPlayerName ( player ) .. ' está atacando a zona: ' .. zone  ); 
            setRadarAreaFlashing ( area[zone], true ); 
            colorTimer = setTimer ( 
                function ( ) 
                    setRadarAreaColor ( area[zone], math.random ( 0, 255 ), math.random ( 0, 255 ), math.random ( 0, 255 ) ); 
                end, 
            950, 0 ) 
            if ( getTeamName ( getPlayerTeam ( player ) ) ~= tostring ( xmlNodeGetValue ( node ) ) ) then 
                i = 180 
                outputChatBox ( 'Em 3 minutos, a área será sua. Se você for morto, tente novamente.', player, 255, 255, 255 ); 
                timer = setTimer ( 
                    function ( ) 
                        i = i - 1 
                        triggerClientEvent ( 'onAnnChange', root, i .. ' segundos para dominar a ' .. getPlayerName ( player ) .. ' | Area: ' .. zone ); 
                        if ( i == 0 ) then 
                        killTimer ( timer ) 
                        triggerClientEvent ( 'onAnnChange', root, getPlayerName ( player ) .. " tem a área'" .. zone .. "'" ); 
                        local r, g, b = getTeamColor ( getPlayerTeam ( player )) 
                        killTimer ( colorTimer ); 
                        setRadarAreaFlashing ( area[zone], false ); 
                        setRadarAreaColor ( area[zone], r, g, b, 200 ); 
                        gotArea = true 
                        xmlNodeSetValue ( node, getTeamName ( getPlayerTeam ( player ) ) ); 
                        xmlSaveFile ( list ) 
                        end 
                    end, 
                1000, 0 ) 
            --end 
    end 
end 
  
function onLeaveGangZone ( player ) 
    if ( isTimer ( colorTimer ) ) then killTimer ( colorTimer ); end 
    if ( isTimer ( timer ) ) then killTimer ( timer ) end 
    if ( not gotArea ) then 
        local x, y, z = getElementPosition ( player ) 
        local c = getZoneName ( x, y, z, false ); 
        setRadarAreaColor ( area[c], gangZones[c].r, gangZones[c].g, gangZones[c].b, gangZones[c].a ); 
        setRadarAreaFlashing ( area[c], false ); 
        triggerClientEvent ( 'onAnnChange', root, 'No new announcements' ); 
        gotArea = false 
    else 
        setRadarAreaFlashing ( area[c], false ); 
        triggerClientEvent ( 'onAnnChange', root, 'No new announcements' ); 
    end 
end 
  

Edited by Guest
Link to comment

Heh, my old gay GangWar code! xD

Esse código aí que eu fiz, ele não tem essas paradas não, é so o básico de área do radar + uns eventos quando entra na área.. Ele nem salva as áreas que os team pego.. Tem que mudar muito aí.

O melhor é você fazer um do zero pois esse código é antigo e muito mal programado.

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

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