You are not logged in.
Pages: 1
Well hello,
Im Nawi ill start hosting my own server..
i know its my first post but i want to requestthis:
a lua script wich Promotes(!setlevel x) based on the XP.
So visitors can get a little level too if theyre active on my server, something like 0 to 20.
well to the script ,
i dont know how to make luas otherwise i could do it myself -.-' and i dont have to annoy u ...
it should be a bit customizeable:
-> How many Levels Exist
-> How many XP needed for what level
-> Maybe a demotion script if he resets xp or something
-> If it works ( i dont know if ) it should automaticly set the users.
~~~>ELSE a /Promoteme command ... ill use that for shrubbot -> !promoteme (i know how it works)
well i hope you guys can make one for me
P.S.: I know my english is awfull but im working on it xD
--Regards Nawi
Offline
Version = "0.2a"
Description = "Autosetlevel"
----------------------------------------------------------------------
--made 4 etpub only
--global vars
----------------------------------------------------------------------
lvl1xp = 5000
lvl2xp = 10000
lvl3xp = 15000
--------------hier nix mehr ndern ausser die messages----------------
function et_InitGame(levelTime,randomSeed,restart)
et.G_Print(""..Description.." Version:".. Version .." Loaded\n")
et.RegisterModname(""..Description..":".. Version .."slot:".. et.FindSelf())
end
function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
if getXP(clientNum) >= lvl1xp and getXP(clientNum) < lvl2xp then -- lvl1setzen
setlevel(clientNum,1,lvl1xp)
elseif getXP(clientNum) >= lvl2xp and getXP(clientNum) < lvl3xp then -- lvl2setzen
setlevel(clientNum,2,lvl2xp)
elseif getXP(clientNum) >= lvl3xp then -- lvl3setzen
setlevel(clientNum,3,lvl3xp)
end
end
function getXP(playerID)
return et.gentity_get(playerID, "ps.persistant", 0) -- STAT_XP etsrc
end
function getlevel(playerID)
return et.G_shrubbot_level(playerID)
end
function setlevel(playerID, newlevel, xp)
local name = et.gentity_get(playerID,"pers.netname") -- name auslesen
if isBot(playerID) then return end
if newlevel <= getlevel(playerID) then return end
et.trap_SendServerCommand(-1,"cp \"^7"..name.." ^0has ^0reached ^1"..xp.."XP ^0he ^0is ^0now ^0a ^1level "..newlevel.." user\"")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "readconfig\n" )
end
function isBot(playerID)
if et.gentity_get(playerID,"ps.ping") == 0 then
return true
end
end
Offline
Nice thanks working good
Offline
Our server allows players with NO guide to connect. This script is great accept when setting levels for players with No guide. Once a player with NO guide has reached the minimum xp for level 1, the script attempts to setlevel for that player and continues to repeat it everytime the players xp increases so the screen is spammed with the achieved level message constantly.
Any fix for players with NO guide?
Cheers
Smooths
Offline
If PB lagg wasn't so bad I would consider it
Offline
ahha its nice that u removed my authors name of the lua....
well preventing for noguids is easy.. just do this
Version = "0.3a"
Author = "Perlo_0ung?!"
Description = "Autosetlevel"
Homepage = "www.ef-clan.org"
----------------------------------------------------------------------
--made 4 etpub only
--global vars
----------------------------------------------------------------------
lvl1xp = 5000
lvl2xp = 10000
lvl3xp = 15000
--------------Do not edit below this line-------------------------
function et_InitGame(levelTime,randomSeed,restart)
et.G_Print(""..Description.." Version:".. Version .." Loaded\n")
et.RegisterModname(""..Description..":".. Version .."slot:".. et.FindSelf())
end
function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
if getXP(clientNum) >= lvl1xp and getXP(clientNum) < lvl2xp then
setlevel(clientNum,1,lvl1xp)
elseif getXP(clientNum) >= lvl2xp and getXP(clientNum) < lvl3xp then
setlevel(clientNum,2,lvl2xp)
elseif getXP(clientNum) >= lvl3xp then
setlevel(clientNum,3,lvl3xp)
end
end
function getXP(playerID)
return et.gentity_get(playerID, "ps.persistant", 0)
end
function getlevel(playerID)
return et.G_shrubbot_level(playerID)
end
function setlevel(playerID, newlevel, xp)
local name = et.gentity_get(playerID,"pers.netname")
if isBot(playerID) or noGuid(playerID) then return end
if newlevel <= getlevel(playerID) then return end
et.trap_SendServerCommand(-1,"cp \"^7"..name.." ^0has ^0reached ^1"..xp.."XP ^0he ^0is ^0now ^0a ^1level "..newlevel.." user\"")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "readconfig\n" )
end
function noGuid(playerID)
local userinfo = et.trap_GetUserinfo( playerID )
local guid = et.Info_ValueForKey( userinfo, "cl_guid" )
if guid == "unknown" then
return true
end
end
function isBot(playerID)
if et.gentity_get(playerID,"ps.ping") == 0 then
return true
end
end
Offline
ahha its nice that u removed my authors name of the lua....
well preventing for noguids is easy.. just do this
Thank you very much mate!
i added your name in our servers lua, didnt know that it was stolen:mad:
I appreciate your work!
Offline
Version = "0.2a"
Version = "0.3a"
Author = "Perlo_0ung?!"
Description = "Autosetlevel"
Homepage = "www.ef-clan.org"
----------------------------------------------------------------------
Description = "Autosetlevel"
----------------------------------------------------------------------
--made 4 etpub only
--global vars
----------------------------------------------------------------------
lvl1xp = 750
lvl2xp = 7000
lvl3xp = 10000
lvl4xp = 15000
lvl5xp = 25000
--------------hier nix mehr ?ndern ausser die messages----------------
function et_InitGame(levelTime,randomSeed,restart)
et.G_Print(""..Description.." Version:".. Version .." Loaded\n")
et.RegisterModname(""..Description..":".. Version .."slot:".. et.FindSelf())
end
function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
if getXP(clientNum) >= lvl1xp and getXP(clientNum) < lvl2xp then -- lvl1setzen
setlevel(clientNum,1,lvl1xp)
elseif getXP(clientNum) >= lvl2xp and getXP(clientNum) < lvl3xp then -- lvl2setzen
setlevel(clientNum,2,lvl2xp)
elseif getXP(clientNum) >= lvl2xp and getXP(clientNum) < lvl4xp then -- lvl2setzen
setlevel(clientNum,3,lvl3xp)
elseif getXP(clientNum) >= lvl2xp and getXP(clientNum) < lvl5xp then -- lvl2setzen
setlevel(clientNum,4,lvl4xp)
elseif getXP(clientNum) >= lvl5xp then -- lvl3setzen
setlevel(clientNum,5,lvl5xp)
end
end
function getXP(playerID)
return et.gentity_get(playerID, "ps.persistant", 0) -- STAT_XP etsrc
end
function getlevel(playerID)
return et.G_shrubbot_level(playerID)
end
function setlevel(playerID, newlevel, xp)
local name = et.gentity_get(playerID,"pers.netname") -- name auslesen
if isBot(playerID) then return end
if newlevel <= getlevel(playerID) then return end
et.trap_SendServerCommand(-1,"cp \"^7"..name.." ^0has ^0reached ^1"..xp.."XP ^0he ^0is ^0now ^0a ^1 "..newlevel.."!!\"")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "readconfig\n" )
end
function isBot(playerID)
if et.gentity_get(playerID,"ps.ping") == 0 then
return true
end
end
Can someone help me? it doesnt work :'(
did i make error with adding 2 more xp's?
Offline
Not sure how lua scripting works. Give this modify version a try frusciante.
Autopromotion.lua or Autosetlevel.lua <---Not sure which name is right
Version = "0.3a"
Author = "Perlo_0ung?!"
Description = "Autosetlevel"
Homepage = "www.ef-clan.org"
----------------------------------------------------------------------
--made 4 etpub only
--global vars
----------------------------------------------------------------------
lvl1xp = 750
lvl2xp = 7000
lvl3xp = 10000
lvl4xp = 15000
lvl5xp = 25000
--------------Do not edit below this line-------------------------
function et_InitGame(levelTime,randomSeed,restart)
et.G_Print(""..Description.." Version:".. Version .." Loaded\n")
et.RegisterModname(""..Description..":".. Version .."slot:".. et.FindSelf())
end
function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
if getXP(clientNum) >= lvl1xp and getXP(clientNum) < lvl2xp then
setlevel(clientNum,1,lvl1xp)
elseif getXP(clientNum) >= lvl2xp and getXP(clientNum) < lvl3xp then
setlevel(clientNum,2,lvl2xp)
elseif getXP(clientNum) >= lvl3xp and getXP(clientNum) < lvl4xp then
setlevel(clientNum,3,lvl3xp)
elseif getXP(clientNum) >= lvl4xp and getXP(clientNum) < lvl5xp then
setlevel(clientNum,4,lvl4xp)
elseif getXP(clientNum) >= lvl5xp then
setlevel(clientNum,5,lvl5xp)
end
end
function getXP(playerID)
return et.gentity_get(playerID, "ps.persistant", 0)
end
function getlevel(playerID)
return et.G_shrubbot_level(playerID)
end
function setlevel(playerID, newlevel, xp)
local name = et.gentity_get(playerID,"pers.netname")
if isBot(playerID) or noGuid(playerID) then return end
if newlevel <= getlevel(playerID) then return end
et.trap_SendServerCommand(-1,"cp \"^7"..name.." ^0has ^0reached ^1"..xp.."XP ^0he ^0is ^0now ^0a ^1level "..newlevel.." user\"")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "readconfig\n" )
end
function noGuid(playerID)
local userinfo = et.trap_GetUserinfo( playerID )
local guid = et.Info_ValueForKey( userinfo, "cl_guid" )
if guid == "unknown" then
return true
end
end
function isBot(playerID)
if et.gentity_get(playerID,"ps.ping") == 0 then
return true
end
end
Credit goes to Perlo0ung for original lua script.
Edit:
Correction in script.
Offline
Works now thanks matey
Offline
nah... take care at:
setlevel(clientNum,3,lvl5xp)
its defined like this
setlevel ( who , whatlevel , at what xp)
Offline
Thank you for pointing out my mistake Perlo0ung. Like I said, I know nothing about lua scripting. Hopefully I got it right this time.
See first page for correction frusciante.
Offline
Is there a way to debug lua scripts?
I tried this script, well I adjusted it a bit (added an elseif structure) but it seems to get stuck on the setlevel part...?
I was wondering if this is caused by the bug that says "You can not setlevel yourself higher then your current level" when you run setlevel through rcon on 2.0 or if it was a different bug, I looked in the server console, but it didn't say anything.
Offline
In old N!tmod versions you can't setlevel higher than 64 through rcon.
This is fixed in 2.2
Offline
In old N!tmod versions you can't setlevel higher than 64 through rcon.
This is fixed in 2.2
Awesome!
Offline
Simple question: how to add a sound when a player has received the level?
Offline
hi...
search this lines in script
if newlevel <= getlevel(playerID) then return end
et.trap_SendServerCommand(-1,"cp \"^7"..name.." ^0has ^0reached ^1"..xp.."XP ^0he ^0is ^0now ^0a ^1level "..newlevel.." user\"")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "readconfig\n" )
end
and modify to be like this
if newlevel <= getlevel(playerID) then return end
et.trap_SendServerCommand(-1,"cp \"^7"..name.." ^0has ^0reached ^1"..xp.."XP ^0he ^0is ^0now ^0a ^1level "..newlevel.." user\"")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "readconfig\n" )
et.G_globalSound( "sound/misc/skill_up.wav" )
end
i dont tested yet but is a great ideea and and for sure will work,,,, i put in my scripts too...
cheers
Last edited by loudness (20-Sep-11 00:44:34)
Offline
Hi first of all gratz 4 this script.
I wish use this one on my serwer but I had a problem.
I using kmod.lua with different admin levels.
To sets admins on kmod I have to type !setlevel via console or rcon
Is chance get this script doing this 4 me ????????
Othervise this script is useless in my situation.
thanks for any help
Offline
the code is not working
module is loaded
but there is no setlevel at specific levelxp
Offline
This script is used on #LSD servers and it works perfectly.
!setlevel is executed when client respawns.
Offline
Offline
Hi I have problem that lua doesnt want work, this may be due to sqlite ? Can not read xp players ??
Offline
Version = "0.3c"
Author = "Perlo_0ung?!"
Description = "Autosetlevel"
Homepage = "www.ef-clan.org"
--v.03b: added name function
--v0.3c: added more levels
----------------------------------------------------------------------
--made 4 etpub only
--global vars
--Le Bar Des Clans
----------------------------------------------------------------------
lvl1xp = 1000
lvl2xp = 1500
lvl3xp = 2500
lvl4xp = 4000
lvl5xp = 7500
lvl6xp = 12500
lvl7xp = 15000
lvl8xp = 17500
lvl9xp = 20000
lvl10xp = 30000
--------------Do not edit below this line-------------------------
function et_InitGame(levelTime,randomSeed,restart)
et.G_Print(""..Description.." Version:".. Version .." Loaded\n")
et.RegisterModname(""..Description..":".. Version .."slot:".. et.FindSelf())
end
function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
if getXP(clientNum) >= lvl1xp and getXP(clientNum) < lvl2xp then -- lvl1setzen
setlevel(clientNum,1,lvl1xp)
elseif getXP(clientNum) >= lvl2xp and getXP(clientNum) < lvl3xp then -- lvl2setzen
setlevel(clientNum,2,lvl2xp)
elseif getXP(clientNum) >= lvl3xp and getXP(clientNum) < lvl4xp then -- lvl3setzen
setlevel(clientNum,3,lvl3xp)
elseif getXP(clientNum) >= lvl4xp and getXP(clientNum) < lvl5xp then -- lvl4setzen
setlevel(clientNum,4,lvl4xp)
elseif getXP(clientNum) >= lvl5xp and getXP(clientNum) < lvl6xp then -- lvl5setzen
setlevel(clientNum,5,lvl5xp)
elseif getXP(clientNum) >= lvl6xp and getXP(clientNum) < lvl7xp then -- lvl6setzen
setlevel(clientNum,6,lvl6xp)
elseif getXP(clientNum) >= lvl7xp and getXP(clientNum) < lvl8xp then -- lvl7setzen
setlevel(clientNum,7,lvl7xp)
elseif getXP(clientNum) >= lvl8xp and getXP(clientNum) < lvl9xp then -- lvl8setzen
setlevel(clientNum,8,lvl8xp)
elseif getXP(clientNum) >= lvl9xp and getXP(clientNum) < lvl10xp then -- lvl9setzen
setlevel(clientNum,9,lvl9xp)
elseif getXP(clientNum) >= lvl10xp then -- lvl10setzen
setlevel(clientNum,10,lvl10xp)
end
end
function getXP(playerID)
return et.gentity_get(playerID, "ps.persistant", 0) -- STAT_XP etsrc
end
function getlevel(playerID)
return et.G_shrubbot_level(playerID)
end
function setlevel(playerID, newlevel, xp)
local name = et.gentity_get(playerID,"pers.netname") -- name auslesen
if isBot(playerID) then return end
if newlevel <= getlevel(playerID) then return end
et.trap_SendServerCommand(-1,"cp \"^7"..name.." ^1a obtenu "..xp.." ^1XP, ^7il ^1a ^7maintenant ^1le ^7level ^1"..newlevel.." ^3FELICITATION!\"")
et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
et.trap_SendConsoleCommand( et.EXEC_APPEND, "readconfig\n" )
end
function isBot(playerID)
if et.gentity_get(playerID,"ps.ping") == 0 then
return true
end
end
This one work on my server.
You didn't forgot to put your lua in your set lua_modules "name.lua" ?
Offline
It works without a problem, somehow it working
Offline
Pages: 1