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

Talkactions Rebirth

GoalTV

NANI?!
Joined
Jul 23, 2011
Messages
588
Reaction score
53
Hello I Have Problem With Rebirth Script For Talkactions When I Try Make Talkaction !rebirth
its not working it says need level 717171 and when I have It nothing happen and no error

Code:
local config = {
	price = 0, -- Price of first rebirth
	priceIncrease = 0, -- Works as 'price' + current rebirths * priceIncrease.
	rebirthLevel = 717171, -- Level for first rebirth.
	rebirthIncrease = 0, -- Works as 'rebirthLevel' + current rebirths * rebirthIncrease.
	maxRebirths = 1000, -- Number of times a player can rebirth.
	level = 1000, -- The level the player is set to apon rebirth.
	healthPercent = 1.00, -- 1.00 = 100%.
	health = 100, -- Only used if 'healthPercent' = 0.
	manaPercent = 1.00, -- 1.00 = 100%.
	mana = 100, -- Only used if 'manaPercent' = 0.
	keepSkills = true, -- Wether players keep skills and level apon rebirth.
	skillLevel = 10, -- Only used if 'keepSkills' = false.
	magicLevel = 0, -- Only used if 'keepSkills' = false.
	capacity = 10000, -- The capacity players are set to apon rebirth.
	templePos = {x = 0, y = 0, z = 0}, -- The place where players reset to should there town id return 0.
	Rebirth = 1 -- how many Rebirth player will get.
}
function onSay(cid, words, param, channel)
      money = config.price + (config.priceIncrease * storage)
		return true
	end
	  
      if (getPlayerLevel(cid) >= rebirthLevel) then
	   end
	    if (getPlayerMoney(cid) >= money) then
      doPlayerRemoveMoney(cid, money)
      addEvent(doRebirthPlayer, 2000, {cid=cid})
	  end
 
function doRebirthPlayer(cid)
	cid = cid.cid
	if (cid == nil) then
		return true
	end
 
	local guid = getPlayerGUID(cid)
 
	if (config.healthPercent > 0) then
		health = getCreatureMaxHealth(cid) * config.healthPercent
	else
		health = config.health
	end
	if (config.manaPercent > 0) then
		mana = getCreatureMaxMana(cid) * config.manaPercent
	else
		mana = config.mana
	end
	if (getPlayerTown(cid) > 0) then
		pos = getTownTemplePosition(getPlayerTown(cid))
	else
		pos = config.templePos
end
doAddRebirth(cid, config.Rebirth, getPlayerRebirth(cid, config.Rebirth) + 1)

	doRemoveCreature(cid, true)
	db.executeQuery("UPDATE `players` SET level = " .. config.level .. " WHERE id = " .. guid .. ";")
	db.executeQuery("UPDATE `players` SET health = " .. health .. " WHERE id = " .. guid .. ";")
	db.executeQuery("UPDATE `players` SET healthmax = " .. health .. " WHERE id = " .. guid .. ";")
	db.executeQuery("UPDATE `players` SET mana = " .. mana .. " WHERE id = " .. guid .. ";")
	db.executeQuery("UPDATE `players` SET manamax = " .. mana .. " WHERE id = " .. guid .. ";") 
	db.executeQuery("UPDATE `players` SET posx = " .. pos.x .. " WHERE id = " .. guid .. ";")
	db.executeQuery("UPDATE `players` SET posy = " .. pos.y .. " WHERE id = " .. guid .. ";")
	db.executeQuery("UPDATE `players` SET posz = " .. pos.z .. " WHERE id = " .. guid .. ";")
	db.executeQuery("UPDATE `players` SET cap = " .. config.capacity .. " WHERE id = " .. guid .. ";")

	if (not config.keepSkills) then
		db.executeQuery("UPDATE `players` SET maglevel = " .. config.magicLevel .. " WHERE id = " .. guid .. ";")
		db.executeQuery("UPDATE `player_skills` SET value = " .. config.skillLevel .. " WHERE id = " .. guid .. ";")
	end
	return true
end

I Have Rebirth On Mysql Named Rebirths
My Rebirth System Is Here http://otland.net/f82/best-rebirth-system-mysql-god-batonik-gensior-script-186274/
thanks
 
first go to lib/050-function.lua
and add this
Code:
function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,36874,resets+1)
return true
end

function getResets(cid)
resets = getPlayerStorageValue(cid,36874)
if resets < 0 then
resets = 0
end
return resets
end
and later, go to talkaction/script and create an new archive named reset.lua
and put this
Code:
function onSay(cid, words, param)

local newlevel = 2500
local newexp = 0
local level = 1000
local leveltoreset = 717217
local price = 0
local limit = 10
local pos = getPlayerPosition(cid)
local keepSkills = true

if getTilePzInfo(pos) == TRUE then 
        doRemoveCondition(cid,CONDITION_INFIGHT) 
else 
doPlayerSendCancel(cid,"Use only in Area PZ.") 
        return TRUE 
end

if getResets(cid) >= limit then
doPlayerPopupFYI(cid, "you have reached the maximum limit.")
return TRUE
end

if getPlayerLevel(cid) < leveltoreset then
doPlayerPopupFYI(cid, "Needs to be" .. leveltoreset .. "level to use this command.")
else
addReset(cid)
playerid = getPlayerGUID(cid)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
if (not keepSkills) then
		db.executeQuery("UPDATE `players` SET maglevel = " .. magicLevel .. " WHERE `players`.`id`= ".. playerid .."")
		db.executeQuery("UPDATE `player_skills` SET value = " .. skillLevel .. " WHERE `players`.`id`= ".. playerid .."")
	end
end        
return TRUE
end

and put this in talkaction.xml
<talkaction words="!reset" event="script" value="reset.lua"/>

PS: I'm starting in the scripting world, so the script is simple, but I use one similar to this
 
Back
Top