Jump to content

lua givexp new pleyer


AKUKU597

Recommended Posts

well, tbh, i'm not sure what exactly you need but basically, u can use smt like this (sure that there are lot of different scripts already available around the internet) so for example:

Spoiler

----------------------------------------------------------------------
-- 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

 

this can work if you will have:

- game mod with shrubbot lvl system complatible

- working level system with levels that u want to use and script edited according to your level system

was this what u want ?

Link to comment
Share on other sites

5 minutes ago, Eagle_cz said:

well, tbh, i'm not sure what exactly you need but basically, u can use smt like this (sure that there are lot of different scripts already available around the internet) so for example:

  Hide contents


----------------------------------------------------------------------
-- 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

 

this can work if you will have:

- game mod with shrubbot lvl system complatible

- working level system with levels that u want to use and script edited according to your level system

was this what u want ?

no, script lua which gives everyone with level 0 EXTRA XP (givexp)

Link to comment
Share on other sites

ah sorry, i read it wrong. But i have to ask, why you need that ? you already can set that without xp you will got some skills for example in server config. Maybe im dumb, but i really dont know why you want to do extra work, when is server config already giving you that power to change the class behaviour (based on XP and xp can be zero).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...