local GivePlugin = {} GivePlugin.__index = GivePlugin function GivePlugin:new() local t = {} setmetatable(t, GivePlugin) local w = Lua__cPlugin:new() tolua.setpeer(w, t) w:tolua__set_instance(w) return w end function GivePlugin:Initialize() self:SetName( "Give" ) self:SetVersion( 1 ) self:AddCommand("/give", " - gives someone materials.", "give") -- This only adds the command to the commandlist for /help self:BindCommand("/give", GiveCommand) return true -- Make sure you return true, otherwise the plugin is not added end function GiveCommand( Split, Player ) if( not Player:HasPermission( "lua.give" ) ) then return false end local Server = cRoot:Get():GetServer() if( #Split ~= 4 ) then Server:SendMessage( cChatColor.Green .. "Usage: /give [users] itemid [amount]", Player ) return true end local ItemID = tonumber( Split[3] ) if( #Split == 4 ) then LOG("Split 4: "..Split[4] ) Amount = tonumber( Split[4] ) LOG("Amount: " .. Amount ) if( Amount == nil or Amount < 1 or Amount > 256 ) then Server:SendMessage( cChatColor.Green .. "Invalid Amount !", Player ) return true end end local World = cRoot:Get():GetWorld() local OtherPlayer = World:GetPlayer( Split[2] ) local NewItem = cItem( ItemID, Amount ) OtherPlayer:GetInventory():AddItem( NewItem ) Server:SendMessage( cChatColor.Green .. "There you go !", OtherPlayer ) LOG("Gave " .. OtherPlayer:GetName() .. " " .. Amount .. " times " .. ItemID ) return true end Plugin = GivePlugin:new() cRoot:Get():GetPluginManager():AddPlugin( Plugin )