local Tunnel = module("vrp","lib/Tunnel")
local Proxy = module("vrp","lib/Proxy")
-----------------------------------------------------------------------------------
------------------------------------------------------
-- DEFAULTCUSTOM
-----------------------------------------------------------------------------------
------------------------------------------------------
local customize = {}
for i = 0,19 do
customize[i] = { 1,0 }
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- PLAYERSPAWN
-----------------------------------------------------------------------------------
------------------------------------------------------
AddEventHandler("vRP:playerSpawn",function(user_id,source)
local data = [Link](user_id)
if data then
if [Link] then
[Link] = nil
end
if [Link] then
if [Link].x == nil or [Link].y == nil or
[Link].z == nil then
[Link] = { x = 27.66, y = -1763.32, z = 29.32 }
end
else
[Link] = { x = 27.66, y = -1763.32, z = 29.32 }
end
[Link](source,[Link].x,[Link].y,[Link].z+0.5)
if [Link] then
[Link](source,[Link])
end
if [Link] then
[Link](source,[Link])
[Link](source,[Link])
TriggerClientEvent("statusHunger",source,[Link])
TriggerClientEvent("statusThirst",source,[Link])
TriggerClientEvent("statusStress",source,[Link])
end
if [Link] == nil then
[Link] = {}
end
if wps then
for k, v in pairs(wps) do
local am = [Link]([Link])
if am == "WEAPON_PISTOL_AMMO" and not pAmmo then
pAmmo = true
vRPclient.giveWeapons2(source, false, [Link],
[Link])
elseif am == "WEAPON_SMG_AMMO" and not gasAmmo then
gasAmmo = true
vRPclient.giveWeapons2(source, false, [Link],
[Link])
elseif am == "WEAPON_SHOTGUN_AMMO" and not sAmmo then
sAmmo = true
vRPclient.giveWeapons2(source, false, [Link],
[Link])
elseif am == "WEAPON_RIFLE_AMMO" and not shAmmo then
shAmmo = true
vRPclient.giveWeapons2(source, false, [Link],
[Link])
elseif am == "WEAPON_PETROLCAN_AMMO" and not fAmmo then
fAmmo = true
vRPclient.giveWeapons2(source, false, [Link],
[Link])
end
vRPclient.giveWeapons2(source, false, [Link])
end
end
[Link](source)
[Link](1000)
local playerData = [Link](user_id,"Clothings")
local resultData = [Link](playerData)
if resultData == nil then
resultData = "clean"
end
TriggerClientEvent("vrp_skinshop:skinData",source,resultData)
end
end)
-----------------------------------------------------------------------------------
------------------------------------------------------
-- UPDATEPOSITIONS
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link](x,y,z)
local source = source
local user_id = [Link](source)
if user_id then
local data = [Link](user_id)
if data then
[Link] = { x = [Link](x), y = [Link](y), z
= [Link](z) }
end
end
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- MATHLEGTH
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link](n)
return [Link](n*100)/100
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- TRYDELETEENTITY
-----------------------------------------------------------------------------------
------------------------------------------------------
RegisterServerEvent("tryDeleteEntity")
AddEventHandler("tryDeleteEntity",function(index)
TriggerClientEvent("syncDeleteEntity",-1,index)
end)
-----------------------------------------------------------------------------------
------------------------------------------------------
-- TRYCLEANENTITY
-----------------------------------------------------------------------------------
------------------------------------------------------
RegisterServerEvent("tryCleanEntity")
AddEventHandler("tryCleanEntity",function(index)
TriggerClientEvent("syncCleanEntity",-1,index)
end)
-----------------------------------------------------------------------------------
------------------------------------------------------
-- GRIDCHUNK
-----------------------------------------------------------------------------------
------------------------------------------------------
function gridChunk(x)
return [Link]((x + 8192) / 128)
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- TOCHANNEL
-----------------------------------------------------------------------------------
------------------------------------------------------
function toChannel(v)
return (v.x << 8) | v.y
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- GETGRIDZONE
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link](x,y)
local gridChunk = vector2(gridChunk(x),gridChunk(y))
return toChannel(gridChunk)
end