Announcement

Collapse
No announcement yet.

VehiclePropertyValue how it work ?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    VehiclePropertyValue how it work ?

    hey guys, I want to know how to create a vehicle propertypropertyvalue because the only thing we have is GetVehiclePropertyValue and SetVehiclePropertyValue and I have an error when I do this code (all the code work properly without it so my code is not the error and sorry for my english, im from montreal):

    function CheckVehicleLocked(player, nearestVehicle)
    local nearPlate = GetVehicleLicensePlate(nearestVehicle)
    if tostring(vehiclekey[playervehicle].owner) == tostring(GetPlayerSteamId(player)) then
    if GetVehiclePropertyValue(nearestCar, "locked") then
    AddPlayerChat(player, "vehicule deverouiller")
    SetVehiclePropertyValue(nearestCar, "locked", false, true)
    else
    AddPlayerChat(player, "vehicule verouiller")
    SetVehiclePropertyValue(nearestCar, "locked", true, true)
    end
    return
    else
    print("sa marche pas")
    end
    end

    #2
    Hey, can you provide the error you are getting?

    Comment


      #3
      yes,

      [2020-01-11 18:34:52] [error] [string "zeptepprod/cars/base/server/server.lua"]:103: bad argument #1 to 'GetVehiclePropertyValue' (expected integer-like argument)

      Comment


        #4
        Your function has nearestVehicle param, but you're using nearestCar, is this intended?

        Code:
        function CheckVehicleLocked(player, nearestVehicle) <<<< nearestVehicle
            local nearPlate = GetVehicleLicensePlate(nearestVehicle)
            if tostring(vehiclekey[playervehicle].owner) == tostring(GetPlayerSteamId(player)) then
                if GetVehiclePropertyValue(nearestCar, "locked") then <<<< nearestCar
                    AddPlayerChat(player, "vehicule deverouiller")
                    SetVehiclePropertyValue(nearestCar, "locked", false, true) <<<< nearestCar
                else
                    AddPlayerChat(player, "vehicule verouiller")
                    SetVehiclePropertyValue(nearestCar, "locked", true, true) <<<< nearestCar
                end
                    return
                else
                    print("sa marche pas")
                end
            end
        end

        Comment

        Working...
        X