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

[C++] If getPlayerStorage and equipItem = x then...

GarQet

Own3d!
Joined
Feb 10, 2009
Messages
1,381
Solutions
14
Reaction score
81
I need to do something like this in sources:
LUA:
function onEquip(cid, item, slot) 

	if(getPlayerStorageValue(cid, 2469) ~= 1) then
		doPlayerSendTextMessage(cid, 25, "You can't wear it.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	else
		return TRUE
	end
end
My attempts to create this (movement.cpp):
Code:
	std::string str;
	getStorage("2332", str);
	int32_t SRT = atoi(str.c_str());
	
	if(SRT == 1 && Item::items[item->2332()])
		return false;
Unfortunately, it doesn't work.
Please help with this.
Yours GarQet.
 
Why want u to do it in sources?
You can do it this way
LUA:
function onEquip(cid, item, slot) 
 
	if(getPlayerStorageValue(cid, 2469) ~= 1) then
		doPlayerSendTextMessage(cid, 25, "You can't wear it.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	        return FALSE
        end
	return TRUE
end
 
Because I must refer to the functions contained in items.xml and the script.
At the same time can not be done in lua.

LUA:
function onEquip(cid, item, slot) 

	if(getPlayerStorageValue(cid, 2469) ~= 1) then
		doPlayerSendTextMessage(cid, 25, "You can't wear it.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	else
		return TRUE
	end
end
+
Code:
	<item id="2469" name="dragon scale legs">
		<attribute key="weight" value="4800"/>
		<attribute key="armor" value="10"/>
		[B]<attribute key="absorbPercentAll" value="25"/>[/B]
		<attribute key="slotType" value="legs"/>
	</item>
 
Back
Top