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

[REQUEST] Restart Player Exp and Levels

Madlander

Madlander
Joined
Sep 16, 2009
Messages
318
Reaction score
16
Location
Mexico
hello otlanders, im looking for a talkaction to restart a player`s exp and lvls

eg: a lvl 300 player with exp 2134124122 (ejample) , will restart to lvl 8 with exp 200.

the GOD command = !restart pakito
pakito = player`s name

thanks for read my request :$
 
UPDATED sorry this script resets all players at once and only exp and level
in talk actions/scripts make
resetplayer.lua
Code:
function ResetPlayer(level)
	local query = db.getResult("UPDATE Players SET level='8', experience='200'WHERE id='getPlayerLevel(cid)' AND id='getPlayerExperience(cid)'")
	if query:getID() ~= -1 then
		return query:getDataInt("level")
	end
	return LUA_ERROR
end
function onSay(cid, words, param, channel)
	local pid = 0
	if(param == '') then
		pid = getCreatureTarget(cid)
		if(pid == 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
			return true
		end
	else
		pid = getPlayerByNameWildcard(param)
	end

	if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
		return true
	end

	if(isPlayer(pid) and getPlayerAccess(pid) >= getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot kick this player.")
		return true
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has been kicked and reset.")
	doRemoveCreature(pid)
	ResetPlayer(level)
	return true
end
and in talkactions put
Code:
	<talkaction log="yes" words="/reset" access="5" event="script" value="resetplayer.lua"/>
if this worked let me know
 
Last edited:
@izaak:
  • That'll reset ALL players no matter what params you use.
  • There's not a health/mana check, so players will stay with the same HP/MP after the reset.
 
would this work?

Code:
local id = getPlayerByID(playerId)
function ResetPlayer(level)
	local query = db.getResult("UPDATE Players SET level='8', experience='200'WHERE id='getPlayerLevel(cid)' AND id='getPlayerExperience(cid)'")
	if query:getID() ~= -1 then

		return query:getDataInt("level")
	end
	return LUA_ERROR
end
this seems about right i my eyes but idk

yes but he said exp and levels if he wants skills ml and all of that to reset all at once then
it could be done but then info i requered about him using acc manager or samples
 
Last edited:
It will still reset all players

Try with this query (untested):
Code:
local pid = getPlayerByNameWildcard(param)
local query = db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 200 WHERE `id` = " .. getPlayerGUID(pid) .. ";")

EDIT: There
 
Last edited:
Try with this query:
Code:
local pid = getPlayerByNameWildcard(param)
local query = db.executeQuery("UPDATE `players` SET `level` = 8, `health` = 185, `healthmax` = 185, `experience` = 4200, `mana` = 35, `manamax` = 35, `cap` = 435 WHERE `id` = " .. getPlayerGUID(pid) .. ";")

EDIT: I made a mistake in the last query. The exp for level 8 is 4200.
 
God is currently working on The Rapture, so here it is:

playerreset.lua:
Code:
function doResetPlayer(cid)
	return db.executeQuery("UPDATE `players` SET `level` = 8, `health` = 185, `healthmax` = 185, `experience` = 4200, `mana` = 35, `manamax` = 35, `cap` = 435 WHERE `id` = " .. getPlayerGUID(cid) .. ";")
end

function onSay(cid, words, param, channel)
	local pid = 0
	if(param == '') then
		pid = getCreatureTarget(cid)
		if(pid == 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
			return true
		end
	else
		pid = getPlayerByNameWildcard(param)
	end

	if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
		return true
	end

	if(isPlayer(pid) and getPlayerAccess(pid) >= getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot kick this player.")
		return true
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has been kicked.")
	doResetPlayer(pid)
	doRemoveCreature(pid)
	return true
end

In talkactions.xml:
Code:
	<talkaction log="yes" words="/reset" access="6" event="script" value="playerreset.lua"/>
 
Last edited:
Back
Top