HyperGaming Network

Other Forums => Development => Old Forum Boards => Scrapyard => Coding => Topic started by: Silver Knight on 03-06-2010

Title: Underdone Snippets/Coding/Discussion Thread
Post by: Silver Knight on 03-06-2010
This thread is dedicated to the gamemode "Underdone" You can discuss and talk about various things here, ill also post code snippets for certain features/fixes/bugs that i have done.

Item Creation Snippet (Allows you to create a item which appears infront of you)

For all you new coders, just copy and paste this code and put it at the bottom of "admin_commands" and while ingame (and have admin) simply type as stated above: UD_Admin_CreateItem and then your item class

So if i want some coffee UD_Admin_CreateItem item_drink_coffee

--Credit Goes To Last.Exile For Cmd
concommand.Add("UD_Admin_CreateItem", function(ply, command, args)
if ply:IsAdmin() && args[1] then -- Make sure the player is a admin!
   local strItem = args[1] -- If the class entered is valid (not nil etc) Continue!
CreateWorldItem(strItem, 1, ply:GetPos() + Vector(0, 0, 30)) -- Spawn at Ply's Pos
print (ply:Nick() .." Spawned ".. args[1]) -- Let's print it to console to log it
end
end)