Jump to content

math.random


DynamicBan

Recommended Posts

local locations = {  
-- rob markers for EastLosSantos house                              --House EastLosSantos blip 
{ 2341.66602, -1186.37573, 1026.97656, 2351.9699707031, -1169.8599853516, 28.035507202148 },  
{ 2348.66870, -1186.74658, 1026.97656, 2351.9699707031, -1169.8599853516, 28.035507202148 },  
{ 2322.23877, -1183.75879, 1026.97656, 2351.9699707031, -1169.8599853516, 28.035507202148 }, 
-- rob markers for IdleWood house                                      --House IdleWood blip 
{ 326.66299, 1116.79797, 1082.88281, 2166.1999511719, -1671.4699707031, 15.073687553406 }, 
{ 316.13690, 1117.17993, 1082.88281, 2166.1999511719, -1671.4699707031, 15.073687553406 }, 
{ 309.62006, 1124.17896, 1082.88281, 2166.1999511719, -1671.4699707031, 15.073687553406 }, 
-- rob markers for WilloField house                                  --House WilloField blip 
{ 2282.04590, -1135.85901, 1049.89844, 2483.3798828125, -1996.1899414063, 13.834323883057 }, 
{ 2282.36694, -1137.74646, 1049.89844, 2483.3798828125, -1996.1899414063, 13.834323883057 }, 
{ 2285.44629, -1136.67346, 1049.89844, 2483.3798828125, -1996.1899414063, 13.834323883057 }, 
-- rob markers for Ganton house                                 --House Ganton blip 
{ 248.23495, 301.60382, 998.14844, 2402.5183105469, -1715.6148681641, 14.1328125 }, 
{ 243.82597, 301.51428, 998.14844, 2402.5183105469, -1715.6148681641, 14.1328125 }, 
{ 248.83932, 305.45200, 998.14844, 2402.5183105469, -1715.6148681641, 14.1328125 }, 
-- rob markers for CJ house                                     --house CJ blip 
{ 2491.69287, -1694.92102, 1013.74792, 2495.330078125, -1690.75, 14.765625 }, 
{ 2500.01343, -1711.35229, 1013.74219, 2495.330078125, -1690.75, 14.765625 }, 
{ 2494.01831, -1700.84949, 1017.34375, 2495.330078125, -1690.75, 14.765625 } 
} 
  
