Hello everybody, First of all : Sorry for the post as I know that there are very much posts of this topic, but none of them helped me out.
So my problem is : I would like to put vehicles in my cider RP gamemode and the problem is that I get an error.
Things that do work : "
1.I can manufacture (purchase) the vehicle
2.I can pick it up and put it in my inventory (after manufacturing it)"
Things that need to be done / fixed : "
1.Use button doesn't work only gives a error ("L 08/31/2012 - 19:20:53: Lua Error: [gamemodes\cider\gamemode\core\items\sh_jeep.lua:25] attempt to index global 'ply' (a nil value)")
2.No drop button
3.No button"
My whole sh_jeep.lua code (\My Gmod Serv root Location\orangebox\garrysmod\gamemodes\cider\gamemode\core\items) [B]NOTE : <-- I'm not sure why there is a space between gamem-ode, Sorry, only on FP : NOTE--[/B] :
[code]
--[[
Name: "sh_jeep.lua".
Product: "Cider (Roleplay)".
--]]
-- Define the item table.
local ITEM = {};
-- Set some information about the item.
ITEM.name = "Jeep";
ITEM.size = 5;
ITEM.cost = 2;
ITEM.team = TEAM_CITIZEN;
ITEM.model = "models/buggy.mdl";
ITEM.batch = 1;
ITEM.store = true;
ITEM.plural = "Jeeps";
ITEM.uniqueID = "jeep";
ITEM.description = "A jeep to get around with.";
-- Called when a player uses the item.
function ITEM:onUse(ply, player, item)
local car = ents.Create("prop_vehicle_jeep_old")
local trace = { }
trace.start = ply:EyePos()
trace.endpos = trace.start + ply:GetAimVector() * 512
trace.filter = ply
local tr = util.TraceLine(trace)
car:SetModel(ITEM.model)
car:SetKeyValue("vehiclescript","scripts/vehicles/jeep_test.txt")
car:SetPos(player:GetEyeTrace())
car:Spawn()
item:Remove()
Msg("onUse")
return false
end;
function ITEM:onPickup() end;
function ITEM:canManufacture() end;
cider.item.register(ITEM);
[/code]
Line 25 is : trace.start = ply:EyePos()
Oh and another lil' question you maybe got time for : Is it possible + stable to run ULX & Ulib with Cider?
Thanks in advance,
--Dubple (Roman)
Try changing ply:EyePos() to player:EyePos()
Test different combinations of ply and player.
Didn't work, now it's Lua Error: [gamemodes\cider\gamemode\core\items\sh_jeep.lua:25] attempt to index [B](NOTICE THIS 1 CHANGED! : ) local[/B] 'player' (a nil value) just changed ply ---> player
BUMP
ply:GetEyeTrace()
Thank you sir, I'll try it now!
Sorry, you need to Log In to post a reply to this thread.