Commenting code
This commit is contained in:
parent
c55d70b65b
commit
68a88e4422
4 changed files with 22 additions and 15 deletions
|
@ -1,7 +1,9 @@
|
||||||
RegisterCommand('car', function(source, args)
|
RegisterCommand('car', function(source, args)
|
||||||
|
|
||||||
|
-- Default to futo
|
||||||
local vehicle = args[1] or "futo"
|
local vehicle = args[1] or "futo"
|
||||||
|
|
||||||
|
-- Check existance and if a vehicle
|
||||||
if not IsModelInCdimage(vehicle) or not IsModelAVehicle(vehicle) then
|
if not IsModelInCdimage(vehicle) or not IsModelAVehicle(vehicle) then
|
||||||
TriggerEvent("chat:addMessage", {
|
TriggerEvent("chat:addMessage", {
|
||||||
color = {255,0,0},
|
color = {255,0,0},
|
||||||
|
@ -10,34 +12,34 @@ RegisterCommand('car', function(source, args)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Load model
|
||||||
RequestModel(vehicle)
|
RequestModel(vehicle)
|
||||||
|
|
||||||
while not HasModelLoaded(vehicle) do
|
while not HasModelLoaded(vehicle) do
|
||||||
Wait(500)
|
Wait(500)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Position vehicle niceishly
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
local pos = GetEntityCoords(ped)
|
local pos = GetEntityCoords(ped)
|
||||||
local head, vect = GetClosestVehicleNodeWithHeading(pos.x, pos.y, pos.z, 1)
|
local head, vect = GetClosestVehicleNodeWithHeading(pos.x, pos.y, pos.z, 1)
|
||||||
local x,y,z = table.unpack(vect)
|
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, GetEntityHeading(ped), true, false)
|
||||||
-- local veh = CreateVehicle(vehicle, x, y, z, head, true, false)
|
|
||||||
SetVehicleOnGroundProperly(veh)
|
SetVehicleOnGroundProperly(veh)
|
||||||
|
|
||||||
|
-- Set register plate and a blip
|
||||||
SetVehicleNumberPlateText(veh, GetPlayerName())
|
SetVehicleNumberPlateText(veh, GetPlayerName())
|
||||||
|
|
||||||
TriggerEvent('chat:addMessage', {
|
|
||||||
color = {0,255,0},
|
|
||||||
args = { 'Tässä pyytämäsi upouusi ' .. vehicle }
|
|
||||||
})
|
|
||||||
|
|
||||||
local blip = AddBlipForEntity(veh)
|
local blip = AddBlipForEntity(veh)
|
||||||
SetBlipSprite(blip, 225)
|
SetBlipSprite(blip, 225)
|
||||||
SetBlipFlashes(blip, true)
|
SetBlipFlashes(blip, true)
|
||||||
SetBlipFlashTimer(blip, 10000)
|
SetBlipFlashTimer(blip, 10000)
|
||||||
|
|
||||||
|
-- Inform vehicle spawned
|
||||||
|
TriggerEvent('chat:addMessage', {
|
||||||
|
color = {0,255,0},
|
||||||
|
args = { 'Tässä pyytämäsi upouusi ' .. vehicle }
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Cleaning up. Let R* handle despawning
|
||||||
SetModelAsNoLongerNeeded(vehicle)
|
SetModelAsNoLongerNeeded(vehicle)
|
||||||
SetEntityAsNoLongerNeeded(veh)
|
SetEntityAsNoLongerNeeded(veh)
|
||||||
end, false)
|
end, false)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
RegisterCommand('die', function(source, args)
|
RegisterCommand('die', function(source, args)
|
||||||
|
|
||||||
|
-- Healt to zero
|
||||||
SetEntityHealth(PlayerPedId(), 0)
|
SetEntityHealth(PlayerPedId(), 0)
|
||||||
|
-- Chat about heart failure
|
||||||
TriggerEvent('chat:addMessage', {
|
TriggerEvent('chat:addMessage', {
|
||||||
color = {255,0,0},
|
color = {255,0,0},
|
||||||
args = { 'Sydämesi petti' }
|
args = { 'Sydämesi petti' }
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
RegisterCommand('gun', function(source, args)
|
RegisterCommand('gun', function(source, args)
|
||||||
giveGrantedWpn()
|
giveGrantedWpn()
|
||||||
|
|
||||||
TriggerEvent('chat:addMessage', {
|
TriggerEvent('chat:addMessage', {
|
||||||
color = {255,255,0},
|
color = {255,255,0},
|
||||||
args = { 'Hernepyssynne, olkaa hyvä.' }
|
args = { 'Hernepyssynne, olkaa hyvä.' }
|
||||||
})
|
})
|
||||||
end, false)RegisterCommand('wpn', function(source, args)
|
end, false)RegisterCommand('wpn', function(source, args)
|
||||||
giveGrantedWpn()
|
giveGrantedWpn()
|
||||||
|
|
||||||
TriggerEvent('chat:addMessage', {
|
TriggerEvent('chat:addMessage', {
|
||||||
color = {255,255,0},
|
color = {255,255,0},
|
||||||
args = { 'Hernepyssynne, olkaa hyvä.' }
|
args = { 'Hernepyssynne, olkaa hyvä.' }
|
||||||
})
|
})
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
AddEventHandler('playerSpawned', function()
|
AddEventHandler('playerSpawned', function()
|
||||||
giveGrantedWpn()
|
giveGrantedWpn()
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function giveGrantedWpn()
|
function giveGrantedWpn()
|
||||||
|
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
|
|
||||||
|
-- List of weapons to give
|
||||||
local weapons = {
|
local weapons = {
|
||||||
"WEAPON_PISTOL",
|
"WEAPON_PISTOL",
|
||||||
"WEAPON_STUNGUN",
|
"WEAPON_STUNGUN",
|
||||||
|
@ -38,6 +40,7 @@ function giveGrantedWpn()
|
||||||
"WEAPON_PETROLCAN"
|
"WEAPON_PETROLCAN"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Give weapon and set infinite ammo
|
||||||
for i,wpn in ipairs(weapons) do
|
for i,wpn in ipairs(weapons) do
|
||||||
GiveWeaponToPed(ped, wpn)
|
GiveWeaponToPed(ped, wpn)
|
||||||
SetPedInfiniteAmmo(ped, true, wpn)
|
SetPedInfiniteAmmo(ped, true, wpn)
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
RegisterCommand('pos', function(source, args)
|
RegisterCommand('pos', function(source, args)
|
||||||
|
|
||||||
|
-- get coordinates
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
local pos = GetEntityCoords(ped)
|
local pos = GetEntityCoords(ped)
|
||||||
|
|
||||||
|
-- tell coordinates
|
||||||
TriggerEvent('chat:addMessage', {
|
TriggerEvent('chat:addMessage', {
|
||||||
args = { pos.x .. "\n" .. pos.y.. "\n" .. pos.z }
|
args = { pos.x .. "\n" .. pos.y.. "\n" .. pos.z }
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue