Хочется сделать так, чтоб при покупке автодоната выдавался транспорт игроку. Система кардилера - Williams Car Delaer.
Документация
Serverside
hook: WCD::SpawnedVehicle - ply, veh, isEnt - called after player spawned vehicle
hook: WCD::AllowedToSpawnVehicle - ply, WCD ID, vehicle class - return false, msg to prevent
To find a Vehicle ID, simply look in !wcd > Edit vehicle. all vehicles are named as: Display name (#123456).
In this case, 123456 is the id.
To use with a Donation System, there are two choices!
Console Command Actions:
wcd_givevehicle "STEAM_0:1:234567" 123456
wcd_takevehicle "STEAM_0:1:234567" 123456
Lua functions:
WCD:GiveVehicleToSteamID( "STEAM_0:1:234567", 123456 )
WCD:TakeVehicleFromSteamID( "STEAM_0:1:234567", 123456 )
It depends on your donation system! Usually there's some replacement string like {{ steam_id_32 }}, put this in quotemarks and it will work fine. Like this: wcd_givevehicle "{{ steam_id_32 }}" 123456
These examples would give the user with this SteamID, the vehicle 123456.
WCD.List[ uniqueId ] contains the vehicle data (always on server, not always on client unless requested via dealer/admin menu)
player meta:
:WCD_GetSpecifics( id ) - returns a table with player's specifics for that id ( { fuel = 10, udnErglow = Color() etc }
:WCD_GetOwned() - returns a table { id = true }
:WCD_GetUnOwned()
:WCD_AddVehicle( id ) - gives player vehicle
:WCD_RemoveVehicle( id )
:WCD_HasAccess( id )
:WCD_AddActiveCar( vehicle ) - this table is checked when spawning a vehicle to see maxSpawned
vehicle meta:
Each has a Set version too
:WCD_GetId() - returns the vehicle's uniqueId
:WCD_GetFuel() - returns the fuel amount
:WCD_GetFuelMax() - returns the max fuel
:WCD_GetNitro() - returns the nitro level
:WCD_GetUnderglow() - get active status
:WCD_GetUnderglowColor() - get color