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

Problemik z exhausted

karko

New Member
Joined
Aug 5, 2011
Messages
40
Reaction score
0
Tak jak w tytule, problem ze skryptem na senzu, tj. takie magiczne fasolki co dają określoną ilość HP/Many. Mam grafikę itd., gdy już tworze je na otsie i próbuję "zjeść", piszę mi, że mam exhausted. Wina leży po stronie skryptu. Tak samo dzieje się z innymi rodzajami "senzu". Oto treść skyptów:

S1:
Code:
function onUse(cid, item, frompos, item2, topos)

	local level = getPlayerLevel(cid)
	local mlevel = getPlayerMagLevel(cid)
	
	local exhausted_seconds = 2
	local exhausted_storagevalue = 7480
	
	local mana_minimum = 40000
	local mana_maximum =40000

	local mana_add = math.random(mana_minimum, mana_maximum)
	
		
		if(item.type >= 1) then
			if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
				if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
					doPlayerAddMana(cid, mana_add)
                                        doPlayerAddHealth(cid, mana_add)
doPlayerSay(cid,"I feel the best",1)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doChangeTypeItem(item.uid, item.type - 1)
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You are exchausted.")
				end
			else
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			end
		else
			if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			else
				if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
					doPlayerAddMana(cid, mana_add)
                                        doPlayerAddHealth(cid, mana_add*1.5)
doPlayerSay(cid,"I feel the best",1)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doRemoveItem(item.uid, 1)
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You are exchausted.")
				end
			end
		end
						
	return 1
end

S2:
Code:
function onUse(cid, item, frompos, item2, topos)

	local level = getPlayerLevel(cid)
	local mlevel = getPlayerMagLevel(cid)
	
	local exhausted_seconds = 1
	local exhausted_storagevalue = 7480
	
	local mana_minimum = 5000
	local mana_maximum =5000

	local mana_add = math.random(mana_minimum, mana_maximum)
	
		
		if(item.type >= 1) then
			if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
				if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
					doPlayerAddMana(cid, mana_add)
                                        doPlayerAddHealth(cid, mana_add)
doPlayerSay(cid,"I feel the good",1)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doChangeTypeItem(item.uid, item.type - 1)
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You are exchausted.")
				end
			else
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			end
		else
			if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			else
				if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
					doPlayerAddMana(cid, mana_add)
                                        doPlayerAddHealth(cid, mana_add*1.5)
doPlayerSay(cid,"I feel good",1)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doRemoveItem(item.uid, 1)
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You are exchausted.")
				end
			end
		end
						
	return 1
end

S3:
Code:
function onUse(cid, item, frompos, item2, topos)

	local level = getPlayerLevel(cid)
	local mlevel = getPlayerMagLevel(cid)
	
	local exhausted_seconds = 2
	local exhausted_storagevalue = 7480
	
	local mana_minimum = 10000
	local mana_maximum =10000

	local mana_add = math.random(mana_minimum, mana_maximum)
	
		
		if(item.type >= 1) then
			if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
				if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
					doPlayerAddMana(cid, mana_add)
                                        doPlayerAddHealth(cid, mana_add)
doPlayerSay(cid,"I feel the better",1)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doChangeTypeItem(item.uid, item.type - 1)
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You are exchausted.")
				end
			else
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			end
		else
			if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
				doSendMagicEffect(frompos, CONST_ME_POFF)
				doPlayerSendCancel(cid, "You are exhausted.")
			else
				if(isPlayer(cid) == 1) then
doSendMagicEffect(topos,12)
					doPlayerAddMana(cid, mana_add)
                                        doPlayerAddHealth(cid, mana_add*1.5)
doPlayerSay(cid,"I feel better",1)
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doRemoveItem(item.uid, 1)
				else
					doSendMagicEffect(frompos, CONST_ME_POFF)
					doPlayerSendCancel(cid, "You are exchausted.")
				end
			end
		end
						
	return 1
end

Gdzie leży problem?
 
weź na początek zmień zamiast umieszczania ifów i elseifów takie coś:

if exhausted == true then
return you are exhausted
end

w sensie, zamiast całość obejmować exhaustedem, zrób poprostu, że jeśli ma exhausted to przerywa skrypt, tzn zwraca napis your are exhausted
 
Haha, ale żeś mi wytłumaczył :D W Lua jestem 0, chociaż prostego skrypta napisać potrafię.
 
Lua:
function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local exhausted_seconds = 2
local exhausted_storagevalue = 7480
local mana_minimum = 40000
local mana_maximum =40000
local mana_add = math.random(mana_minimum, mana_maximum)

if(exhaustion.check(cid, exhausted_storagevalue) == TRUE) then
    doPlayerSendCancel(cid, "You are exchausted.")
else
	doSendMagicEffect(topos,12)
	doPlayerAddMana(cid, mana_add)
	doPlayerAddHealth(cid, mana_add)
	doPlayerSay(cid,"I feel the best",1)
	exhaustion.set(cid, exhausted_storagevalue, exhausted_seconds)	
	return true
end
end
 
Lua:
function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local exhausted_seconds = 2
local exhausted_storagevalue = 7480
local mana_minimum = 40000
local mana_maximum =40000
local mana_add = math.random(mana_minimum, mana_maximum)

if(exhaustion.check(cid, exhausted_storagevalue) == TRUE) then
    doPlayerSendCancel(cid, "You are exchausted.")
else
	doSendMagicEffect(topos,12)
	doPlayerAddMana(cid, mana_add)
	doPlayerAddHealth(cid, mana_add)
	doPlayerSay(cid,"I feel the best",1)
	exhaustion.set(cid, exhausted_storagevalue, exhausted_seconds)	
	return true
end
end


A nie lepiej tak:
Code:
function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local exhausted_seconds = 2
local exhausted_storagevalue = 7480
local mana_minimum = 40000
local mana_maximum =40000
local mana_add = math.random(mana_minimum, mana_maximum)

if(exhaustion.check(cid, exhausted_storagevalue) == TRUE) then
   return doPlayerSendCancel(cid, "You are exchausted.")
end


	doSendMagicEffect(topos,12)
	doPlayerAddMana(cid, mana_add)
	doPlayerAddHealth(cid, mana_add)
	doPlayerSay(cid,"I feel the best",1)
	exhaustion.set(cid, exhausted_storagevalue, exhausted_seconds)	
	
	return true
end
 
Back
Top