Jump to content

[Help] Spawn


xeon17

Recommended Posts

local Hydra = createVehicle ( 520, 951.7998046875,2132.1005859375,20.60000038147,0,0,283.74938964844 ) 

function respawnVehicle ( ) 
spawnVehicle ( Hydra, 951.7998046875,2132.1005859375,20.60000038147,0,0,283.74938964844 ) 
end 
  
  
  
function respawnExplodedVehicle() 
    setTimer(respawnVehicle, 5000, 1, Hydra) 
end 
addEventHandler("onVehicleExplode", Hydra, respawnExplodedVehicle) 
  

Hydra should spawn every 5 seconds when explode , but didn't work . :/

Link to comment

no work :/

the full script :

radararea4 = createRadarArea( 996.50629, 2048.92480, -80, 132, 255, 255, 255, 225 ) 
createBlip(939.85992, 2080.10718, 10.82031,62) 
marker3 = createMarker(927.96558, 2076.13110, 9.82031,"cylinder",2,0,0,255,255) 
local Hydra = createVehicle ( 520, 951.7998046875,2132.1005859375,20.60000038147,0,0,283.74938964844 ) 
local Maverick = createVehicle ( 487, 954.90002441406,2154.1999511719,20,0,0,283.74938964844) 
local Rustler = createVehicle ( 476, 938.5,2071.0,22.89999961853,0,0,283.74938964844 ) 
local Infernus = createVehicle ( 411, 968.099609375,2057.6999511719,10.60000038147,0,0,0 ) 
local Infernus2 = createVehicle ( 411, 962.0,2057.5,10.60000038147,0,0,0 ) 
local Infernus3 = createVehicle ( 411, 953.7001953125,2057.3000488281,10.60000038147,0,0,0 ) 
  
  
  
addCommandHandler ( "comprar", 
function ( player ) 
local money = getPlayerMoney ( player ) 
local playerTeam = getPlayerTeam ( player ) 
if ( not playerTeam ) then 
        return 
      outputChatBox("#F4A460[bASE]#F08080 You need a Gang to buy a base.", player, 0, 0, 0, true) 
      end 
local r, g, b = getTeamColor ( playerTeam ) 
local teamMates = getPlayersInTeam ( playerTeam ) 
        if(isElementWithinMarker(player,marker3)) and ( money > 600000 )  then 
         takePlayerMoney ( player, 600000 ) 
         setRadarAreaColor ( radararea4, r, g, b, 999 ) 
         outputChatBox ( "#F4A460[bASE]#F08080 You buyed a base Fabrica for $600000", player, 0, 0, 0, true ) 
        for _, v in ipairs(teamMates) do 
        outputChatBox ( "#F4A460[bASE]#F08080 Your gang buyed a base #00FF00 Fabrica!", v, 0, 0, 0, true ) 
        end 
        else 
        outputChatBox ( "#F4A460[bASE]#F08080 You need to be on checkpoint and $600.000", player, 0, 0, 0, true ) 
        end 
        end) 
  
  
  
addEventHandler("onMarkerHit", marker3, 
function (player) 
    outputChatBox ( "#F4A460[bASE]#F08080 To buy a base write #00FF00 /comprar (600000$)", player, 0, 0, 0, true) 
end 
) 
function Vender ( player ) 
               if(isElementWithinMarker(player,marker3)) then 
               local playerTeam = getPlayerTeam ( player ) 
               if ( playerTeam ) then 
               local r, g, b = getTeamColor(playerTeam) 
               local aR, aG, aB = getRadarAreaColor(radararea4)   
               if (r == aR) and (g == aG) and (b == aB) then 
               givePlayerMoney ( player, 600000 ) 
               setRadarAreaColor ( radararea4, 255, 255, 255, 155 ) 
               setVehicleColor( Maverick, 255, 255, 255 ) 
               setVehicleColor( Infernus, 255, 255, 255 ) 
               setVehicleColor( Infernus2, 255, 255, 255 ) 
               setVehicleColor( Infernus3, 255, 255, 255 ) 
               setVehicleColor( Rustler, 255, 255, 255 ) 
               outputChatBox ( "#FFF000 [bASE] #FF0000 You selled a base #00ff00 Fabrica!", player, 0, 0, 0, true ) 
           end 
        end 
    end 
end 
addCommandHandler ( "vender", Vender ) 
  
