please help if you can

Support & Suggestions For NightRegulator!
Post Reply
User avatar
dean20056
I found the post button!
I found the post button!
Posts: 10
Joined: May 27th, 2007, 6:43 am

please help if you can

Post by dean20056 »

i have got a ssgm plugin thing and made commands and everythink but nr says lua error - (null) i was wondering if anyone could tell me if this was wrong what i put in there.

--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 == "!gdiapc" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_GDI_APC", pos)
end
if Message == "!version" then
InputConsole("msg [DB] DeanBot v1.0 based on idears from Dean20056 and scripted by kjcoolo4", pID)
end
if Message == "!sbh" then
if Get_Money(pID) > 600 then
Change_Character(Get_GameObj(pID),"CnC_Nod_FlameThrower_2SF")
Set_Money(pID, Get_Money(pID)-600)
else
InputConsole("ppage %d You need 600$ to buy that!", pID)
end
end
if Message == "!s" then
if Get_Player_Name_By_ID(pID) == "kjcoolo4" then
Change_Character(Get_GameObj(pID),"CnC_Nod_FlameThrower_2SF")
else
if Get_Player_Name_By_ID(pID) == "dean20056" then
Change_Character(Get_GameObj(pID),"CnC_Nod_FlameThrower_2SF")
else
if Get_Player_Name_By_ID(pID) == "GenxYuri" then
Change_Character(Get_GameObj(pID),"CnC_Nod_FlameThrower_2SF")
else
InputConsole("sndp %d 00-n008e.wav", pID)
InputConsole("ppage %d You need to be a Special User to do this!", pID)
end
end
end
end
if Message == "!harvy" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Harvester", pos)
end
if Message == "!mammy" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_GDI_Mammoth_Tank", pos)
end
if Message == "!med" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_GDI_Medium_Tank", pos)
end
if Message == "!mrl" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_GDI_MRLS", pos)
end
if Message == "!orca" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_GDI_Orca", pos)
end
if Message == "!gditrans" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_GDI_Transport", pos)
end
if Message == "!pickup" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Civilian_Pickup01_Secret", pos)
end
if Message == "!sedan" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Civilian_Sedan01_Secret", pos)
end
if Message == "!apache" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Apache", pos)
end
if Message == "!nodapc" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_APC", pos)
end
if Message == "!buggy" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Buggy", pos)
end
if Message == "!flame" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Flame_Tank", pos)
end
if Message == "!light" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Light_Tank", pos)
end
if Message == "!arty" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Mobile_Artillery", pos)
end
if Message == "!bike" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Recon_Bike", pos)
end
if Message == "!stank" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Stealth_Tank", pos)
end
if Message == "!nodtrans" then
local pos = Get_Position(Get_GameObj(pID))
pos:AssignZ(pos:GetZ()+5)
pos:AssignX(pos:GetX()+5)
Create_Object("CnC_Nod_Transport", pos)
end
if Message == "!host" then
if Get_Player_Name_By_ID(pID) == "dean20056" then
Set_Model(Get_GameObj(pID), "c_ag_nod_seacpt")
Grant_Powerup(Get_GameObj(pID), "POW_Shotgun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Pistol_Player")
Grant_Powerup(Get_GameObj(pID), "POW_AutoRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Flamethrower_Player")
Grant_Powerup(Get_GameObj(pID), "POW_GrenadeLauncher_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RepairGun_Player")
Set_Max_Health(Get_GameObj(pID), 90000)
Grant_Powerup(Get_GameObj(pID), "POW_Chaingun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RocketLauncher_Player")
Grant_Powerup(Get_GameObj(pID), "POW_ChemSprayer_Player")
Grant_Powerup(Get_GameObj(pID), "POW_SniperRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_LaserChaingun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_LaserRifle_Player")
Set_Max_Shield_Strength(Get_GameObj(pID), 90000)
Grant_Powerup(Get_GameObj(pID), "POW_TiberiumFlechetteGun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_PersonalIonCannon_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Railgun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RamjetRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_VoltAutoRifle_Player")
Grant_Powerup(Get_GameObj(pID), "Weapon_UltimateWeapon")
Grant_Powerup(Get_GameObj(pID), "POW_Medal_Armor")
Grant_Powerup(Get_GameObj(pID), "POW_Medal_Health")
InputConsole("msg [KJB] kjcoolo4 HAS JUST ACTIVATED HIS HOST POWERS WHAHAHAHAHA")
InputConsole("snda m00gcf1_decx0001i1gcf1_snd.wav")
InputConsole("snda laugh1.wav")
else
if Get_Player_Name_By_ID(pID) == "kjcoolo4" then
Set_Model(Get_GameObj(pID), "c_ag_nod_seacpt")
Grant_Powerup(Get_GameObj(pID), "POW_Shotgun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Pistol_Player")
Grant_Powerup(Get_GameObj(pID), "POW_AutoRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Flamethrower_Player")
Grant_Powerup(Get_GameObj(pID), "POW_GrenadeLauncher_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RepairGun_Player")
Set_Max_Health(Get_GameObj(pID), 9000)
Grant_Powerup(Get_GameObj(pID), "POW_Chaingun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RocketLauncher_Player")
Grant_Powerup(Get_GameObj(pID), "POW_ChemSprayer_Player")
Grant_Powerup(Get_GameObj(pID), "POW_SniperRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_LaserChaingun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_LaserRifle_Player")
Set_Max_Shield_Strength(Get_GameObj(pID), 9000)
Grant_Powerup(Get_GameObj(pID), "POW_TiberiumFlechetteGun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_PersonalIonCannon_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Railgun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RamjetRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_VoltAutoRifle_Player")
Grant_Powerup(Get_GameObj(pID), "Weapon_UltimateWeapon")
Grant_Powerup(Get_GameObj(pID), "POW_Medal_Armor")
Grant_Powerup(Get_GameObj(pID), "POW_Medal_Health")
InputConsole("msg [KJB] kjcoolo4 HAS JUST ACTIVATED HIS HOST POWERS WHAHAHAHAHA")
InputConsole("snda m00gcf1_decx0001i1gcf1_snd.wav")
InputConsole("snda laugh1.wav")
else
InputConsole("ppage %d You cant do that only Kjcoolo4 and Dean20056 :P", pID)
end
end

end
if Message == "afk" then
InputConsole("msg %s is now Afk please do not kill them.", pID)
end
if Message == "back" then
InputConsole("msg %s is now back kill them as much as you want.", pID)
end
if Message == "!de0wnme" then
InputConsole("team2 %d 0", pID)
end
if Message == "!0wnme" then
InputConsole("team2 %d -1", pID)
end
if Message == "!grenade" then
if Get_Money(pID) > 100 then
Grant_Powerup(Get_GameObj(pID), "POW_GrenadeLauncher")
Set_Money(pID, Get_Money(pID)-100)
InputConsole("msg %s has purchased a GrenadeLauncher.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 100$ to purchase this", pID)
end
end
if Message == "!repgun" then
if Get_Money(pID) > 100 then
Grant_Powerup(Get_GameObj(pID), "POW_RepairGun_Player")
Set_Money(pID, Get_Money(pID)-100)
InputConsole("msg %s has purchased a repair gun.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 100$ to purchase this", pID)
end
end
if Message == "!remote" then
if Get_Money(pID) > 100 then
Grant_Powerup(Get_GameObj(pID), "CnC_POW_MineRemote_02")
Set_Money(pID, Get_Money(pID)-100)
InputConsole("msg %s has purchased a remote c4.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 100$ to purchase this", pID)
end
end
if Message == "!shotgun" then
if Get_Money(pID) < 200 then
InputConsole("ppage %d you need 200$ to purchase this", pID)
else
Grant_Powerup(Get_GameObj(pID), "POW_Shotgun_Player")
Set_Money(pID, Get_Money(pID)-200)
InputConsole("msg %s has purchased a shotgun.", Get_Player_Name_By_ID(pID))
end
end
if Message == "!chaingun" then
if Get_Money(pID) > 200 then
Grant_Powerup(Get_GameObj(pID), "POW_Chaingun_Player")
Set_Money(pID, Get_Money(pID)-200)
InputConsole("msg %s has purchased a chain gun.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 200$ to purchase this", pID)
end
end
if Message == "!rocketlauncher" then
if Get_Money(pID) > 300 then
Grant_Powerup(Get_GameObj(pID), "POW_RocketLauncher")
Set_Money(pID, Get_Money(pID)-300)
InputConsole("msg %s has purchased RocketLauncher.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 300$ to purchase this", pID)
end
end
if Message == "!chemspray" then
if Get_Money(pID) > 300 then
Grant_Powerup(Get_GameObj(pID), "POW_ChemSprayer_Player")
Set_Money(pID, Get_Money(pID)-300)
InputConsole("msg %s has purchased chem sprayer.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 300$ to purchase this", pID)
end
end
if Message == "!obi" then
if Get_Money(pID) > 700 then
Grant_Powerup(Get_GameObj(pID), "MX0_Weapon_Obelisk")
Set_Money(pID, Get_Money(pID)-700)
InputConsole("msg %s has purchased a ob gun.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 700$ to purchase this", pID)
end
end
if Message == "!weapons" then
InputConsole("msg Weapons: !grenade !repgun !remote !chaingun !rocketlauncher !chemspray !tibauto !laiserrifle !ion !rail !volt !ramjet !sbh enjoy the weapons ", pID)
end
if Message == "!tanks" then
InputConsole("msg tanks: !light !flame !harvy !med !mrl !orca !gdiapc !gditrans !buggy !nodapc !arty !bike !nodtrans !stank enjoy the tanks. ", pID)
end
if Message == "!help" then
InputConsole("msg !weapons !tanks (tanks are free weapons cost a little bit of money enjoy. ", pID)
end
if Message == "!sniperrifle" then
if Get_Money(pID) > 300 then
Grant_Powerup(Get_GameObj(pID), "POW_SniperRifle_Player")
Set_Money(pID, Get_Money(pID)-300)
InputConsole("msg %s has purchased a SniperRifle.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 300$ to purchase this", pID)
end
end
if Message == "!laserrifle" then
if Get_Money(pID) > 400 then
Grant_Powerup(Get_GameObj(pID), "POW_LaserRifle_Player")
Set_Money(pID, Get_Money(pID)-300)
InputConsole("msg %s has purchased a laser rifle.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 300$ to purchase this", pID)
end
end
if Message == "!ion" then
if Get_Money(pID) > 600 then
Grant_Powerup(Get_GameObj(pID), "POW_PersonalIonCannon_Player")
Set_Money(pID, Get_Money(pID)-600)
InputConsole("msg %s has purchased a PersonalIonCannon.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 600$ to purchase this", pID)
end
end
if Message == "!rail" then
if Get_Money(pID) > 600 then
Grant_Powerup(Get_GameObj(pID), "POW_Railgun_Player")
Set_Money(pID, Get_Money(pID)-600)
InputConsole("msg %s has purchased a Railgun.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 600$ to purchase this", pID)
end
end
if Message == "!ramjet" then
if Get_Money(pID) > 600 then
Grant_Powerup(Get_GameObj(pID), "POW_RamjetRifle_Player")
Set_Money(pID, Get_Money(pID)-600)
InputConsole("msg %s has purchased a ramjet rifle.", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 600$ to purchase this", pID)
end
end
if Message == "!volt" then
if Get_Money(pID) > 600 then
Grant_Powerup(Get_GameObj(pID), "POW_VoltAutoRifle_Player")
Set_Money(pID, Get_Money(pID)-600)
InputConsole("msg %s has purchased a VoltAutoRifle .", Get_Player_Name_By_ID(pID))
else
InputConsole("ppage %d you need 600$ to purchase this", 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 == "!all" then
local pos = Get_Position(Get_GameObj(pID))
if Get_Money(pID) < 1 then
InputConsole("ppage %d You need 10000 credits", pID)
else
Grant_Powerup(Get_GameObj(pID), "POW_Shotgun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Pistol_Player")
Grant_Powerup(Get_GameObj(pID), "POW_AutoRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Flamethrower_Player")
Grant_Powerup(Get_GameObj(pID), "POW_GrenadeLauncher_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RepairGun_Player")
Set_Max_Health(Get_GameObj(pID), 2000)
Grant_Powerup(Get_GameObj(pID), "POW_Chaingun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RocketLauncher_Player")
Grant_Powerup(Get_GameObj(pID), "POW_ChemSprayer_Player")
Grant_Powerup(Get_GameObj(pID), "POW_TiberiumAutoRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_SniperRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_LaserChaingun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_LaserRifle_Player")
Set_Max_Shield_Strength(Get_GameObj(pID), 2000)
Grant_Powerup(Get_GameObj(pID), "POW_TiberiumFlechetteGun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_PersonalIonCannon_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Railgun_Player")
Grant_Powerup(Get_GameObj(pID), "POW_RamjetRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_VoltAutoRifle_Player")
Grant_Powerup(Get_GameObj(pID), "POW_Tiberium_Shield")
Grant_Powerup(Get_GameObj(pID), "POW_Medal_Armor")
Grant_Powerup(Get_GameObj(pID), "POW_Medal_Health")

Set_Money(pID, Get_Money(pID)-10000)
end
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

if anyone knows what is wrong please tell me.
Image
PsuFan
Member
Member
Posts: 456
Joined: April 21st, 2006, 2:49 pm

Re: please help if you can

Post by PsuFan »

Well you could remove some of these commands and put them in my NR plugin, Which is safer then putting them in here because if you mess it up it will crash.

(commands such as your !afk)
User avatar
dean20056
I found the post button!
I found the post button!
Posts: 10
Joined: May 27th, 2007, 6:43 am

Re: please help if you can

Post by dean20056 »

what i just pasted in was working before but it just would not work now it crashes server and the lua error comes up. and Well you could remove some of these commands and put them in my NR plugin, Which is safer then putting them in here because if you mess it up it will crash. <------ ?
Image
PsuFan
Member
Member
Posts: 456
Joined: April 21st, 2006, 2:49 pm

Re: please help if you can

Post by PsuFan »

if you mess up a command in lua, it will crash your sevrer, If you make commands in my plugin those commands cant crash your server, also narrowing down what is wrong.
User avatar
dean20056
I found the post button!
I found the post button!
Posts: 10
Joined: May 27th, 2007, 6:43 am

Re: please help if you can

Post by dean20056 »

PsuFan wrote:if you mess up a command in lua, it will crash your sevrer, If you make commands in my plugin those commands cant crash your server, also narrowing down what is wrong.
so how do i do that then
Image
PsuFan
Member
Member
Posts: 456
Joined: April 21st, 2006, 2:49 pm

Re: please help if you can

Post by PsuFan »

get my plugin @ http://www.psumaps.co.nr/index.asp?page=nrplugin

This can do some of your more basic commands which have no possible way of crashing your server making it a little safer. I cant tell you much about why your lua doesnt work, But they have a forums that you can post there and see if your code is wrong.
bracy

Re: please help if you can

Post by bracy »

psufan I have to admire you because of what you have done for NR and for what you know, after saying that I just thought it to be important to say something to dean. Congrats on your programming with lua, it seems that you are on the right track and while I recommend that you use psufans program if you are just trying to make a bot however if you are trying to learn how to make your own server then it seems like you are on the right track on learning to program you own commands and make your own server which is highly commendable.
PsuFan
Member
Member
Posts: 456
Joined: April 21st, 2006, 2:49 pm

Re: please help if you can

Post by PsuFan »

:) why thank you, If you need any help with anything let me know. I dont know anything about lua though. I want to get into it though, Its does a lot more then nr can do now. If my plugin doesnt do anything that you want it to, Let me know and ill look into it.
raulperez
Senior Member
Senior Member
Posts: 861
Joined: February 18th, 2007, 12:22 pm

Re: please help if you can

Post by raulperez »

love the preferential coding in that command.... give upgrades to specific IDs for free? real fair...
RaulPerez
[xcard]RaulPerezPrime[/xcard]
PsuFan
Member
Member
Posts: 456
Joined: April 21st, 2006, 2:49 pm

Re: please help if you can

Post by PsuFan »

wtf you talking about, any why are you posting in topics 4 months old.
raulperez
Senior Member
Senior Member
Posts: 861
Joined: February 18th, 2007, 12:22 pm

Re: please help if you can

Post by raulperez »

just going through topics making sure i've actually read all the ones rather than just hitting mark as read

didn't notice how old the date was
RaulPerez
[xcard]RaulPerezPrime[/xcard]
Post Reply

Return to “Support/Suggestions”