Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » coding
Re: coding [message #271561 is a reply to message #271547] Sat, 07 July 2007 20:07 Go to previous messageGo to previous message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma:
Colonel
thank you guys it worked now
so
there is one problem
when i add another command like this
--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

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


--Written by RoShambo
--Remove credits and you will die!
--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

function OnChat(pID, Type, Message)
   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






so the command !buy arty and !fly would work but the !buildturret and !build tower commands wont work anymore
please help


http://www.roleplay2.com/downloads/siggy.jpg

[Updated on: Sat, 07 July 2007 20:08]

Report message to a moderator

 
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 Jan 13 10:12:21 MST 2025

Total time taken to generate the page: 0.00989 seconds