Add files via upload
This commit is contained in:
parent
8bde47b30a
commit
075a3a2f3b
9 changed files with 133 additions and 0 deletions
3
car/__resource.lua
Normal file
3
car/__resource.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
|
||||
|
||||
client_script 'carspawn.lua'
|
44
car/carspawn.lua
Normal file
44
car/carspawn.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
RegisterCommand('car', function(source, args)
|
||||
|
||||
local vehicle = args[1] or "futo"
|
||||
|
||||
if not IsModelInCdimage(vehicle) or not IsModelAVehicle(vehicle) then
|
||||
TriggerEvent("chat:addMessage", {
|
||||
color = {255,0,0},
|
||||
args = { vehicle .. ' ei ole ajoneuvo tai sitä ei löydy.' }
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
RequestModel(vehicle)
|
||||
|
||||
while not HasModelLoaded(vehicle) do
|
||||
Wait(500)
|
||||
end
|
||||
|
||||
local ped = PlayerPedId()
|
||||
local pos = GetEntityCoords(ped)
|
||||
local head, vect = GetClosestVehicleNodeWithHeading(pos.x, pos.y, pos.z, 1)
|
||||
local x,y,z = table.unpack(vect)
|
||||
-- local veh = CreateVehicle(vehicle, pos.x+5, pos.y+5, pos.z, GetEntityHeading(ped), true, false)
|
||||
local veh = CreateVehicle(vehicle, x, y, z, GetEntityHeading(ped), true, false)
|
||||
-- local veh = CreateVehicle(vehicle, x, y, z, head, true, false)
|
||||
SetVehicleOnGroundProperly(veh)
|
||||
|
||||
|
||||
SetVehicleNumberPlateText(veh, GetPlayerName())
|
||||
|
||||
TriggerEvent('chat:addMessage', {
|
||||
color = {0,255,0},
|
||||
args = { 'Tässä pyytämäsi upouusi ' .. vehicle }
|
||||
})
|
||||
|
||||
local blip = AddBlipForEntity(veh)
|
||||
SetBlipSprite(blip, 225)
|
||||
SetBlipFlashes(blip, true)
|
||||
SetBlipFlashTimer(blip, 10000)
|
||||
|
||||
SetModelAsNoLongerNeeded(vehicle)
|
||||
SetEntityAsNoLongerNeeded(veh)
|
||||
end, false)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue