Jump to content

Recommended Posts

local vehicles = {
        [1] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
            -- Barracks
            {433, 2611.8000488281, 237.5, 59.5, 65, 2},
            {433, 277.7998046875, 2024.19921875, 18.200000762939, 65, 2},

     
            -- Bobcats
            {422, -2051.8000488281, 144.19999694824, 28.89999961853, 20, 2},
            {422, -237.19999694824,2812.5,61.799999237061, 20, 2},
            
            -- Sanchez
            {468, -2039.5, 1108.69921875, 53, 8, 2},
            {468, -1813.8994140625, -1598.7998046875, 22.799999237061, 8, 2},
            
            -- Mesa
            {500, 1552.4000244141, -2088, 25.700000762939, 25, 2},
            {500, 2786.69921875, 2244.2998046875, 11.199999809265, 25, 2},
            
            -- Dodo
            {593, -1238.5999755859, -652.09997558594, 14.699999809265, 25, 2},
            {593, 290.60000610352, 2538.6999511719, 17.39999961853, 25, 2},
            
            -- QuadBike
            {471, 1931.6999511719, -587.79998779297, 27.200000762939, 10, 2},
            {471, -386.2998046875, 1976.69921875, 92, 10, 2},,
            
            -- Freeway
            {541, -701, 945, 12, 8, 2},
            {541, 2903.69921875, 1586, 10.39999961853, 8, 2},
        },
        --
        [2] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- Camper
            {483, 1527.5, -661.5, 94.5, 12, 2},
            {483, 1318.19921875, -641.69921875, 108.90000152588, 12, 2},
        },
        --
        [3] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- Buffalo
            {402, -106.8994140625, -1573.2998046875, 2.5, 12, 2},
            {402, -2137.8000488281, 1219.4000244141, 47.099998474121, 12, 2},


            -- Bandito
            {456, -2304.69921875, -1643.099609375, 483.70001220703, 15, 5},
            {456, -482.20001220703, -2026.4000244141, 50.400001525879, 15, 5},

        },
        --
        [4] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- COACH
            {437, -271.29998779297, -2162.1000976563, 30, 190, 5},
        },
    }

addCommandHandler("spawncars",
function(p, cmd, n)
            if ( isObjectInACLGroup("user."..getAccountName(getPlayerAccount(p)), aclGetGroup("Admin")) ) then
            if ( n ) and ( vehicles[n] ) then
                    for i, k in ipairs(vehicles[n]) do
                    local v = createVehicle(k[1], k[2], k[3], k[4])
                    local c = createColSphere(k[2], k[3], k[4], k[6])
                    --
                    attachElements(c, v, 0, 0, 0)
                    setElementData(c, "parent", v)
                    setElementData(v, "parent", c)
                    setElementData(c, "vehicle", true)
                    setElementData(c, "MAX_Slots", k[5])
                    setElementData(c, "fuel", 5)
                    --
                    local tires, engine, parts = getVehicleAddonInfos(k[1])
                    if ( not tonumber(tires) ) then tires = math.random(0, 4) end
                    if ( not tonumber(engine) ) then engine = math.random(0, 1) end
                    if ( not tonumber(parts) ) then parts = math.random(0, 4) end
                    setElementData(c, "Rueda_inVehicle", math.random(0, tires))
                    setElementData(c, "Motor_inVehicle", math.random(0, engine))
                    setElementData(c, "Parts_inVehicle", math.random(0, parts))
                    setElementData(c, "spawn", {k[1], k[2], k[3], k[4]})
                    --
                    outputChatBox("¡Has respawneado todos los vehiculos!.", p, 0, 255, 120, true)
                end
            else
                outputChatBox("Error Syntax: /spawncars [1-4]", p, 255, 50, 0, true)
                outputChatBox("Ejemplo: /spawncars #ffffff1", p, 255, 50, 0, true)
            end
        end
    end
    )

Pues nada, ¿quería saber porque esta pequeña script no me funciona?
    

Como ven es una simple script que sirve para spawnear vehículos dentro del servidor a través de un comando, pero cuando presiono "T" y tipeo /spanwcars 1, etc, me tira el siguiente mensaje:

 Error Syntax: /spawncars [1-4]
 Ejemplo: /spawncars 1

