• 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 Easy Talkaction Fix

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Here is the core of the talkaction that is not working properly

LUA:
if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) < 5 and getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))
		doPlayerAddSkillTry(cid, 5, 75)
		setPlayerStorageValue(cid, 26001, 5)
elseif getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 100)
		setPlayerStorageValue(cid, 26001, 10)
elseif getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 125)
		setPlayerStorageValue(cid, 26001, 15)
end

As of this code the player can repeatedly say the talkaction and get the bonus, how do I stop this and make it so if lvl 5-10 then set storage value to 5, if level 10 through 15, set to 10 and DO NOT repeat omg this is SOOOO frustrating
 
Actually, the only thing I can think of is this script is not allowing anyone but level 5-9 use it....

Post the error, or possibly the hole script.

- - - Updated - - -

LUA:
	if getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 10 then
if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) < 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))
		doPlayerAddSkillTry(cid, 5, 75)
		setPlayerStorageValue(cid, 26001, 5)

elseif	getPlayerStorageValue(cid, 26001) == 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 100)
		setPlayerStorageValue(cid, 26001, 10)
		
elseif getPlayerStorageValue(cid, 26001) == 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 125)
		setPlayerStorageValue(cid, 26001, 15)
end
else
	doPlayerSendCancel(cid, "You are not in the level range to use this!")
return false
end
 
Last edited:
No error in the startup logs this is what they say

Code:
[11:9:34.092] > Loading actions... done.
[11:9:34.274] > Loading talkactions... [Error - LuaInterface::loadFile] data/talkactions/scripts/foodcheck.lua:4: ')' expected near 'full'

heres the whole code

LUA:
function onSay(cid, words, param, channel)

if getPlayerStorageValue(cid, 25001) ~= 1 then doPlayerPopupFYI(cid, "You are not a dwarf!")
end

if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) < 5 and getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))
		doPlayerAddSkillTry(cid, 5, 75)
		setPlayerStorageValue(cid, 26001, 5)
elseif getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 100)
		setPlayerStorageValue(cid, 26001, 10)
elseif getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 125)
		setPlayerStorageValue(cid, 26001, 15)
end
	


	return true
end
 
Thats not related to this script....if you put in the code i gave you, it will work....Look in your file called foodcheck

- - - Updated - - -

talkactions/scripts/foodcheck.lua:4: ')' expected near 'full'
 
with this code

LUA:
 if getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 10 then
if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) < 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))
		doPlayerAddSkillTry(cid, 5, 75)
		setPlayerStorageValue(cid, 26001, 5)
 
elseif	getPlayerStorageValue(cid, 26001) == 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 100)
		setPlayerStorageValue(cid, 26001, 10)
 
elseif getPlayerStorageValue(cid, 26001) == 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 125)
		setPlayerStorageValue(cid, 26001, 15)
end
else
	doPlayerSendCancel(cid, "You are not in the level range to use this!")
return false
end

the player can repeatedly do it over and over
 
LUA:
if getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 10 then
if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) < 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))
		doPlayerAddSkillTry(cid, 5, 75)
		setPlayerStorageValue(cid, 26001, 5)
 
elseif	getPlayerStorageValue(cid, 26001) == 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 100)
		setPlayerStorageValue(cid, 26001, 10)
 
elseif getPlayerStorageValue(cid, 26001) == 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 125)
		setPlayerStorageValue(cid, 26001, 15)
elseif getPlayerStorageValue(cid, 26001) > 10 then
	doPlayerSendCancel(cid, "You cannot use this anymore.")
	return false
end
else
	doPlayerSendCancel(cid, "You are not in the level range to use this!")
return false
end
 
Finally, this code
LUA:
function onSay(cid, words, param, channel)

if getPlayerStorageValue(cid, 25001) ~= 1 then doPlayerPopupFYI(cid, "You are not a dwarf!")
end 

if getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 10 then
if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) < 5 and getPlayerStorageValue(cid then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))
		doPlayerAddSkillTry(cid, 5, 75)
		setPlayerStorageValue(cid, 26001, 5)
	end
end

if getPlayerLevel(cid) >= 10 and getPlayerLevel(cid) < 15 then
if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 5 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 100)
		setPlayerStorageValue(cid, 26001, 10)
	end
end

if getPlayerLevel(cid) >= 15 and getPlayerLevel(cid < 20 then 
if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 125)
		setPlayerStorageValue(cid, 26001, 15)
	end
end
return false
end
worked
 
Didn't see you say level specification.

- - - Updated - - -

This is what you want.

LUA:
function onSay(cid, words, param, channel)
 
if getPlayerStorageValue(cid, 25001) ~= 1 then 
doPlayerPopupFYI(cid, "You are not a dwarf!")
return false
end 

if getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) < 5 then
	if getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 10 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))
		doPlayerAddSkillTry(cid, 5, 75)
		setPlayerStorageValue(cid, 26001, 5)
			else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You're prayer is not strong enough!")
	return false
	end

elseif getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 5 then
	if getPlayerLevel(cid) >= 10 and getPlayerLevel(cid) < 15 then
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 100)
		setPlayerStorageValue(cid, 26001, 10)
			else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You're prayer is not strong enough!")
	return false
	end
	
elseif getPlayerStorageValue(cid, 25001) == 1 and getPlayerStorageValue(cid, 26001) == 10 then
	if getPlayerLevel(cid) >= 15 and getPlayerLevel(cid < 20 then 
		doPlayerPopupFYI(cid, "You prayed to the dwarven God and received a bonus to your max health and a bonus to your shielding stat.")
		setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid) + 15))		
		doPlayerAddSkillTry(cid, 5, 125)
		setPlayerStorageValue(cid, 26001, 15)
	end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You no longer need to pray.")
	return false
end
end
return true
end
 
Last edited:
Back
Top