Basically I have a player_extension lua file in my gamemode folder that is the following
local meta = FindMetaTable( "Player" ) if (!meta) then return end function meta:GivePower( weaponstring ) print("Powers!") self:Give(weaponstring) end
and then I try to Access the function in an entity’s init file with the following
-- ENT:DoPowers - This is the function that do the actual powerup code, there is also code in sent_melon_base -- function ENT:DoPowers(Ent) --Ent is the ball... local ply -- We Want to do stuff to the Player/Ball here if (Ent:GetOwner():IsValid()) then ply = Ent:GetOwner() print("player valid") end -- Balloon(1) -- if (self.PowerupType == 1) then ply:PrintMessage(4, "Shoot At Other Players to attach balloons to them.") Ent:GetOwner():GivePower("weapon_crowbar") end end
Problem is that the function GivePowers returns nil in the console, Am i doing something wrong here?