API

Ein Autohaus ist eine ID: seine Stelle in Config.Shops, ab 1.

OpenShop

Client
exports.cs_vehicleshop:OpenShop(id)

Öffnet ein Autohaus, an dem der Spieler steht.

Gibt zurückboolean false bei unbekannter ID, zu weit weg, schon offen, während einer Probefahrt oder wenn der Spieler am Boden liegt.

CloseShop

Client
exports.cs_vehicleshop:CloseShop()

Gibt zurückboolean

IsShopOpen

Client
exports.cs_vehicleshop:IsShopOpen()

Gibt zurückboolean

GetOpenShop

Client
exports.cs_vehicleshop:GetOpenShop()

Gibt zurücknumber | nil

IsTestDriving

Client
exports.cs_vehicleshop:IsTestDriving()

Gibt zurückboolean

GetShops

Client
exports.cs_vehicleshop:GetShops()

Gibt zurücktable { id, label, accent, description, position, testDrive, delivery }[]

GetShops

Server
exports.cs_vehicleshop:GetShops()

Gibt zurücktable { id, label, accent, position, garage, delivery, testDrive, categories }[]

GetShop

Server
exports.cs_vehicleshop:GetShop(id)

Gibt zurücktable | nil

IsTestDriving

Server
exports.cs_vehicleshop:IsTestDriving(source)

Gibt zurückboolean

Events

Client
AddEventHandler('cs_vehicleshop:opened',    function(shopId) end)
AddEventHandler('cs_vehicleshop:closed',    function(shopId) end)
AddEventHandler('cs_vehicleshop:testDrive', function(started, model) end)
AddEventHandler('cs_vehicleshop:purchased', function(shopId, model, plate) end)
Server
AddEventHandler('cs_vehicleshop:purchased', function(source, data)
    -- data = { shop, model, plate, price, tuning, account, delivered, netId, society }
    -- tuning is the part of price that paid for tuning, 0 for a stock car
    -- society is { job, amount } when a job account was paid, else nil
end)

AddEventHandler('cs_vehicleshop:testDrive', function(source, data)
    -- data = { shop, model, price, duration, netId }
end)

Frage offen geblieben?

Schreib uns im Discord. Mit Konsolen-Auszug, Framework und Script-Version ist die erste Antwort meistens schon die Lösung.

Zum Support