| Home » Renegade Discussions » Mod Forum » coding 
	| 
		
			| Re: coding [message #271674 is a reply to message #271501] | Sun, 08 July 2007 09:09   |  
			| 
				
				|  |  jnz Messages: 3396
 Registered: July 2006
 Location: 30th century
 
	Karma: 
 | General (3 Stars) |  |  |  
	| 
--Written by RoShambo
--Remove credits and you will die!
--Sample plugin for you, for the commands !build tower and !build turret
--VB style language, very easy to learn!
function printf(...) 
	io.write(string.format(unpack(arg))) 
end
function InputConsole(...)
	Console_Input(string.format(unpack(arg)))
end
Object = 0
function OnChat(pID, Type, Message)
	if Message == "!build turret" then
	local pos = Get_Position(Get_GameObj(pID))
		if Get_Team(pID) == 0 then
			if Get_Money(pID) < 600 then
				InputConsole("ppage %d You need 600 credits", pID)
			else
				turret = Create_Object("Nod_Turret_MP_Improved", pos)
				if turret == nil then
					InputConsole("ppage %d Error creating turret", pID)
				else
					Disable_Physical_Collisions(turret)
					Set_Money(pID, Get_Money(pID)-600)
				end
			end
		else
			InputConsole("ppage %d You need to be on Nod", pID)
		end
	end
	if Message == "!build tower" then
		local pos = Get_Position(Get_GameObj(pID))
		if Get_Team(pID) == 1 then
			if Get_Money(pID) < 600 then
				InputConsole("ppage %d You need 600 credits", pID)
			else
				pos.SetZ(pos.GetZ()+8)
				turret = Create_Object("GDI_Guard_Tower", pos)
				if turret == nil then
					InputConsole("ppage %d Error creating tower", pID)
				else
					Disable_Physical_Collisions(turret)
					Set_Money(pID, Get_Money(pID)-600)
				end
			end
		else
			InputConsole("ppage %d You need to be on GDI", pID)
		end
	end
                   function OnChat(pID, Type, Message)
	if Message == "light" then
	local pos = Get_Position(Get_GameObj(pID))
		if Get_Team(pID) == 0 then
			if Get_Money(pID) < 1 then
				InputConsole("ppage %d You need 1 credit", pID)
			else
				turret = Create_Object("Spotlight", pos)
				if turret == nil then
					InputConsole("ppage %d Error creating turret", pID)
				else
					Disable_Physical_Collisions(turret)
					Set_Money(pID, Get_Money(pID)-1)
				end
			end
		else
			InputConsole("ppage %d You need to be on Nod", pID)
		end
	end
         if Message == "!buy arty" then
      if Purchase_Item(Get_GameObj(pID), 450) == 1 then
         local pos = Get_Position(Get_GameObj(pID))
         pos:AssignZ(pos:GetZ()+5)
         pos:AssignX(pos:GetX()+5)
         Create_Object("Nod_Mobile_Artillery_Player", pos)
      else
         InputConsole("ppage %d You don't have enough money", pID)
      end
   end
   if Message == "!fly" then
      Toggle_Fly_Mode(Get_GameObj(pID))
   end
end
function OnPlayerJoin(pID, Nick)
end
function OnPlayerLeave(pID)
end
function OnHostMessage(ID, Type, Message)
end
function OnLevelLoaded()
	
end
function OnLevelEnded()
end
function OnConsoleOutput(Message)
end
function OnDDERecived(Message)
end
function OnObjectCreate(Object)
end
 |  
	|  |  | 
	Goto Forum:
	|  |  | coding By: HORQWER  on Sat, 07 July 2007 14:43 |  
	|  |  | Re: coding |  
	|  |  | Re: coding By: HORQWER  on Sat, 07 July 2007 15:03 |  
	|  |  | Re: coding |  
	|  |  | Re: coding By: HORQWER  on Sat, 07 July 2007 15:06 |  
	|  |  | Re: coding |  
	|  |  | Re: coding |  
	|  |  | Re: coding By: jnz  on Sat, 07 July 2007 15:35 |  
	|  |  | Re: coding By: HORQWER  on Sat, 07 July 2007 16:40 |  
	|  |  | Re: coding |  
	|  |  | Re: coding By: jnz  on Sat, 07 July 2007 17:40 |  
	|  |  | Re: coding |  
	|  |  | Re: coding By: HORQWER  on Sat, 07 July 2007 20:07 |  
	|  |  | Re: coding By: jnz  on Sat, 07 July 2007 20:22 |  
	|  |  | Re: coding By: HORQWER  on Sat, 07 July 2007 20:33 |  
	|  |  | Re: coding |  
	|  |  | Re: coding By: dead6re  on Sun, 08 July 2007 06:27 |  
	|  |  | Re: coding By: jnz  on Sun, 08 July 2007 06:43 |  
	|  |  | Re: coding By: dead6re  on Sun, 08 July 2007 08:41 |  
	|  |  | Re: coding By: HORQWER  on Sun, 08 July 2007 08:59 |  
	|  |  | Re: coding By: jnz  on Sun, 08 July 2007 09:09 |  
	|  |  | Re: coding By: HORQWER  on Sun, 08 July 2007 11:12 |  
	|  |  | Re: coding By: dead6re  on Mon, 09 July 2007 01:16 |  
	|  |  | Re: coding By: HORQWER  on Mon, 09 July 2007 06:49 |  
	|  |  | Re: coding By: reborn  on Mon, 09 July 2007 06:56 |  
 
 Current Time: Fri Oct 31 04:54:38 MST 2025 
 Total time taken to generate the page: 0.01051 seconds |