[ET:Server] Autopromotion.lua for nitmod 2.3.1

If you have any problems, regarding to gameservers. You can create a topic. We will find out a solution.
Source Engine games, Quake Engine games, or any others. Request something, like scripts serverside. Or post your own made stuff.

[ET:Server] Autopromotion.lua for nitmod 2.3.1

Postby ETc|#.Jay.# » 13 Aug 2017, 12:30

you can find here other luas downloads.php?view=detail&df_id=11


Code: Select all

    -- Created by Perlo_0ung
    -- edited to make it work for nitmod 2.2 and higher

    Modname = "AutoPromo"
    Version = "1.0"

    function et_InitGame(levelTime, randomSeed, restart)
       et.G_Print("["..Modname.."] Version: "..Version.." Loaded\n")
        et.RegisterModname(et.Q_CleanStr(Modname).."   "..Version.."   "..et.FindSelf())
       et.trap_SendConsoleCommand(et.EXEC_NOW,"sets AutoPromo 1.0")
       maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )
    end

    function et_InitGame(levelTime,randomSeed,restart)
       et.RegisterModname( "AutoPromo 1.0" )
       maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )
    end


    ----------------------------------------------------------------------
    ---------------------------Configuration-------------------------------
    ----------------------------------------------------------------------

    lvl1xp = 1000
    lvl2xp = 2000
    lvl3xp = 3000
    lvl4xp = 4000
    lvl5xp = 5000
    lvl6xp = 6000

    ----------------------------------------------------------------------
    --------------------Do not edit below this line-------------------------
    ----------------------------------------------------------------------


    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 and getXP(clientNum) < lvl6xp then
          setlevel(clientNum,5,lvl5xp)
       elseif getXP(clientNum) >=  lvl6xp then   
          setlevel(clientNum,6,lvl6xp)
       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,"chat \"^dCongratulations ^7"..name.."^d, ^dyou have ^dbeen ^dpromoted ^dto ^da ^4Friend^1Level ^7"..newlevel.." ^duser!\"")
          et.trap_SendConsoleCommand( et.EXEC_APPEND, "setlevel ".. playerID.." "..newlevel.."\n" )
          et.G_globalSound( "sound/misc/skill_up.wav" )
    end

    function noGuid(playerID)
            local userinfo = et.trap_GetUserinfo( playerID )
       local guid     = et.Info_ValueForKey( userinfo, "n_guid" )
       if guid == "NO_GUID" or guid == "unknown" then
       return true
        end
    end

    function isBot(playerID)
       if et.gentity_get(playerID,"ps.ping") == 0 then
       return true
       end
    end
Image
User avatar
ETc|#.Jay.#
ETc| Member
 
Posts: 1586
{ IMAGES }: 466
Joined: 25 May 2008, 22:01
Cash on hand: 158,749.00
Bank: 0.00
Location: Germany

Return to Game Server Support

Who is online

Users browsing this forum: No registered users and 1 guest