You are not logged in.
Pages: 1
Hi,
I downloaded your rules.lua script, and i tried to edit it.
maps & ip command. But it didnt work.
First i looked how the rules and website thing worked. then i changed the commands, and all nececairy things to maps and ip. and saved it as a new file. that worked. But then when i try to make a new command string etc.
it doesnt work anymore.
here's the code:
-- > Thx Nitrox
--
-- > /ip
-- > /maps
-- > /rules
-- > /website
function et_InitGame(levelTime,randomSeed,restart)
et.RegisterModname("cmds")
end
USE_IP = 1
USE_MAPS = 1
USE_RULES = 1
USE_WEBSITE = 1
NUMMAPS = 20
maps = {
"^3Goldrush",
"^3Adlernest",
"^3TC_Base",
"^3Oasis",
"^3Braundorf_Final",
"^3Frostbite",
"^3Caen 4",
"^3Chicken Bucket",
"^3Marrakech Streets 2 - By Night",
"^3Supply Depot",
"^3Madbunker",
"^3venice_ne4",
"^3Berserk TE",
"^3Streets of Italy",
"^3Haemar_b1",
"^3Special Delivery TE",
"^3Snatch3",
"",
"Showing 17 Maps",
""
}
NUMRULES = 7
rules = {
"1",
"2",
"3",
"4",
"5",
"6",
"7"
}
IP = "^3This Server IP Is ^7...."
WEBSITE = "*****"
function et_ClientCommand(clientNum, command)
command = string.lower(command)
if (command == "maps") and (USE_MAPS == 1) then
for i=1,(NUMMAPS),1 do
et.trap_SendServerCommand(clientNum, "print \"" .. maps[i] .."^7\n\"")
if (command == "rules") and (USE_RULES == 1) then
for m=1,(NUMRULES),1 do
et.trap_SendServerCommand(clientNum, "print \"" .. rules[m] .."^7\n\"")
end
return 1
elseif (command == "ip") and (USE_IP == 1) then
et.trap_SendServerCommand(clientNum, "print \"" .. IP .."^7\n\"")
elseif (command == "website") and (USE_WEBSITE == 1) then
et.trap_SendServerCommand(clientNum, "print \"" .. WEBSITE .."^7\n\"")
return 1
end
end
Im sure i've done something wrong with return, end, elseif, if. But i can't figure it out.
Offline
Fixed. And added some comments to help you understanding what was wrong
Also, don't forget to "return 1" after a "if" or "elseif" check, or it will print something like "unknown command" in clients console.
Here is the fixed script :
-- > Thx Nitrox
--
-- > /ip
-- > /maps
-- > /rules
-- > /website
function et_InitGame(levelTime,randomSeed,restart)
et.RegisterModname("cmds")
end
USE_IP = 1
USE_MAPS = 1
USE_RULES = 1
USE_WEBSITE = 1
NUMMAPS = 20
maps = {
"^3Goldrush",
"^3Adlernest",
"^3TC_Base",
"^3Oasis",
"^3Braundorf_Final",
"^3Frostbite",
"^3Caen 4",
"^3Chicken Bucket",
"^3Marrakech Streets 2 - By Night",
"^3Supply Depot",
"^3Madbunker",
"^3venice_ne4",
"^3Berserk TE",
"^3Streets of Italy",
"^3Haemar_b1",
"^3Special Delivery TE",
"^3Snatch3",
"",
"Showing 17 Maps",
""
}
NUMRULES = 7
rules = {
"1",
"2",
"3",
"4",
"5",
"6",
"7"
}
IP = "^3This Server IP Is ^7...."
WEBSITE = "*****"
function et_ClientCommand(clientNum, command)
command = string.lower(command)
if (command == "maps") and (USE_MAPS == 1) then
for i=1,(NUMMAPS),1 do
et.trap_SendServerCommand(clientNum, "print \"" .. maps[i] .."^7\n\"")
end -- end of the 'for' loop
return 1
elseif (command == "rules") and (USE_RULES == 1) then
for m=1,(NUMRULES),1 do
et.trap_SendServerCommand(clientNum, "print \"" .. rules[m] .."^7\n\"")
end -- end of the 'for' loop
return 1
elseif (command == "ip") and (USE_IP == 1) then
et.trap_SendServerCommand(clientNum, "print \"" .. IP .."^7\n\"")
return 1
elseif (command == "website") and (USE_WEBSITE == 1) then
et.trap_SendServerCommand(clientNum, "print \"" .. WEBSITE .."^7\n\"")
return 1
end -- end of the if/elseif
end -- end of the et_ClientCommand function
Offline
Thanks. Fixed indeed
Offline
Pages: 1