Jump to content

Random Markers Problem


ertlflorian1

Recommended Posts

Hi i hab a problem first time i drive into the marker i will work but the marker will be destroyed and another marker will be createt but when i drive in the second marker nothing happens.

pos = { 
[1]="5247.93896,664.521,187.78101", 
[2]="5216.09521,610.77197,187.78101", 
[3]="5259.93506,674.84802,187.78101", 
[4]="5174.83203,610.63501,187.78101", 
[5]="5140.81885,606.42798,187.78101", 
[6]="5187.55518,534.37903,187.78101", 
[7]="5218.94824,530.72198,187.78101", 
[8]="5221.80615,484.772,187.78101", 
[9]="5234.22412,452.11401,187.78101", 
[10]="5265.18018,447.586,187.78101", 
[11]="5310.95996,448.216,187.78101", 
[12]="5334.08594,409.17999,187.78101", 
[13]="5353.43213,384.065,187.78101", 
[14]="5333.69824,488.246,187.78101", 
[15]="5352.70117,512.08899,187.78101", 
[16]="5323.17676,537.28198,187.78101", 
[17]="5263.91895,528.11902,187.78101", 
[18]="5286.38086,569.48901,187.78101", 
[19]="5299.03906,598.21198,187.78101", 
[20]="5254.46924,559.94,187.78101", 
[21]="5225.05322,584.86902,187.78101", 
[22]="5277.37305,495.98499,187.78101", 
[23]="5301.2168,478.81799,187.78101", 
} 
marker = createMarker (5263.91895,528.11902,187.78101, "checkpoint", 2.25, 255,0,0) 
  
function srandomveh (thePlayer) 
if getElementType ( thePlayer ) == "player" then 
pname = getPlayerName (thePlayer) 
local veh = getPedOccupiedVehicle (thePlayer) 
zahlm = math.random (1,23) 
x, y, z = getElementPosition (veh) 
local veh2 = getElementModel (veh) 
local portstring = pos[tonumber(zahlm)] 
local mX = gettok ( portstring, 1, string.byte(',') ) 
local mY = gettok ( portstring, 2, string.byte(',') ) 
local mZ = gettok ( portstring, 3, string.byte(',') ) 
setElementModel (veh, 411) 
setElementPosition (veh, x, y, z+0.5) 
destroyElement (marker) 
marker = createMarker (mX, mY, mZ, "checkpoint", 2.25, 255,0,0) 
fixVehicle (veh) 
end 
end 
addEventHandler ("onMarkerHit", marker, srandomveh) 

Link to comment
Hi i hab a problem first time i drive into the marker i will work but the marker will be destroyed and another marker will be createt but when i drive in the second marker nothing happens.

Thats all u have added to ur code.

if u want something to happen after that u will need to write it...

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