function createBlips ( ) 
    local vehicle = getElementModel ( source ) 
    if ( getElementModel ( source ) == 498 ) then 
        loc = math.random ( #locations ) 
        robMarker = createMarker (locations[loc][1], locations[loc][2], locations[loc][3], "cylinder", 1.5, 255, 255, 255, 150) 
        setElementInterior ( robMarker, 1 ) 
        setElementInterior ( robMarker, 3 ) 
        setElementInterior ( robMarker, 5 ) 
        setElementInterior ( robMarker, 11 ) 
        startBlip = createBlip (locations[loc][4], locations[loc][5], locations[loc][6], 32) 
    end 
end 
addEventHandler ("onClientVehicleEnter", getRootElement (), createBlips ) 
  
  

Link to comment

Rg4pHi6.png

getting those debug messages again

local locations = {  
-- rob markers for EastLosSantos house                              --House EastLosSantos blip 
{ 2341.66602, -1186.37573, 1026.97656, 5, 2351.9699707031, -1169.8599853516, 28.035507202148 },  
{ 2348.66870, -1186.74658, 1026.97656, 5, 2351.9699707031, -1169.8599853516, 28.035507202148 },  
{ 2322.23877, -1183.75879, 1026.97656, 5, 2351.9699707031, -1169.8599853516, 28.035507202148 }, 
-- rob markers for IdleWood house                                      --House IdleWood blip 
{ 326.66299, 1116.79797, 1082.88281, 5, 2166.1999511719, -1671.4699707031, 15.073687553406 }, 
{ 316.13690, 1117.17993, 1082.88281, 5, 2166.1999511719, -1671.4699707031, 15.073687553406 }, 
{ 309.62006, 1124.17896, 1082.88281, 5, 2166.1999511719, -1671.4699707031, 15.073687553406 }, 
-- rob markers for WilloField house                                  --House WilloField blip 
{ 2282.04590, -1135.85901, 1049.89844, 11, 2483.3798828125, -1996.1899414063, 13.834323883057 }, 
{ 2282.36694, -1137.74646, 1049.89844, 11, 2483.3798828125, -1996.1899414063, 13.834323883057 }, 
{ 2285.44629, -1136.67346, 1049.89844, 11, 2483.3798828125, -1996.1899414063, 13.834323883057 }, 
-- rob markers for Ganton house                                 --House Ganton blip 
{ 248.23495, 301.60382, 998.14844, 1, 2402.5183105469, -1715.6148681641, 14.1328125 }, 
{ 243.82597, 301.51428, 998.14844, 1, 2402.5183105469, -1715.6148681641, 14.1328125 }, 
{ 248.83932, 305.45200, 998.14844, 1, 2402.5183105469, -1715.6148681641, 14.1328125 }, 
-- rob markers for CJ house                                     --house CJ blip 
{ 2491.69287, -1694.92102, 1013.74792, 3, 2495.330078125, -1690.75, 14.765625 }, 
{ 2500.01343, -1711.35229, 1013.74219, 3, 2495.330078125, -1690.75, 14.765625 }, 
{ 2494.01831, -1700.84949, 1017.34375, 3, 2495.330078125, -1690.75, 14.765625 } 
  
function createBlips ( ) 
    local vehicle = getElementModel ( source ) 
    if ( getElementModel ( source ) == 498 ) then 
        loc = math.random ( #locations ) 
        robMarker = createMarker (locations[loc][1], locations[loc][2], locations[loc][3], locations[loc][4], "cylinder", 1.5, 255, 255, 255, 150) 
        setElementInterior ( robMarker, 1 ) 
        setElementInterior ( robMarker, 3 ) 
        setElementInterior ( robMarker, 5 ) 
        setElementInterior ( robMarker, 11 ) 
        startBlip = createBlip (locations[loc][5], locations[loc][6], locations[loc][7], 32) 
    end 
end 
addEventHandler ("onClientVehicleEnter", getRootElement (), createBlips ) 

Edited by Guest
Link to comment
  
local locations = { 
-- rob markers for EastLosSantos house                              --House EastLosSantos blip 
{ 2341.66602, -1186.37573, 1026.97656, 2351.9699707031, 5, -1169.8599853516, 28.035507202148 }, 
{ 2348.66870, -1186.74658, 1026.97656, 2351.9699707031, 5, -1169.8599853516, 28.035507202148 }, 
{ 2322.23877, -1183.75879, 1026.97656, 2351.9699707031, 5, -1169.8599853516, 28.035507202148 }, 
-- rob markers for IdleWood house                                      --House IdleWood blip 
{ 326.66299, 1116.79797, 1082.88281, 2166.1999511719, 5, -1671.4699707031, 15.073687553406 }, 
{ 316.13690, 1117.17993, 1082.88281, 2166.1999511719, 5, -1671.4699707031, 15.073687553406 }, 
{ 309.62006, 1124.17896, 1082.88281, 2166.1999511719, 5, -1671.4699707031, 15.073687553406 }, 
-- rob markers for WilloField house                                  --House WilloField blip 
{ 2282.04590, -1135.85901, 1049.89844, 2483.3798828125, 11, -1996.1899414063, 13.834323883057 }, 
{ 2282.36694, -1137.74646, 1049.89844, 2483.3798828125, 11, -1996.1899414063, 13.834323883057 }, 
{ 2285.44629, -1136.67346, 1049.89844, 2483.3798828125, 11, -1996.1899414063, 13.834323883057 }, 
-- rob markers for Ganton house                                 --House Ganton blip 
{ 248.23495, 301.60382, 998.14844, 2402.5183105469, 1, -1715.6148681641, 14.1328125 }, 
{ 243.82597, 301.51428, 998.14844, 2402.5183105469, 1, -1715.6148681641, 14.1328125 }, 
{ 248.83932, 305.45200, 998.14844, 2402.5183105469, 1, -1715.6148681641, 14.1328125 }, 
-- rob markers for CJ house                                     --house CJ blip 
{ 2491.69287, -1694.92102, 1013.74792, 2495.330078125, 3, -1690.75, 14.765625 }, 
{ 2500.01343, -1711.35229, 1013.74219, 2495.330078125, 3, -1690.75, 14.765625 }, 
{ 2494.01831, -1700.84949, 1017.34375, 2495.330078125, 3, -1690.75, 14.765625 } 
} 
  
function createBlips ( ) 
    local vehicle = getElementModel ( source ) 
    if ( getElementModel ( source ) == 498 ) then 
        loc = math.random ( #locations ) 
        robMarker = createMarker (locations[loc][1], locations[loc][2], locations[loc][3], "cylinder", 1.5, 255, 255, 255, 150) 
        setElementInterior ( robMarker, 1 ) 
        setElementInterior ( robMarker, 3 ) 
        setElementInterior ( robMarker, 5 ) 
        setElementInterior ( robMarker, 11 ) 
        startBlip = createBlip (locations[loc][5], locations[loc][6], locations[loc][7], 32) 
    end 
end 
addEventHandler ("onClientVehicleEnter", getRootElement (), createBlips ) 
  

Link to comment

Not keep the code that work but added the interior and the end of each pos like this

  
table = { 
       {2259, -1222, 1049, 1186, -1234, 18, 10} 
} 
local i = math.random(#locations) 
marker =createMarker(locations[i][1], locations[i][2], locations[i][3], 'cylinder', 3) 
setElementInterior(marker, locations[i][7]) 
createBlip(locations[i][4], locations[i][5], locations[i][6]) 
  

Link to comment
Not keep the code that work but added the interior and the end of each pos like this
  
table = { 
       {2259, -1222, 1049, 1186, -1234, 18, 10} 
} 
local i = math.random(#locations) 
marker =createMarker(locations[i][1], locations[i][2], locations[i][3], 'cylinder', 3) 
setElementInterior(marker, locations[i][7]) 
createBlip(locations[i][4], locations[i][5], locations[i][6]) 
  

Thanks again, its working now.

Link to comment

Uh ye 1 more. When the player enters the robmarker he gets an object attached to him. Atleast that how it should work but im getting this error WqVODWu.png

Line 44 @ ss, the code below line 19

function createBlips ( ) 
    local vehicle = getElementModel ( source ) 
    if ( getElementModel ( source ) == 498 ) then 
        loc = math.random ( #locations ) 
        robMarker = createMarker ( locations[loc][1], locations[loc][2], locations[loc][3], "cylinder", 1.5, 255, 255, 255, 150 ) 
        setElementInterior ( robMarker, locations[loc][7] ) 
        startBlip = createBlip ( locations[loc][4], locations[loc][5], locations[loc][6], 32 ) 
    end 
end 
addEventHandler ("onClientVehicleEnter", getRootElement (), createBlips ) 
  
function hitElement ( hitPlayer, matchingDimension ) 
    if ( hitPlayer ) then 
        local x, y, z = getElementPosition ( hitPlayer ) 
        local object = createObject ( 1429, x, y, z-5 ) 
        attachElements ( object, hitPlayer, 0, 0.5, 0 ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", robMarker (), hitElement ) 

Edited by Guest
Link to comment
  
function createBlips ( ) 
    local vehicle = getElementModel ( source ) 
    if ( getElementModel ( source ) == 498 ) then 
        loc = math.random ( #locations ) 
        robMarker = createMarker ( locations[loc][1], locations[loc][2], locations[loc][3], "cylinder", 1.5, 255, 255, 255, 150 ) 
        setElementInterior ( robMarker, locations[loc][7] ) 
        startBlip = createBlip ( locations[loc][4], locations[loc][5], locations[loc][6], 32 ) 
    end 
end 
addEventHandler ("onClientVehicleEnter", getRootElement (), createBlips ) 
  
function hitElement ( hitPlayer, matchingDimension ) 
    if ( hitPlayer ) then 
        local x, y, z = getElementPosition ( hitPlayer ) 
        local object = createObject ( 1429, x, y, z-5 ) 
        attachElements ( object, hitPlayer, 0, 0.5, 0 ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", robMarker, hitElement ) 
  

Link to comment
  
marker = nil 
function createBlips ( ) 
    local vehicle = getElementModel ( source ) 
    if ( getElementModel ( source ) == 498 ) then 
        loc = math.random ( #locations ) 
        robMarker = createMarker ( locations[loc][1], locations[loc][2], locations[loc][3], "cylinder", 1.5, 255, 255, 255, 150 ) 
        marker = robMarker 
        setElementInterior ( robMarker, locations[loc][7] ) 
        startBlip = createBlip ( locations[loc][4], locations[loc][5], locations[loc][6], 32 ) 
    end 
end 
addEventHandler ("onClientVehicleEnter", getRootElement (), createBlips ) 
  
function hitElement ( hitPlayer, matchingDimension ) 
    if ( hitPlayer ) then 
        local x, y, z = getElementPosition ( hitPlayer ) 
        local object = createObject ( 1429, x, y, z-5 ) 
        attachElements ( object, hitPlayer, 0, 0.5, 0 ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", marker, hitElement ) 
  
  

Link to comment
  
marker = nil 
function createBlips ( ) 
    local vehicle = getElementModel ( source ) 
    if ( getElementModel ( source ) == 498 ) then 
        loc = math.random ( #locations ) 
        robMarker = createMarker ( locations[loc][1], locations[loc][2], locations[loc][3], "cylinder", 1.5, 255, 255, 255, 150 ) 
        marker = robMarker 
        setElementInterior ( robMarker, locations[loc][7] ) 
        startBlip = createBlip ( locations[loc][4], locations[loc][5], locations[loc][6], 32 ) 
    end 
end 
addEventHandler ("onClientVehicleEnter", getRootElement (), createBlips ) 
  
function hitElement ( hitPlayer, matchingDimension ) 
    if ( hitPlayer ) then 
        local x, y, z = getElementPosition ( hitPlayer ) 
        local object = createObject ( 1429, x, y, z-5 ) 
        attachElements ( object, hitPlayer, 0, 0.5, 0 ) 
    end 
end 
addEventHandler ( "onClientMarkerHit", marker, hitElement ) 
  
  

Same debug

Line 19 near robMarker remove the this () any more problems

copy the line 19 and place it under robMarker at the first function

I removed (), but what do you mean by placing it under the robMarker.

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