Pero no me dice que los autos hayan spawneado, la verdad no entiendo el problema y en el debugscript 3 no me tira ninguna clase de error con respecto a este LUA.

 

Edited by Maruchan
Link to comment
20 hours ago, Maruchan said:

local vehicles = {
        [1] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
            -- Barracks
            {433, 2611.8000488281, 237.5, 59.5, 65, 2},
            {433, 277.7998046875, 2024.19921875, 18.200000762939, 65, 2},

     
            -- Bobcats
            {422, -2051.8000488281, 144.19999694824, 28.89999961853, 20, 2},
            {422, -237.19999694824,2812.5,61.799999237061, 20, 2},
            
            -- Sanchez
            {468, -2039.5, 1108.69921875, 53, 8, 2},
            {468, -1813.8994140625, -1598.7998046875, 22.799999237061, 8, 2},
            
            -- Mesa
            {500, 1552.4000244141, -2088, 25.700000762939, 25, 2},
            {500, 2786.69921875, 2244.2998046875, 11.199999809265, 25, 2},
            
            -- Dodo
            {593, -1238.5999755859, -652.09997558594, 14.699999809265, 25, 2},
            {593, 290.60000610352, 2538.6999511719, 17.39999961853, 25, 2},
            
            -- QuadBike
            {471, 1931.6999511719, -587.79998779297, 27.200000762939, 10, 2},
            {471, -386.2998046875, 1976.69921875, 92, 10, 2},,
            
            -- Freeway
            {541, -701, 945, 12, 8, 2},
            {541, 2903.69921875, 1586, 10.39999961853, 8, 2},
        },
        --
        [2] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- Camper
            {483, 1527.5, -661.5, 94.5, 12, 2},
            {483, 1318.19921875, -641.69921875, 108.90000152588, 12, 2},
        },
        --
        [3] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- Buffalo
            {402, -106.8994140625, -1573.2998046875, 2.5, 12, 2},
            {402, -2137.8000488281, 1219.4000244141, 47.099998474121, 12, 2},


            -- Bandito
            {456, -2304.69921875, -1643.099609375, 483.70001220703, 15, 5},
            {456, -482.20001220703, -2026.4000244141, 50.400001525879, 15, 5},

        },
        --
        [4] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- COACH
            {437, -271.29998779297, -2162.1000976563, 30, 190, 5},
        },
    }

addCommandHandler("spawncars",
function(p, cmd, n)
            if ( isObjectInACLGroup("user."..getAccountName(getPlayerAccount(p)), aclGetGroup("Admin")) ) then
            if ( n ) and ( vehicles[n] ) then
                    for i, k in ipairs(vehicles[n]) do
                    local v = createVehicle(k[1], k[2], k[3], k[4])
                    local c = createColSphere(k[2], k[3], k[4], k[6])
                    --
                    attachElements(c, v, 0, 0, 0)
                    setElementData(c, "parent", v)
                    setElementData(v, "parent", c)
                    setElementData(c, "vehicle", true)
                    setElementData(c, "MAX_Slots", k[5])
                    setElementData(c, "fuel", 5)
                    --
                    local tires, engine, parts = getVehicleAddonInfos(k[1])
                    if ( not tonumber(tires) ) then tires = math.random(0, 4) end
                    if ( not tonumber(engine) ) then engine = math.random(0, 1) end
                    if ( not tonumber(parts) ) then parts = math.random(0, 4) end
                    setElementData(c, "Rueda_inVehicle", math.random(0, tires))
                    setElementData(c, "Motor_inVehicle", math.random(0, engine))
                    setElementData(c, "Parts_inVehicle", math.random(0, parts))
                    setElementData(c, "spawn", {k[1], k[2], k[3], k[4]})
                    --
                    outputChatBox("¡Has respawneado todos los vehiculos!.", p, 0, 255, 120, true)
                end
            else
                outputChatBox("Error Syntax: /spawncars [1-4]", p, 255, 50, 0, true)
                outputChatBox("Ejemplo: /spawncars #ffffff1", p, 255, 50, 0, true)
            end
        end
    end
    )

Pues nada, ¿quería saber porque esta pequeña script no me funciona?
    

