ETMods.net

N!tmod, a Wolfenstein: Enemy Territory Modification!

You are not logged in.

Announcement

You can donate to help us keeping services online.

#1 02-May-14 09:46:39

Makavelii
Member
Registered: 24-Apr-14
Posts: 9

Autopromotion lua

Hello,

I recently found a lua for autopromotion. My lvl system goes 1,2,3,5,10 i tried to change the lvls and all but seems not to work.. Can someone help me?

Offline

#2 02-May-14 09:55:36

C!es..
BETA Tester
Registered: 10-Jan-13
Posts: 78
Website

Re: Autopromotion lua

----------------------------------------------------------------------
-- AutoPromo - An Enemy Territory Auto Promoting Mod
----------------------------------------------------------------------
description = "AutoPromo"
version =          "1.1"
----------------------------------------------------------------------
-- This script can be freely used and modified as long as the original
-- authors are mentioned.
-- Created by Perlo_0ung, edited by C!es..
-- Zmienione na potrzeby N!tmoda
----------------------------------------------------------------------
-- CONFIGURATION
----------------------------------------------------------------------

lvl1xp = 500  -- XP needed for level 1
lvl2xp = 1250 -- XP needed for level 2
lvl3xp = 2000 -- XP needed for level 3
lvl4xp = 5000 -- XP needed for level 4
lvl5xp = 7000 -- XP needed for level 5
lvl6xp = 10000 -- XP needed for level 6
lvl7xp = 20000 -- XP needed for level 7
lvl8xp = 30000 -- XP needed for level 8
lvl9xp = 40000 -- XP needed for level 9
lvl10xp = 50000 -- XP needed for level 10
lvl11xp = 75000 -- XP needed for level 11
lvl12xp = 90000 -- XP needed for level 12
lvl13xp = 125000 -- XP needed for level 13
lvl14xp = 150000 -- XP needed for level 14
lvl15xp = 200000 -- XP needed for level 15

----------------------------------------------------------------------
-- DO NOT EDIT BELOW THIS LINE
-- UNLESS YOU KNOW WHAT YOU'RE DOING
----------------------------------------------------------------------

function et_InitGame(levelTime,randomSeed,restart)
                local modname = string.format("%s v%s", description, version)
                et.G_Print(string.format("%s loaded\n", modname))
                et.RegisterModname(modname)
end

-- TheSilencerPL - To make it better, faster and less aggravating
-- for the game, store the XP locally and reuse it
function et_ClientSpawn(clientNum, revived, teamChange, restoreHealth)
   local valXP = getXP(clientNum)
   if valXP >=  lvl1xp and valXP < lvl2xp then 
                  setlevel(clientNum,1,lvl1xp)
   elseif valXP >=  lvl2xp and valXP < lvl3xp then       
                  setlevel(clientNum,2,lvl2xp)
   elseif valXP >=  lvl3xp and valXP < lvl4xp then       
                  setlevel(clientNum,3,lvl3xp)
   elseif valXP >=  lvl4xp and valXP < lvl5xp then       
                  setlevel(clientNum,4,lvl4xp)
   elseif valXP >=  lvl5xp and valXP < lvl6xp then   
                  setlevel(clientNum,5,lvl5xp)
   elseif valXP >=  lvl6xp and valXP < lvl7xp then   
                  setlevel(clientNum,6,lvl6xp)
   elseif valXP >=  lvl7xp and valXP < lvl8xp then   
                  setlevel(clientNum,7,lvl7xp)
   elseif valXP >=  lvl8xp and valXP < lvl9xp then   
                  setlevel(clientNum,8,lvl8xp)
   elseif valXP >=  lvl9xp and valXP < lvl10xp then   
                  setlevel(clientNum,9,lvl9xp)
   elseif valXP >=  lvl10xp and valXP < lvl11xp then   
                  setlevel(clientNum,10,lvl10xp)
   elseif valXP >=  lvl11xp and valXP < lvl12xp then   
                  setlevel(clientNum,11,lvl11xp)
   elseif valXP >=  lvl12xp and valXP < lvl13xp then   
                  setlevel(clientNum,12,lvl12xp)
   elseif valXP >=  lvl13xp and valXP < lvl14xp then   
                  setlevel(clientNum,13,lvl13xp)
   elseif valXP >=  lvl14xp and valXP < lvl15xp then   
                  setlevel(clientNum,14,lvl14xp)
   elseif valXP >=  lvl15xp then   
                  setlevel(clientNum,15,lvl15xp)
   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) then return end
   if newlevel <= getlevel(playerID) then return end
                  et.trap_SendServerCommand(-1,"bp \"^vGra^7tulation ^v"..name.."^7, ^7you ^7"..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

Last edited by C!es.. (02-May-14 09:58:08)

Offline

#3 02-May-14 18:06:30

Makavelii
Member
Registered: 24-Apr-14
Posts: 9

Re: Autopromotion lua

So i can just take out the levels i dobt need?

Offline

Board footer

Powered by FluxBB