Home » Renegade Discussions » Mod Forum » coding
coding [message #271501] |
Sat, 07 July 2007 14:43 |
|
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
|
|
|
Re: coding [message #271502 is a reply to message #271501] |
Sat, 07 July 2007 15:00 |
_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 #271514 is a reply to message #271501] |
Sat, 07 July 2007 15:33 |
|
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 #271561 is a reply to message #271547] |
Sat, 07 July 2007 20:07 |
|
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
[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 |
|
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 #271635 is a reply to message #271501] |
Sun, 08 July 2007 06:27 |
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 #271667 is a reply to message #271501] |
Sun, 08 July 2007 08:41 |
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 |
|
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
|
|
|
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: 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 #271873 is a reply to message #271501] |
Mon, 09 July 2007 01:16 |
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
|
|
|
|
|
Goto Forum:
Current Time: Mon Nov 25 06:36:08 MST 2024
Total time taken to generate the page: 0.01177 seconds
|