diff --git a/car/carspawn.lua b/car/carspawn.lua index cf301d7..6e8d8ab 100644 --- a/car/carspawn.lua +++ b/car/carspawn.lua @@ -1,7 +1,9 @@ RegisterCommand('car', function(source, args) + -- Default to futo local vehicle = args[1] or "futo" + -- Check existance and if a vehicle if not IsModelInCdimage(vehicle) or not IsModelAVehicle(vehicle) then TriggerEvent("chat:addMessage", { color = {255,0,0}, @@ -10,34 +12,34 @@ RegisterCommand('car', function(source, args) return end + -- Load model RequestModel(vehicle) - while not HasModelLoaded(vehicle) do Wait(500) end + -- Position vehicle niceishly 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) - + -- Set register plate and a blip 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) + -- 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) SetEntityAsNoLongerNeeded(veh) end, false) diff --git a/die/die.lua b/die/die.lua index a2a2b91..43eab35 100644 --- a/die/die.lua +++ b/die/die.lua @@ -1,7 +1,8 @@ RegisterCommand('die', function(source, args) - + -- Healt to zero SetEntityHealth(PlayerPedId(), 0) + -- Chat about heart failure TriggerEvent('chat:addMessage', { color = {255,0,0}, args = { 'Sydämesi petti' } diff --git a/gun/guns4all.lua b/gun/guns4all.lua index fed371d..4fa2e18 100644 --- a/gun/guns4all.lua +++ b/gun/guns4all.lua @@ -1,25 +1,27 @@ RegisterCommand('gun', function(source, args) giveGrantedWpn() - TriggerEvent('chat:addMessage', { color = {255,255,0}, args = { 'Hernepyssynne, olkaa hyvä.' } }) end, false)RegisterCommand('wpn', function(source, args) giveGrantedWpn() - TriggerEvent('chat:addMessage', { color = {255,255,0}, args = { 'Hernepyssynne, olkaa hyvä.' } }) end, false) - AddEventHandler('playerSpawned', function() giveGrantedWpn() end, false) + + function giveGrantedWpn() + local ped = PlayerPedId() + + -- List of weapons to give local weapons = { "WEAPON_PISTOL", "WEAPON_STUNGUN", @@ -38,6 +40,7 @@ function giveGrantedWpn() "WEAPON_PETROLCAN" } + -- Give weapon and set infinite ammo for i,wpn in ipairs(weapons) do GiveWeaponToPed(ped, wpn) SetPedInfiniteAmmo(ped, true, wpn) diff --git a/pos/pos.lua b/pos/pos.lua index 1779b51..625f1ef 100644 --- a/pos/pos.lua +++ b/pos/pos.lua @@ -1,9 +1,10 @@ RegisterCommand('pos', function(source, args) - + -- get coordinates local ped = PlayerPedId() local pos = GetEntityCoords(ped) + -- tell coordinates TriggerEvent('chat:addMessage', { args = { pos.x .. "\n" .. pos.y.. "\n" .. pos.z } })