Jump to content

[Problem]getElementModel


Recommended Posts

jobveh = createVehicle (truckModel,car[1],car[2],car[3],0,0,car[4]) 

idlist = {602,410,545,436,551} 
vehidd = idlist [math.random(#idlist)] 
function create  ( player,seat,jacked) 
      if (getElementModel (jobveh) == 525) then 
local x, y, z = unpack ( jobspawn [ math.random ( #jobspawn ) ] ) 
    vehId=math.random(1,6); 
    vehic = createVehicle (vehidd,jobspawn[vehId][1], jobspawn[vehId][2], jobspawn[vehId][3]) 
setVehicleDamageProof (vehic , true ) 
setElementHealth (vehic, 495 ) 
setVehicleEngineState (vehic, false) 
setVehicleLocked (vehic , true ) 
    vehblip = createBlipAttachedTo (vehic,0,4,255,255,0,255,0,9999.0,player) 
     end 
     end 
  
  
  
addEventHandler ( "onVehicleEnter", getRootElement(player), create ) 

the vehic and the vehblip should appear when i enter the tow truck only thats have the id 525 and its appearing on evrey car.

whats the soulution ?

Link to comment

That makes no sense.. it's done wrong...

You check the model of a vehicle that's defined somewhere else and has the correct model, of course it will always pass... use source instead.

There are other things done wrong as well.. and does indentation mean anything at all to you? Who's supposed to read that?

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