• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[LUA] Change level of a player in a script....

Dantarrix

Member
Joined
Aug 27, 2010
Messages
546
Reaction score
18
Location
Stgo, Chile
Well, i need that, in a script, change the level of a player...
For example:
From 50 to 25.....
I think the only way is executing this:
LUA:
db.executeQuery("UPDATE 'players' SET 'level'= 25 WHERE 'id'=x;")

I dont know what i neet to put on x.....
How i get the player's id in db in lua....??
 
also, if your using that and updating the database with only the level, its probably not going to change the players hp and mana to how it should be.
 
also, if your using that and updating the database with only the level, its probably not going to change the players hp and mana to how it should be.

this.
and IIRC doPlayerAddLevel(cid, -25) won't work, although you can use doPlayerAddExperience(cid, (getExperienceForLevel(25) - getPlayerExperience(cid))) but the player has to heal/drink a potion to get normal hp.
I.E. if a player 30 logs and you make him get lvl 25 by this script, he will have the same hp and mana of a level 30 unless he heals/drinks a potion.
 
Try:
Code:
doPlayerAddLevel(25-getPlayerLevel(cid))
or as bogart said:
Code:
doPlayerAddExperience(cid, getExperienceForLevel(25) - getPlayerExperience(cid))
 
Back
Top