Como ven es una simple script que sirve para spawnear vehículos dentro del servidor a través de un comando, pero cuando presiono "T" y tipeo /spanwcars 1, etc, me tira el siguiente mensaje:

 Error Syntax: /spawncars [1-4]
 Ejemplo: /spawncars 1

Pero no me dice que los autos hayan spawneado, la verdad no entiendo el problema y en el debugscript 3 no me tira ninguna clase de error con respecto a este LUA.

 

local vehicles = {
        [1] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
            -- Barracks
            {433, 2611.8000488281, 237.5, 59.5, 65, 2},
            {433, 277.7998046875, 2024.19921875, 18.200000762939, 65, 2},

     
            -- Bobcats
            {422, -2051.8000488281, 144.19999694824, 28.89999961853, 20, 2},
            {422, -237.19999694824,2812.5,61.799999237061, 20, 2},
            
            -- Sanchez
            {468, -2039.5, 1108.69921875, 53, 8, 2},
            {468, -1813.8994140625, -1598.7998046875, 22.799999237061, 8, 2},
            
            -- Mesa
            {500, 1552.4000244141, -2088, 25.700000762939, 25, 2},
            {500, 2786.69921875, 2244.2998046875, 11.199999809265, 25, 2},
            
            -- Dodo
            {593, -1238.5999755859, -652.09997558594, 14.699999809265, 25, 2},
            {593, 290.60000610352, 2538.6999511719, 17.39999961853, 25, 2},
            
            -- QuadBike
            {471, 1931.6999511719, -587.79998779297, 27.200000762939, 10, 2},
            {471, -386.2998046875, 1976.69921875, 92, 10, 2},,
            
            -- Freeway
            {541, -701, 945, 12, 8, 2},
            {541, 2903.69921875, 1586, 10.39999961853, 8, 2},
        },
        --
        [2] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- Camper
            {483, 1527.5, -661.5, 94.5, 12, 2},
            {483, 1318.19921875, -641.69921875, 108.90000152588, 12, 2},
        },
        --
        [3] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- Buffalo
            {402, -106.8994140625, -1573.2998046875, 2.5, 12, 2},
            {402, -2137.8000488281, 1219.4000244141, 47.099998474121, 12, 2},


            -- Bandito
            {456, -2304.69921875, -1643.099609375, 483.70001220703, 15, 5},
            {456, -482.20001220703, -2026.4000244141, 50.400001525879, 15, 5},

        },
        --
        [4] = {
        --    {id, x, y, z, MAX_Slots, colSphereSize},
        
            -- COACH
            {437, -271.29998779297, -2162.1000976563, 30, 190, 5},
        },
    }

addCommandHandler("spawncars",
function(p, cmd, n)
            if ( isObjectInACLGroup("user."..getAccountName(getPlayerAccount(p)), aclGetGroup("Admin")) ) then
      		n = tonumber( n )
            if ( n ) and ( vehicles[ n ] ) then
                    for i, k in ipairs(vehicles[n]) do
                    local v = createVehicle(k[1], k[2], k[3], k[4])
                    local c = createColSphere(k[2], k[3], k[4], k[6])
                    --
                    attachElements(c, v, 0, 0, 0)
                    setElementData(c, "parent", v)
                    setElementData(v, "parent", c)
                    setElementData(c, "vehicle", true)
                    setElementData(c, "MAX_Slots", k[5])
                    setElementData(c, "fuel", 5)
                    --
                    local tires, engine, parts = getVehicleAddonInfos(k[1])
                    if ( not tonumber(tires) ) then tires = math.random(0, 4) end
                    if ( not tonumber(engine) ) then engine = math.random(0, 1) end
                    if ( not tonumber(parts) ) then parts = math.random(0, 4) end
                    setElementData(c, "Rueda_inVehicle", math.random(0, tires))
                    setElementData(c, "Motor_inVehicle", math.random(0, engine))
                    setElementData(c, "Parts_inVehicle", math.random(0, parts))
                    setElementData(c, "spawn", {k[1], k[2], k[3], k[4]})
                    --
                    outputChatBox("¡Has respawneado todos los vehiculos!.", p, 0, 255, 120, true)
                end
            else
                outputChatBox("Error Syntax: /spawncars [1-4]", p, 255, 50, 0, true)
                outputChatBox("Ejemplo: /spawncars #ffffff1", p, 255, 50, 0, true)
            end
        end
    end
    )

 

