Log in to reply
 

find if vehicle == a model [LUA]



  • hi, what's wrong in my code? why if i'm on the right car return false?

    local model = GetEntityModel( veh )

    if tostring( GetHashKey( model )) ~= "1878062887") then
    return false
    else
    return true
    end


  • MODERATOR

    @Santo99
    I've never used Lua, but my guess is to get rid of tostring, GetHashKey, turn the model number string into a model number integer, and to get rid of the extra ) you have.

    local model = GetEntityModel( veh )
    
    if  model ~= 1878062887 then
      return false
    else
      return true
    end
    

    You can get rid of GetHashKey because GetEntityModel already returns a hash key. tostring is unnecessary since you can check the numbers themselves instead of converting them into strings.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.