• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Help - !myrebirth

SeRoN

Banned User
Joined
Feb 6, 2012
Messages
760
Reaction score
32
Location
when angels cry, when birds don't fly, When Blood
Hello OtLanders!​
I need help with something connected to talkactions (commands), it's* !myrebirth *
I want to add it on my Ot so players can see how many rebirths they've and how many other players do.
I will be glad if I get help and gladly you'll be Repped By me and by anyone who benefits from your help..
 
Post your rebirth storage you can find it in your npc.lua script.

- - - Updated - - -

Here just put the storage after =
like this local storage = 37347373743747 << for example.
Lua:
function onSay(cid, words, param, channel)

local storage = 

	if getCreatureStorage(cid, storage) > 0 then
		doCreatureSay(cid,"You have "..storage.." rebirths!", TALKTYPE_ORANGE_1)
	else
		doCreatureSay(cid,"You dont have any rebirths", TALKTYPE_ORANGE_1)
	end
	return true
end
 
well..
Here it is..

Rebirth NPC
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rebirth" script="data/npc/scripts/rebirth.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
<look type="73" head="78" body="88" legs="0" feet="88" addons="3"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. Im in charge of the 'Rebirth' system."/>
        <parameter key="message_farewell" value="Good bye my dear friend."/>
    </parameters>
</npc>

Script:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg) end
function onThink()					npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
	if(msgcontains(msg, 'rebirth')) then
		selfSay('Are you ready to prestige and start a new life?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		-------CONFIGS-------
		local level = 717217
		local cost = 0
		------/CONFIGS-------
		-----LOCALS-----
		local id = getPlayerGUID(cid)
		local name = getCreatureName(cid)
		local vocation = getPlayerVocation(cid)
		local storage = getCreatureStorage(cid, 85987)
		----/LOCALS-----
		if(getPlayerLevel(cid) >= level) then
				if(isInArray({5, 6, 7, 8}, vocation)) then
					doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
					doRemoveCreature(cid)
	                            db.query("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 0 WHERE `id` ='"..id.."';")
					db.query("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
				else
					selfSay('Please talk with Forgotten King and promote first.', cid)
					talkState[talkUser] = 0
				end
		else
			selfSay('Only characters of level 717217k or higher can be rebirthed.', cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		selfSay('Okey. Come back when you feel ready.', cid)
		talkState[talkUser] = 0
	end
 
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

- - - Updated - - -

Post your rebirth storage you can find it in your npc.lua script.

- - - Updated - - -

Here just put the storage after =
like this local storage = 37347373743747 << for example.
Lua:
function onSay(cid, words, param, channel)

local storage = 

	if getCreatureStorage(cid, storage) > 0 then
		doCreatureSay(cid,"You have "..storage.." rebirths!", TALKTYPE_ORANGE_1)
	else
		doCreatureSay(cid,"You dont have any rebirths", TALKTYPE_ORANGE_1)
	end
	return true
end

everytime i say it this appears:you don't have any rebirths even if i have rebirth
 
Did u edite local storage? anyway try this.
Lua:
function onSay(cid, words, param, channel)
 
local storage = 85987
 
	if getCreatureStorage(cid, storage) > 0 then
		doCreatureSay(cid,"You have "..getCreatureStorage(cid, storage).." rebirths!", TALKTYPE_ORANGE_1)
	else
		doCreatureSay(cid,"You dont have any rebirths", TALKTYPE_ORANGE_1)
	end
	return true
end
 
Back
Top