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

TalkAction Useful commands, /getPlayerItem, /getPlayerStorage and /setPlayerStorage

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Reaction score
53
Location
Włocławek
What is it?
/getPlayerItem Player, itemid/itemname will check how many items with id "itemid" "Player" have. It may come useful in many ways.

/getPlayerStorage Player, storage will check value of "Player's" "storage". With it you can check is player have done quest or do player have addon and many things.

/setPlayerStorage Player, storage, value it wil set "Player's" storage "storage" to value "value". The usage is obvious. You can manage storage values of player. Great for quest tests etc.


Why i need it?
Those commands can be useful for bug tracking or preventing players scamming gamemasters with false bug reports.

How To Use?
/getPlayerStorage Azi, 3642
-Azi's storage value for 3642 is 1.

/setPlayerStorage Azi, 3642, 7
-You have successfully set Azis's storage for 3642 to value 7.

/getPlayerItem Azi, 2160
-Azi have 64 crystal coins.

/getPlayerItem Azi, Magic Plate Armor
-Azi haven't any Magic Plate Armors.



How to Install?
in data/talkactions/talkactions.xml
add that under "<talkactions>"
PHP:
	<talkaction log="yes" words="/setPlayerStorage" access="3" event="script" value="storage.lua"/>
	<talkaction log="yes" words="/getPlayerStorage" access="3" event="script" value="storage.lua"/>
	<talkaction log="yes" words="/getPlayerItem" access="3" event="script" value="getitem.lua"/>

now in data/talkactions/scripts/ make 2 files: getitem.lua and storage.lua

To getitem.lua paste this:
PHP:
function onSay(cid, words, param, channel)
	if(param ~= "")then
		local param = string.explode(param, ',')
		if(isNumber(param[2]))then
		param[2] = getItemNameById(param[2])
		end
		local item = getItemIdByName(param[2], FALSE)
		local player = getPlayerByName(param[1])
		if(isPlayer(player))then
			if(isNumber(item))then
				local count = getPlayerItemCount(cid, item)
				if(count > 1)then
					doPlayerSendTextMessage(cid, 19, getPlayerName(player).." have "..count.." "..getItemPluralNameById(item)..".")
				elseif(count == 1)then
					doPlayerSendTextMessage(cid, 19, getPlayerName(player).."  have 1 "..getItemNameById(item)..".")
				else
					doPlayerSendTextMessage(cid, 19, getPlayerName(player).." haven't any "..getItemPluralNameById(item)..".")
				end
			else
				doPlayerSendCancel(cid, "Item not found.")
			end
		else
			doPlayerSendCancel(cid, "This player is not online.")
		end
	else
		doPlayerSendCancel(cid, "Command requires params.")
	end
	return TRUE
end

and to storage.lua paste:
PHP:
function onSay(cid, words, param, channel)
	if(param ~= "")then
		local param = string.explode(param, ',')
		local player = getPlayerByName(param[1])
		local storKey = param[2]
		local storVal = param[3]
		if(words == "/setPlayerStorage")then
			if(isNumber(storKey) == TRUE and isNumber(storVal) == TRUE)then
				setPlayerStorageValue(player, storKey, storVal)
				doPlayerSendTextMessage(cid, 19, "you have successfully set "..getPlayerName(player).."'s storage value for "..storKey.." to value "..storVal..".")
			else
				doPlayerSendCancel(cid, "Incorrect params.")
			end
		else
			if(isNumber(storKey))then
				local value = getPlayerStorageValue(player, storKey)
				doPlayerSendTextMessage(cid, 19, getPlayerName(player).."'s Nick Gracza's storage value for "..storKey.." is "..value..".")
			else
				doPlayerSendCancel(cid, "Incorrect params.")
			end
		end
	else
		doPlayerSendCancel(cid, "Command requires params.")
	end
	return TRUE
end
 
Last edited:
FFFFFFFFFFFFINALLY! Thank you so much for the set player storage, I finally have a way to do donation outfits :p
 
Fix error!
In first post i fix /setPlayerStorage, now works(word fixed)!
 
getPlayerItem DOES NOT work.

21:14 /getplayeritem aeon, 2160
21:14 Aeon have 28 crystal coins.
21:14 Aeon [18]: i got 1


It says he does not have an item when he does.
 
#up
lol? it is impossible, maybe you have inside in backpacks more cc? :s, it tested and works 100% without bugs.
 
Lua:
local count = getPlayerItemCount(cid, item)
should be
Lua:
local count = getPlayerItemCount(player, item)
shouldn't it?
 
@up
Why? Cid is characterID right? What's the difference. ._.

@elf
Then post here /lua command if you're so "wise" -.-
Azi made command which many users may find useful, we don't care about your super scripts unless you release them. I know, I know, "write on your own stupid noobs", we can, but no one will release them here if so. Thx, bye.
 
@makr0mango
oi my bad, I think that there should be
Code:
local count = getPlayerItemCount(player, item)
otherwise it will check for items on GM xD
 
Azi..
Its possible?
Code:
/setPlayerStorage Kekox, 3642, [b]-1[/b]
to remove a storage from a player?
 
does this work for 0.3.4pl2? because
Code:
[04/08/2009 10:16:34] data/talkactions/scripts/storage.lua:17: attempt to concatenate local 'value' (a boolean value)
[04/08/2009 10:16:34] stack traceback:
[04/08/2009 10:16:34] 	data/talkactions/scripts/storage.lua:17: in function <data/talkactions/scripts/storage.lua:1>
 
it's possible
for alls player offline and online

/setPlayerStorage 3642, -1
 
Back
Top