Link to comment
  • 2 weeks later...
On 07/09/2018 at 10:10, Simplex said:

local vehicles = {        [1] = {        --    {id, x, y, z, MAX_Slots, colSphereSize},            -- Barracks            {433, 2611.8000488281, 237.5, 59.5, 65, 2},            {433, 277.7998046875, 2024.19921875, 18.200000762939, 65, 2},                 -- Bobcats            {422, -2051.8000488281, 144.19999694824, 28.89999961853, 20, 2},            {422, -237.19999694824,2812.5,61.799999237061, 20, 2},                        -- Sanchez            {468, -2039.5, 1108.69921875, 53, 8, 2},            {468, -1813.8994140625, -1598.7998046875, 22.799999237061, 8, 2},                        -- Mesa            {500, 1552.4000244141, -2088, 25.700000762939, 25, 2},            {500, 2786.69921875, 2244.2998046875, 11.199999809265, 25, 2},                        -- Dodo            {593, -1238.5999755859, -652.09997558594, 14.699999809265, 25, 2},            {593, 290.60000610352, 2538.6999511719, 17.39999961853, 25, 2},                        -- QuadBike            {471, 1931.6999511719, -587.79998779297, 27.200000762939, 10, 2},            {471, -386.2998046875, 1976.69921875, 92, 10, 2},,                        -- Freeway            {541, -701, 945, 12, 8, 2},            {541, 2903.69921875, 1586, 10.39999961853, 8, 2},        },        --        [2] = {        --    {id, x, y, z, MAX_Slots, colSphereSize},                    -- Camper            {483, 1527.5, -661.5, 94.5, 12, 2},            {483, 1318.19921875, -641.69921875, 108.90000152588, 12, 2},        },        --        [3] = {        --    {id, x, y, z, MAX_Slots, colSphereSize},                    -- Buffalo            {402, -106.8994140625, -1573.2998046875, 2.5, 12, 2},            {402, -2137.8000488281, 1219.4000244141, 47.099998474121, 12, 2},            -- Bandito            {456, -2304.69921875, -1643.099609375, 483.70001220703, 15, 5},            {456, -482.20001220703, -2026.4000244141, 50.400001525879, 15, 5},        },        --        [4] = {        --    {id, x, y, z, MAX_Slots, colSphereSize},                    -- COACH            {437, -271.29998779297, -2162.1000976563, 30, 190, 5},        },    }addCommandHandler("spawncars",function(p, cmd, n)            if ( isObjectInACLGroup("user."..getAccountName(getPlayerAccount(p)), aclGetGroup("Admin")) ) then      		n = tonumber( n )            if ( n ) and ( vehicles[ n ] ) then                    for i, k in ipairs(vehicles[n]) do                    local v = createVehicle(k[1], k[2], k[3], k[4])                    local c = createColSphere(k[2], k[3], k[4], k[6])                    --                    attachElements(c, v, 0, 0, 0)                    setElementData(c, "parent", v)                    setElementData(v, "parent", c)                    setElementData(c, "vehicle", true)                    setElementData(c, "MAX_Slots", k[5])                    setElementData(c, "fuel", 5)                    --                    local tires, engine, parts = getVehicleAddonInfos(k[1])                    if ( not tonumber(tires) ) then tires = math.random(0, 4) end                    if ( not tonumber(engine) ) then engine = math.random(0, 1) end                    if ( not tonumber(parts) ) then parts = math.random(0, 4) end                    setElementData(c, "Rueda_inVehicle", math.random(0, tires))                    setElementData(c, "Motor_inVehicle", math.random(0, engine))                    setElementData(c, "Parts_inVehicle", math.random(0, parts))                    setElementData(c, "spawn", {k[1], k[2], k[3], k[4]})                    --                    outputChatBox("¡Has respawneado todos los vehiculos!.", p, 0, 255, 120, true)                end            else                outputChatBox("Error Syntax: /spawncars [1-4]", p, 255, 50, 0, true)                outputChatBox("Ejemplo: /spawncars #ffffff1", p, 255, 50, 0, true)            end        end    end    )

 

Gracias ;)

Edited by Maruchan
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...