Hola tengo un Error con un House Rob tiene problemas aca dejo el Script y el Error:
ERROR: [wss]\[ready]\WSShouserob\server.lua:98: attempt to compare nil with number.
local houseRobs = {
{1496.5999755859, -693.5, 93.199996948242},
{668.70001220703, -1275.5, 12.300000190735},
{1080.9000244141, -1702.6999511719, 12},
{370.70001220703, -2050.1999511719, 6},
{154.30000305176, -1940.9000244141, 2.4000000953674},
{229.19999694824, -1770.3000488281, 2.5999999046326},
{1310.4000244141, -1373.4000244141, 12.39999961853},
{1419.0999755859, -1488.9000244141, 18.89999961853},
{1776.9000244141, -1369.8000488281, 14.39999961853},
{1108.8000488281, -742.70001220703, 98.800003051758},
{1009.9000244141, -660.79998779297, 119.80000305176},
{-1831.5999755859, 111.80000305176, 13.800000190735},
{-2673, -282.5, 5.9000000953674},
{-2648.6999511719, -27.60000038147, 5.1999998092651},
{-2739.3000488281, 107.19999694824, 3.7999999523163},
{-2723.1999511719, 869.5, 68.900001525879},
{-2437.3999023438, 1033.9000244141, 49},
{-2512.1000976563, 1205.4000244141, 35.400001525879},
{-2462, 786.59997558594, 32.700000762939},
{-1982.1999511719, 953.09997558594, 44.200000762939},
{-1954.9000244141, 1340.8000488281, 4.9000000953674},
{-1815.3000488281, 1153.5, 43},
{-1371.0999755859, 1490, 11},
{-1741.3000488281, 1425.3000488281, 5.1999998092651},
{-1820.0999755859, -175.89999389648, 7.4000000953674},
{-1415.6999511719, -298.70001220703, 11.5},
{-2521.6000976563, -620.40002441406, 131.10000610352},
{-1497.0999755859, 920.70001220703, 5.5999999046326},
{1046.9000244141, 1015.4000244141, 9.5},
{1095.5999755859, 1601.6999511719, 10.300000190735},
{1080, 1914.8000488281, 8.5},
{970.90002441406, 2161, 8.8000001907349},
{1066.3000488281, 2386.8999023438, 8.6000003814697},
{1479.8000488281, 2249.1999511719, 9.8000001907349},
{1445, 2360, 8.8999996185303},
{1555.9000244141, 2603, 8.8999996185303},
{1432.5, 2816.1999511719, 9.1000003814697},
{2631.8000488281, 2348.1999511719, 8.1000003814697},
{2798.6999511719, 2427, 8.6000003814697},
{2485.3999023438, 1528.9000244141, 8.6999998092651},
{2418.3999023438, 1123.5999755859, 9.3000001907349},
{2027, 1007.9000244141, 8.8000001907349},
{2017.4000244141, 1102.5999755859, 8.6000003814697},
{1686.6999511719, 1447.6999511719, 9.3000001907349},
{2301, -43.299999237061, 24.299999237061},
{2514.8999023438, 71.400001525879, 25.60000038147},
{1363.5999755859, 207.30000305176, 17.299999237061},
{1371.4000244141, 295.60000610352, 16.60000038147},
{1327.0999755859, 291.10000610352, 16},
{1325, 349.20001220703, 18},
{1251.5999755859, 348.70001220703, 16.60000038147},
{1234.9000244141, 235.80000305176, 17.89999961853},
{1369, 406.39999389648, 17.299999237061},
{277.5, -180.19999694824, -1.3999999761581},
{-534.59997558594, -502.39999389648, 22.5},
{-593.29998779297, -1055.1999511719, 20.200000762939},
{-18.89999961853, -2500.6000976563, 34.200000762939},
{-2105.6000976563, -2482.6999511719, 29.10000038147},
{-2164, -2421.1999511719, 28.10000038147},
{-2287, 2285.1999511719, 2.0999999046326},
{-2488.3000488281, 2361.6999511719, 7.5},
{-2456.5, 2249.8000488281, 2.4000000953674},
{-1936.5, 2382.1000976563, 46.200000762939},
{-248.19999694824, 2596, 61.200000762939},
{-143.39999389648, 1219.0999755859, 17.10000038147},
{-202.39999389648, 1119, 17.5},
{-139.69999694824, 1117.4000244141, 17.5},
{-18.39999961853, 1185.0999755859, 15.60000038147},
{578, 1222.4000244141, 10.10000038147}
}
local currentHouseRobBlip = false
local currentHouseRobMarker = false
local currentHouseRobTimer = false
local teams = {[getTeamFromName("Criminales")] = true, [getTeamFromName("Gangs Oficiales")] = true}
addEventHandler("onResourceStart", resourceRoot, function() setTimer(startHouseRob, 10000, 1) end)
function startHouseRob()
local houseRobIndex = math.random(#houseRobs)
currentHouseRobMarker = createMarker(houseRobs[houseRobIndex][1], houseRobs[houseRobIndex][2], houseRobs[houseRobIndex][3], "cylinder", 12, 204, 0, 0, 50)
currentHouseRobBlip = createBlipAttachedTo(currentHouseRobMarker, 32)
currentHouseRobTimer = setTimer(checkHouseRob, 5000, 0)
for i,v in ipairs(getPlayersInTeam(getTeamFromName("Criminales"))) do
exports.WSScommands:sendMessage("Hay un HR en " .. getElementZoneName(currentHouseRobMarker) .. ", " .. getElementZoneName(currentHouseRobMarker, true) .. "!", 255, 255, 0, v)
end
for i,v in ipairs(getPlayersInTeam(getTeamFromName("Gangs"))) do
exports.WSScommands:sendMessage("Hay un HR en " .. getElementZoneName(currentHouseRobMarker) .. ", " .. getElementZoneName(currentHouseRobMarker, true) .. "!", 255, 255, 0, v)
end
exports.WSSpolice:alertPolice("Hay un HR en " .. getElementZoneName(currentHouseRobMarker) .. ", " .. getElementZoneName(currentHouseRobMarker, true) .. "!")
setElementData(currentHouseRobMarker, "percentage", 0)
end
function checkHouseRob()
local percentage = tonumber(getElementData(currentHouseRobMarker, "percentage"))
if percentage < 100 then
for i,v in ipairs(getElementsWithinColShape(getElementColShape(currentHouseRobMarker), "player")) do
if teams[getPlayerTeam(v)] and (not isPedInVehicle(v)) and (not isPedDead(v)) then
exports.WSSpolice:modifyWantedLevel(v, 1)
percentage = percentage + 0.25
end
end
if percentage < 100 then
setElementData(currentHouseRobMarker, "percentage", percentage)
else
setElementData(currentHouseRobMarker, "percentage", 100)
finishHouseRob()
end
else
finishHouseRob()
end
end
function finishHouseRob()
for i,v in ipairs(getElementsWithinColShape(getElementColShape(currentHouseRobMarker), "player")) do
if teams[getPlayerTeam(v)] then
exports.WSScommands:giveMoney(v, 30000)
exports.WSScommands:sendMessage("Felicidades, han complentado el HR!", 255, 255, 0, v)
end
end
destroyElement(currentHouseRobMarker)
destroyElement(currentHouseRobBlip)
killTimer(currentHouseRobTimer)
currentHouseRobBlip = false
currentHouseRobMarker = false
currentHouseRobTimer = false
setTimer(startHouseRob, 300000, 1)
end