Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » coding
Re: coding [message #271674 is a reply to message #271501] Sun, 08 July 2007 09:09 Go to previous messageGo to previous message
jnz is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Another SSGM Question
Next Topic: Need help finding a script
Goto Forum:
  


Current Time: Mon Nov 25 06:18:52 MST 2024

Total time taken to generate the page: 0.01029 seconds