- Initiateur de la discussion
- Banni
Estebouboun
Geek
- Messages
- 205
- Score réaction
- 6
- Points
- 95
Bonjour je suis entrain de travailler sur un addons j'ai un problème donc je viens voir si ya pas des gens qui pourrais disoudre ce beug <3
[ERROR] addons/delivery_man_system/lua/entities/npc_delivery/init.lua:17: attempt to concatenate global 'Delivery_Point_Name' (a nil value)
1. unknown - addons/delivery_man_system/lua/entities/npc_delivery/init.lua:17
Code:
--[[
To contact the creator of the addon : https://steamcommunity.com/id/estebouboun/
--]]
-- Translation FR : https://pastebin.com/PqzzqPPx
deliveryadmin1 = "You must configure the spawn location of the vehicle with the command : !setcarlivraison"
deliveryadmin2 = "You must define a position with the command !setposlivraison"
deliveryadmin3 = "You have to spawn a vehicle, watch it and then make the order"
deliveryadmin4 = "You have just defined the new point of appearance of the deliveryman's vehicles !"
deliveryadmin5 = "You just added the point ".. Delivery_Point_Name .." to the list of the deliveryman."
deliveryadmin6 = "This name is not accepted."
deliveryadmin7 = "This point already exists, found another name."
deliveryadmin8 = "Point " .. Delivery_Point_Name .. " has been deleted !"
deliveryadmin9 = "This point does not exist anymore ..."
-- Translation FR : https://pastebin.com/dP7GJCtQ
delivery1 = "Your vehicle has arrived !"
delivery2 = "You have returned your vehicle !"
delivery3 = "You must be " .. Job_Delirery .. " to use this NPC"
delivery4 = "I can not provide you with the vehicle, you do not have enough money ..."
delivery5 = "You have to go back to the warehouse."
delivery6 = "You win " .. reward_delivery .. " $ for your delivery"
--]]
--[[
CONFIGURATION OF ADDON
In-game :
!setcarlivraison : Define the location of the vehicle spawn. / Définir l'emplacement du spawn du véhicule.
!setposlivraison : Allows you to define the locations of deliveries. / Vous permet de définir les emplacements des livraisons.
--]]
local Price_Truck = 500 -- Truck price / Prix du camion
local reward_delivery = 200 -- Reward for delivery / Récompense pour une livraison
local Job_delivery_or_not = "Yes" -- If you want only one job to be able to use the delivery system | Yes or No / Si vous ne voulez qu'un seul travail pour pouvoir utiliser le système de distribution | Yes ou No
local Job_Delirery = "Delivery Man" -- The exact name of the Delivery Job / Le nom exact du job de livraison
local ProgressBarTime = 0.1 -- The lower the number, the longer it will take to deliver the object at the point (1 = Very fast | 0.1 = normal | 0.01 = Slow | 0.001 = extremely slow) / Plus le nombre est bas, plus la livraison de l'objet au point est longue (1 = très rapide | 0.1 = normal | 0.01 = lent | 0.001 = extrêmement lent)
--[[
END OF CONFIGURATION OF ADDON
--]]
AddCSLuaFile( "config.lua" )
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
include('config.lua')
resource.AddFile( "materials/livreur/estebouboun.png" )
resource.AddFile( "materials/livreur/iconl.png" )
util.AddNetworkString( "ELS_Livraison::OpenMenu" )
util.AddNetworkString( "ELS_Livraison::SpawnCamion" )
util.AddNetworkString( "ELS_Livraison::StartLivraison" )
util.AddNetworkString( "ELS_Livraison::PointOK" )
util.AddNetworkString( "ELS_Livraison::StartEntrepot" )
util.AddNetworkString( "ELS_Livraison::EntrepotOK" )
util.AddNetworkString( "ELS_Livraison::OpenSetPosVeh" )
util.AddNetworkString( "ELS_Livraison:SetPosVeh" )
util.AddNetworkString( "ELS_Livraison:SendNamePosLi" )
util.AddNetworkString( "ELS_Livraison:CreateNamePosLi" )
util.AddNetworkString( "ELS_Livraison:RemoveNamePosLi" )
function ENT:Initialize( ) self:SetModel("models/Humans/Group02/Female_04.mdl") self:SetHullType(HULL_HUMAN) self:SetHullSizeNormal() self:SetNPCState(NPC_STATE_SCRIPT) self:SetSolid(SOLID_BBOX) self:SetUseType(SIMPLE_USE) self:DropToFloor() self:CapabilitiesAdd(CAP_ANIMATEDFACE) SetNPCpos(self:GetPos())
end
function SetNPCpos(pos) timer.Simple( 0, function() -- Mandatory !! (because of PermaProps) if(file.Exists( "delivery/npcpos.txt", "DATA" )) then local oldpost = file.Read( "delivery/npcpos.txt", "DATA" ) for _, ent in pairs(ents.FindInSphere(Vector( oldpost ), "1")) do if (Vector( oldpost )) != pos then -- To avoid a while true of PermaProps .. ent:Remove() end end file.Write( "delivery/npcpos.txt", tostring(pos)) else file.CreateDir( "delivery" ) file.Write( "delivery/npcpos.txt", tostring(pos) ) end end)
end
function ENT:AcceptInput(activator, ply, caller ) if IsValid( ply ) and ply:IsPlayer() then if Job_delivery_or_not == "Yes" then if ply:getDarkRPVar( "job" ) == Job_Delirery then if(!file.Exists( "delivery/carspawnpos.txt", "DATA" )) then DarkRP.notify(ply, 1, 5, (deliveryadmin1)) else net.Start("ELS_Livraison::OpenMenu") net.WriteBool(ply:GetNWBool( "Possedeveh" )) net.WriteString(Price_Truck) net.Send(caller) end else DarkRP.notify(ply, 1, 5, (delivery3)) end else if(!file.Exists( "delivery/carspawnpos.txt", "DATA" )) then DarkRP.notify(ply, 1, 5, (deliveryadmin1)) else net.Start("ELS_Livraison::OpenMenu") net.WriteBool(ply:GetNWBool( "Possedeveh" )) net.WriteString(Price_Truck) net.Send(caller) end end end
end
net.Receive( "ELS_Livraison::SpawnCamion", function( len, ply ) if IsValid( ply ) and ply:IsPlayer() then local Possedeveh = ply:GetNWBool( "Possedeveh" ) if Possedeveh then ply:SetNWBool( "Possedeveh", false ) local Nameofveh = ply:GetNWString( "Nameofceh" ) if IsValid( Nameofveh ) and Nameofveh:CPPIGetOwner() == ply then Nameofveh:Remove() end DarkRP.notify(ply, 0, 4, (delivery2)) ply:SendLua( 'hook.Remove( "HUDPaint", "ELS_Livraison::HUDPaint" ) hook.Remove( "HUDPaint", "ELS_Entrepot::HUDPaint" )' ) else local MoneyofUser = (ply:getDarkRPVar( "money" ) or 0) if MoneyofUser >= Price_Truck then if(file.Exists( "delivery/carspawnpos.txt", "DATA" )) then local AllPos = file.Find("delivery/livraisonpos/*.txt", "DATA") local NumPos = table.Count(AllPos) if (NumPos >= 1) then local SpawnPos = file.Read( "delivery/carspawnpos.txt", "DATA" ) ply:addMoney(-Price_Truck) ent = ents.Create( "prop_vehicle_jeep" ) ent:SetModel( "models/lonewolfie/merc_sprinter_lwb.mdl" ) ent:SetKeyValue( "vehiclescript", "scripts/vehicles/lwcars/merc_sprinter_swb.txt" ) ent:SetPos(Vector(SpawnPos)) ent:SetName("erc_sprinter_lwb") ent:SetSkin("6") ent:Spawn() ent:CPPISetOwner(ply) Owner = ent:CPPIGetOwner() doorData = ent:getDoorData() doorData.owner = ply:UserID() DarkRP.updateDoorData(ent, "owner") ent:keysLock() ent:Activate() DarkRP.notify(ply, 0, 4, (delivery1)) SendPosTouser (ply) ply:SetNWString( "Nameofceh", ent ) else DarkRP.notify(ply, 1, 4, (deliveryadmin2)) end else DarkRP.notify(ply, 1, 5, (deliveryadmin1)) end else DarkRP.notify(ply, 1, 4, (delivery4)) end end end
end )
function SendPosTouser (ply) local AllPos = file.Find("delivery/livraisonpos/*.txt", "DATA") local NumPos = table.Count(AllPos) if (NumPos >= 1) then local NameofPos = table.Random( AllPos ) local PosofName = file.Read( "delivery/livraisonpos/" .. NameofPos, "DATA" ) local StringName = string.gsub(NameofPos , ".txt" , "") ply:SetNWBool( "Possedeveh", true ) ply:SetNWBool("LivraisonEnCours", true) ply:SetNWBool("PointOK", false) ply:SetNWBool("PointOKnospam", false) ply:SetNWBool("EntrepotOKnospam", false) net.Start("ELS_Livraison::StartLivraison") net.WriteString(StringName) net.WriteVector(Vector(PosofName)) net.WriteString(ProgressBarTime) net.Send(ply) else DarkRP.notify(ply, 1, 6, (setlivraisonmsg)) end
end
net.Receive( "ELS_Livraison::PointOK", function( len, ply ) if IsValid( ply ) and ply:IsPlayer() then ply:SetNWBool("LivraisonEnCours", false) ply:SetNWBool("PointOK", true) ply:SetNWBool("PointOKnospam", true) ply:SetNWBool("EntrepotOKnospam", false) DarkRP.notify(ply, 0, 10, (delivery5)) local posentrepot = file.Read( "delivery/npcpos.txt", "DATA" ) net.Start("ELS_Livraison::StartEntrepot") net.WriteVector(Vector(posentrepot)) net.Send(ply) end
end)
net.Receive( "ELS_Livraison::EntrepotOK", function( len, ply ) local posnpc = file.Read( "delivery/npcpos.txt", "DATA" ) if Vector(posnpc):Distance(ply:GetPos()) < 500 then timer.Simple( 0.5, function() ply:SetNWBool("EntrepotOKnospam", true) ply:addMoney(reward_delivery) DarkRP.notify(ply, 0, 2, (delivery6)) ply:SendLua( 'hook.Remove( "HUDPaint", "ELS_Livraison::HUDPaint" ) hook.Remove( "HUDPaint", "ELS_Entrepot::HUDPaint" )' ) SendPosTouser (ply) end) else DarkRP.notify(ply, 1, 3, "ERROR.") end
end)
hook.Add( "PlayerSay", "SetCarLivraison", function( ply, text, public ) if ( string.lower( text ) == "!setcarlivraison" ) then if ( ply:IsSuperAdmin() ) then local tr = ply:GetEyeTrace() if ( IsValid( tr.Entity ) and tr.Entity:IsVehicle() ) then local Carpos = (tr.Entity:GetPos()) if(!file.Exists( "delivery/carspawnpos.txt", "DATA" )) then net.Start("ELS_Livraison::OpenSetPosVeh") net.WriteString("NewPos") net.WriteVector(Carpos) net.Send(ply) return "" else net.Start("ELS_Livraison::OpenSetPosVeh") net.WriteString("FirstPos") net.WriteVector(Carpos) net.Send(ply) return "" end else DarkRP.notify(ply, 1, 5, (deliveryadmin3)) return "" end end end
end )
net.Receive( "ELS_Livraison:SetPosVeh", function( len, ply ) if ( ply:IsSuperAdmin() ) then local NewCarPos = net.ReadVector() file.Write( "delivery/carspawnpos.txt", tostring(NewCarPos) ) DarkRP.notify(ply, 0, 5, (deliveryadmin4)) end
end)
hook.Add( "PlayerSay", "SetPosLivraison", function( ply, text, public ) if ( string.lower( text ) == "!setposlivraison" ) then if ( ply:IsSuperAdmin() ) then file.CreateDir( "delivery/livraisonpos" ) local list = file.Find("delivery/livraisonpos/*.txt", "DATA") net.Start("ELS_Livraison:SendNamePosLi") net.WriteTable(list) net.Send(ply) return "" end end
end )
net.Receive( "ELS_Livraison:CreateNamePosLi", function( len, ply ) if ( ply:IsSuperAdmin() ) then local Delivery_Point_Name = net.ReadString() local Posdupoint = ply:GetPos() if(!file.Exists("delivery/livraisonpos/".. Delivery_Point_Name ..".txt", "DATA"))then if (Delivery_Point_Name != "") then -- Evite un bug graphique file.Write( "delivery/livraisonpos/".. Delivery_Point_Name ..".txt", tostring(Posdupoint) ) DarkRP.notify(ply, 0, 4, (deliveryadmin5)) else DarkRP.notify(ply, 1, 4, (deliveryadmin6)) end else DarkRP.notify(ply, 1, 4, (deliveryadmin7)) end end
end )
net.Receive( "ELS_Livraison:RemoveNamePosLi", function( len, ply ) if ( ply:IsSuperAdmin() ) then local Delivery_Point_Name = net.ReadString() if(file.Exists("delivery/livraisonpos/".. Delivery_Point_Name ..".txt", "DATA"))then file.Delete( "delivery/livraisonpos/".. Delivery_Point_Name ..".txt" ) DarkRP.notify(ply, 0, 4, (deliveryadmin8)) else DarkRP.notify(ply, 1, 4, (deliveryadmin9)) end end
end )
local isVehicleAccepted = false
[ERROR] addons/delivery_man_system/lua/entities/npc_delivery/init.lua:17: attempt to concatenate global 'Delivery_Point_Name' (a nil value)
1. unknown - addons/delivery_man_system/lua/entities/npc_delivery/init.lua:17