Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » coding
coding [message #271501] Sat, 07 July 2007 14:43 Go to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
guys if i made a code

like here i found this code and i want to use it on my server how do i make it work on my server
here is the code
--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


http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271502 is a reply to message #271501] Sat, 07 July 2007 15:00 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
im sure he will be here to answer it but whats does it do? lol
Re: coding [message #271503 is a reply to message #271502] Sat, 07 July 2007 15:03 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
no it is just a code i need to know how can i make codes work on my server

http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271505 is a reply to message #271501] Sat, 07 July 2007 15:05 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
u mean where to put it in ur source files?
Re: coding [message #271506 is a reply to message #271505] Sat, 07 July 2007 15:06 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
like when i made a code in visual c++ then what do i do (save it? SaveIt As What? What else do i do to make it work on my setrver )

http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271510 is a reply to message #271501] Sat, 07 July 2007 15:18 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
u using ssgm or ssaow 15.?
Re: coding [message #271514 is a reply to message #271501] Sat, 07 July 2007 15:33 Go to previous messageGo to next message
futura83
Messages: 1285
Registered: July 2006
Location: England
Karma: 0
General (1 Star)
Viva la Resistance!
From the looks of your code, that is the LUA plugin dan made.

My guess is, what you need to do is, get SSGM, and config it to load the luaplugin, then have the plugin load that...i think...im just going off what i've read...


This is a signature. Reading this is wasting your time.
Re: coding [message #271515 is a reply to message #271501] Sat, 07 July 2007 15:35 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
http://www.renegadeforums.com/index.php?t=msg&th=25026&start=0&rid=2 1311

http://www.renegadeforums.com/index.php?t=msg&th=25096&start=0&rid=2 1311

[Updated on: Sat, 07 July 2007 15:36]

Report message to a moderator

Re: coding [message #271532 is a reply to message #271515] Sat, 07 July 2007 16:40 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
guys i have ssgm but i don know how to install luaplugin can u help me with that too


http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271534 is a reply to message #271501] Sat, 07 July 2007 17:05 Go to previous messageGo to next message
AoBfrost is currently offline  AoBfrost
Messages: 1248
Registered: March 2007
Karma: 0
General (1 Star)
Coding with lua is good, easy, but sometimes buggy, coding with c++ works better but is harder, open the file ssgm.vprogj to start you off, then open other files it list inside of the source, if you cant edit Ssgm without any knowledge of what you are doing, then your screwed.

http://i4.photobucket.com/albums/y133/FMAROCKS/godotsig.gif
Scrin wrote on Fri, 05 October 2007 12:19

''whoa im the photoshop''

KANE LIVES!!!
Re: coding [message #271537 is a reply to message #271501] Sat, 07 July 2007 17:40 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
Lua is not buggy.


to install find [Plugins] in SSGM.ini and put
01=LuaPlugin.dll
under it.

Re: coding [message #271547 is a reply to message #271501] Sat, 07 July 2007 18:25 Go to previous messageGo to next message
AoBfrost is currently offline  AoBfrost
Messages: 1248
Registered: March 2007
Karma: 0
General (1 Star)
DOnt use the [plugin]01= thing thats already there, under pluggin settings, at the bottom it will say this

"[plugin]"

make a new line under it and write "01="

after the = sign, then add luaplugin.dll

but seeming how smart he is, he may not even understand lua...I didnt at first, but I do now a bit more, but still some advanced things confusz0r me.


http://i4.photobucket.com/albums/y133/FMAROCKS/godotsig.gif
Scrin wrote on Fri, 05 October 2007 12:19

''whoa im the photoshop''

KANE LIVES!!!
Re: coding [message #271561 is a reply to message #271547] Sat, 07 July 2007 20:07 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
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

Re: coding [message #271567 is a reply to message #271501] Sat, 07 July 2007 20:22 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
no
EDIT:
--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

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
   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


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

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

Report message to a moderator

Re: coding [message #271570 is a reply to message #271567] Sat, 07 July 2007 20:33 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
ho u did that

http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271580 is a reply to message #271501] Sat, 07 July 2007 21:56 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
^,^

Support for the LuaPlugin is at DCOM Productions .NET's forums. Not here.


-MathK1LL

[Updated on: Sat, 07 July 2007 21:56]

Report message to a moderator

Re: coding [message #271635 is a reply to message #271501] Sun, 08 July 2007 06:27 Go to previous messageGo to next message
dead6re is currently offline  dead6re
Messages: 602
Registered: September 2003
Karma: 0
Colonel
The bug you had with your LUA code was that it had a duplicate function as it seemed you had copyied and pasted the old code. Just edit the current code, don't remake functions!

Let all your wishes be granted except one, so you will still have something to strieve for.
Re: coding [message #271637 is a reply to message #271501] Sun, 08 July 2007 06:43 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
What functions? wWhat code?
Re: coding [message #271667 is a reply to message #271501] Sun, 08 July 2007 08:41 Go to previous messageGo to next message
dead6re is currently offline  dead6re
Messages: 602
Registered: September 2003
Karma: 0
Colonel
I was refering to message by HORQWER a couple posts up as he didn't understand how you managed to get the code working.



Let all your wishes be granted except one, so you will still have something to strieve for.
Re: coding [message #271671 is a reply to message #271667] Sun, 08 July 2007 08:59 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
what is wrong with this code i made a new command called light but it does not work how can i fix it

--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

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







http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271674 is a reply to message #271501] Sun, 08 July 2007 09:09 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
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
Re: coding [message #271686 is a reply to message #271674] Sun, 08 July 2007 11:12 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
ok thanks

http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271873 is a reply to message #271501] Mon, 09 July 2007 01:16 Go to previous messageGo to next message
dead6re is currently offline  dead6re
Messages: 602
Registered: September 2003
Karma: 0
Colonel
HORQWER: Stop pasting it twice or something. The reason it never works is because you have two copies of every command, can't you see that?

Let all your wishes be granted except one, so you will still have something to strieve for.

[Updated on: Mon, 09 July 2007 01:18]

Report message to a moderator

Re: coding [message #271922 is a reply to message #271873] Mon, 09 July 2007 06:49 Go to previous messageGo to next message
HORQWER is currently offline  HORQWER
Messages: 667
Registered: September 2006
Location: Under my bed (lolz)
Karma: 0
Colonel
oh i'm sorry i post it by accsident i knew i should not have two of them i'm sorry

http://www.roleplay2.com/downloads/siggy.jpg
Re: coding [message #271923 is a reply to message #271501] Mon, 09 July 2007 06:56 Go to previous message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
No, he means the same function twice in your source. He is not referring to quotes.





[Updated on: Mon, 09 July 2007 07:16]

Report message to a moderator

Previous Topic: Another SSGM Question
Next Topic: Need help finding a script
Goto Forum:
  


Current Time: Thu Nov 28 22:05:50 MST 2024

Total time taken to generate the page: 0.01705 seconds