function Car_Color ( player ) 
                 if(isElementWithinMarker(player,marker3)) then 
                 local playerTeam = getPlayerTeam ( player ) 
                 if ( playerTeam ) then 
                 local r, g, b = getTeamColor ( playerTeam ) 
                 setVehicleColor( Maverick, r, g, b ) 
                 setVehicleColor( Infernus, r, g, b ) 
                 setVehicleColor( Infernus2, r, g, b ) 
                 setVehicleColor( Infernus3, r, g, b ) 
                 setVehicleColor( Rustler, r, g, b ) 
              end 
        end 
   end 
addCommandHandler ( "comprar", Car_Color  ) 
radararea4 = createRadarArea( 996.50629, 2048.92480, -80, 132, 255, 255, 255, 225 ) 
  
function Fabrica_Base_Spawn() 
    local playerTeam = getPlayerTeam(source)         
    if (playerTeam) then   
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            setElementPosition(source, 927.96558, 2076.13110, 9.82031) 
        end 
    end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), Fabrica_Base_Spawn) 
addEventHandler("onVehicleStartEnter", Hydra, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Maverick, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Rustler, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus2, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus3, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
function onStart ( ) 
               setVehicleColor( Maverick, 255, 255, 255 ) 
               setVehicleColor( Infernus, 255, 255, 255 ) 
               setVehicleColor( Infernus2, 255, 255, 255 ) 
               setVehicleColor( Infernus3, 255, 255, 255 ) 
               setVehicleColor( Rustler, 255, 255, 255 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( ), onStart ) 
  
  
  
addEventHandler("onVehicleExplode", Hydra, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Maverick, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Rustler, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Infernus, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Infernus2, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Infernus3, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 

i want all the vehicle respawn after they blow. :/

Link to comment

replace all them

addEventHandler("onVehicleExplode", Hydra, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Maverick, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Rustler, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Infernus, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Infernus2, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
local Hydra = createVehicle(520, 951.8,2132.1,20.6,0,0,283.75) 
  
addEventHandler("onVehicleExplode", Infernus3, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 

to this

addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 

Link to comment

Still no work :/

radararea4 = createRadarArea( 996.50629, 2048.92480, -80, 132, 255, 255, 255, 225 ) 
createBlip(939.85992, 2080.10718, 10.82031,62) 
marker3 = createMarker(927.96558, 2076.13110, 9.82031,"cylinder",2,0,0,255,255) 
local Hydra = createVehicle ( 520, 951.7998046875,2132.1005859375,20.60000038147,0,0,283.74938964844 ) 
local Maverick = createVehicle ( 487, 954.90002441406,2154.1999511719,20,0,0,283.74938964844) 
local Rustler = createVehicle ( 476, 938.5,2071.0,22.89999961853,0,0,283.74938964844 ) 
local Infernus = createVehicle ( 411, 968.099609375,2057.6999511719,10.60000038147,0,0,0 ) 
local Infernus2 = createVehicle ( 411, 962.0,2057.5,10.60000038147,0,0,0 ) 
local Infernus3 = createVehicle ( 411, 953.7001953125,2057.3000488281,10.60000038147,0,0,0 ) 
  
  
  
addCommandHandler ( "comprar", 
function ( player ) 
local money = getPlayerMoney ( player ) 
local playerTeam = getPlayerTeam ( player ) 
if ( not playerTeam ) then 
        return 
      outputChatBox("#F4A460[bASE]#F08080 You need a Gang to buy a base.", player, 0, 0, 0, true) 
      end 
local r, g, b = getTeamColor ( playerTeam ) 
local teamMates = getPlayersInTeam ( playerTeam ) 
        if(isElementWithinMarker(player,marker3)) and ( money > 600000 )  then 
         takePlayerMoney ( player, 600000 ) 
         setRadarAreaColor ( radararea4, r, g, b, 999 ) 
         outputChatBox ( "#F4A460[bASE]#F08080 You buyed a base Fabrica for $600000", player, 0, 0, 0, true ) 
        for _, v in ipairs(teamMates) do 
        outputChatBox ( "#F4A460[bASE]#F08080 Your gang buyed a base #00FF00 Fabrica!", v, 0, 0, 0, true ) 
        end 
        else 
        outputChatBox ( "#F4A460[bASE]#F08080 You need to be on checkpoint and $600.000", player, 0, 0, 0, true ) 
        end 
        end) 
  
  
  
addEventHandler("onMarkerHit", marker3, 
function (player) 
    outputChatBox ( "#F4A460[bASE]#F08080 To buy a base write #00FF00 /comprar (600000$)", player, 0, 0, 0, true) 
end 
) 
function Vender ( player ) 
               if(isElementWithinMarker(player,marker3)) then 
               local playerTeam = getPlayerTeam ( player ) 
               if ( playerTeam ) then 
               local r, g, b = getTeamColor(playerTeam) 
               local aR, aG, aB = getRadarAreaColor(radararea4)   
               if (r == aR) and (g == aG) and (b == aB) then 
               givePlayerMoney ( player, 600000 ) 
               setRadarAreaColor ( radararea4, 255, 255, 255, 155 ) 
               setVehicleColor( Maverick, 255, 255, 255 ) 
               setVehicleColor( Infernus, 255, 255, 255 ) 
               setVehicleColor( Infernus2, 255, 255, 255 ) 
               setVehicleColor( Infernus3, 255, 255, 255 ) 
               setVehicleColor( Rustler, 255, 255, 255 ) 
               outputChatBox ( "#FFF000 [bASE] #FF0000 You selled a base #00ff00 Fabrica!", player, 0, 0, 0, true ) 
           end 
        end 
    end 
end 
addCommandHandler ( "vender", Vender ) 
  
function Car_Color ( player ) 
                 if(isElementWithinMarker(player,marker3)) then 
                 local playerTeam = getPlayerTeam ( player ) 
                 if ( playerTeam ) then 
                 local r, g, b = getTeamColor ( playerTeam ) 
                 setVehicleColor( Maverick, r, g, b ) 
                 setVehicleColor( Infernus, r, g, b ) 
                 setVehicleColor( Infernus2, r, g, b ) 
                 setVehicleColor( Infernus3, r, g, b ) 
                 setVehicleColor( Rustler, r, g, b ) 
              end 
        end 
   end 
addCommandHandler ( "comprar", Car_Color  ) 
radararea4 = createRadarArea( 996.50629, 2048.92480, -80, 132, 255, 255, 255, 225 ) 
  
function Fabrica_Base_Spawn() 
    local playerTeam = getPlayerTeam(source)         
    if (playerTeam) then   
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            setElementPosition(source, 927.96558, 2076.13110, 9.82031) 
        end 
    end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), Fabrica_Base_Spawn) 
addEventHandler("onVehicleStartEnter", Hydra, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Maverick, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Rustler, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus2, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus3, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
function onStart ( ) 
               setVehicleColor( Maverick, 255, 255, 255 ) 
               setVehicleColor( Infernus, 255, 255, 255 ) 
               setVehicleColor( Infernus2, 255, 255, 255 ) 
               setVehicleColor( Infernus3, 255, 255, 255 ) 
               setVehicleColor( Rustler, 255, 255, 255 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( ), onStart ) 
  
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 

Link to comment
Still no work :/
radararea4 = createRadarArea( 996.50629, 2048.92480, -80, 132, 255, 255, 255, 225 ) 
createBlip(939.85992, 2080.10718, 10.82031,62) 
marker3 = createMarker(927.96558, 2076.13110, 9.82031,"cylinder",2,0,0,255,255) 
local Hydra = createVehicle ( 520, 951.7998046875,2132.1005859375,20.60000038147,0,0,283.74938964844 ) 
local Maverick = createVehicle ( 487, 954.90002441406,2154.1999511719,20,0,0,283.74938964844) 
local Rustler = createVehicle ( 476, 938.5,2071.0,22.89999961853,0,0,283.74938964844 ) 
local Infernus = createVehicle ( 411, 968.099609375,2057.6999511719,10.60000038147,0,0,0 ) 
local Infernus2 = createVehicle ( 411, 962.0,2057.5,10.60000038147,0,0,0 ) 
local Infernus3 = createVehicle ( 411, 953.7001953125,2057.3000488281,10.60000038147,0,0,0 ) 
  
  
  
addCommandHandler ( "comprar", 
function ( player ) 
local money = getPlayerMoney ( player ) 
local playerTeam = getPlayerTeam ( player ) 
if ( not playerTeam ) then 
        return 
      outputChatBox("#F4A460[bASE]#F08080 You need a Gang to buy a base.", player, 0, 0, 0, true) 
      end 
local r, g, b = getTeamColor ( playerTeam ) 
local teamMates = getPlayersInTeam ( playerTeam ) 
        if(isElementWithinMarker(player,marker3)) and ( money > 600000 )  then 
         takePlayerMoney ( player, 600000 ) 
         setRadarAreaColor ( radararea4, r, g, b, 999 ) 
         outputChatBox ( "#F4A460[bASE]#F08080 You buyed a base Fabrica for $600000", player, 0, 0, 0, true ) 
        for _, v in ipairs(teamMates) do 
        outputChatBox ( "#F4A460[bASE]#F08080 Your gang buyed a base #00FF00 Fabrica!", v, 0, 0, 0, true ) 
        end 
        else 
        outputChatBox ( "#F4A460[bASE]#F08080 You need to be on checkpoint and $600.000", player, 0, 0, 0, true ) 
        end 
        end) 
  
  
  
addEventHandler("onMarkerHit", marker3, 
function (player) 
    outputChatBox ( "#F4A460[bASE]#F08080 To buy a base write #00FF00 /comprar (600000$)", player, 0, 0, 0, true) 
end 
) 
function Vender ( player ) 
               if(isElementWithinMarker(player,marker3)) then 
               local playerTeam = getPlayerTeam ( player ) 
               if ( playerTeam ) then 
               local r, g, b = getTeamColor(playerTeam) 
               local aR, aG, aB = getRadarAreaColor(radararea4)   
               if (r == aR) and (g == aG) and (b == aB) then 
               givePlayerMoney ( player, 600000 ) 
               setRadarAreaColor ( radararea4, 255, 255, 255, 155 ) 
               setVehicleColor( Maverick, 255, 255, 255 ) 
               setVehicleColor( Infernus, 255, 255, 255 ) 
               setVehicleColor( Infernus2, 255, 255, 255 ) 
               setVehicleColor( Infernus3, 255, 255, 255 ) 
               setVehicleColor( Rustler, 255, 255, 255 ) 
               outputChatBox ( "#FFF000 [bASE] #FF0000 You selled a base #00ff00 Fabrica!", player, 0, 0, 0, true ) 
           end 
        end 
    end 
end 
addCommandHandler ( "vender", Vender ) 
  
function Car_Color ( player ) 
                 if(isElementWithinMarker(player,marker3)) then 
                 local playerTeam = getPlayerTeam ( player ) 
                 if ( playerTeam ) then 
                 local r, g, b = getTeamColor ( playerTeam ) 
                 setVehicleColor( Maverick, r, g, b ) 
                 setVehicleColor( Infernus, r, g, b ) 
                 setVehicleColor( Infernus2, r, g, b ) 
                 setVehicleColor( Infernus3, r, g, b ) 
                 setVehicleColor( Rustler, r, g, b ) 
              end 
        end 
   end 
addCommandHandler ( "comprar", Car_Color  ) 
radararea4 = createRadarArea( 996.50629, 2048.92480, -80, 132, 255, 255, 255, 225 ) 
  
function Fabrica_Base_Spawn() 
    local playerTeam = getPlayerTeam(source)         
    if (playerTeam) then   
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            setElementPosition(source, 927.96558, 2076.13110, 9.82031) 
        end 
    end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), Fabrica_Base_Spawn) 
addEventHandler("onVehicleStartEnter", Hydra, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Maverick, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Rustler, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus2, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
addEventHandler("onVehicleStartEnter", Infernus3, 
function (player) 
    local playerTeam = getPlayerTeam(player) 
    if (playerTeam) then 
        local r, g, b = getTeamColor(playerTeam) 
        local aR, aG, aB = getRadarAreaColor(radararea4)   
        if (r == aR) and (g == aG) and (b == aB) then 
            outputChatBox("", player, 0, 0, 0, true) 
        else 
            outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
            cancelEvent() 
        end 
    else 
        outputChatBox("#F4A460[bASE]#F08080 Your gang hasn't bought this base.", player, 0, 0, 0, true) 
        cancelEvent() 
    end 
end) 
function onStart ( ) 
               setVehicleColor( Maverick, 255, 255, 255 ) 
               setVehicleColor( Infernus, 255, 255, 255 ) 
               setVehicleColor( Infernus2, 255, 255, 255 ) 
               setVehicleColor( Infernus3, 255, 255, 255 ) 
               setVehicleColor( Rustler, 255, 255, 255 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( ), onStart ) 
  
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 
  
  
addEventHandler("onVehicleExplode", resourceRoot, 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 

It's working, however you shouldn't have repeated the same code -_-.

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