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

Talkaction Remove Storage Value

Zarabustor

Human Being
Joined
Sep 10, 2009
Messages
186
Reaction score
0
Location
Cancun, Mexico
I want a talkaction for remove storage value from a player like
/delstorage 11515, Tester, something like that thank please help me and i will REP++ you :D.
 
Code:
-- <command> <Player>, <Key>, <Value>

function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local t = string.explode(param, ",")
	if(#t == 3) then
		local player, key, value = getPlayerByNameWildcard(t[1]), tonumber(t[2]), tonumber(t[3])
		if(t[1] and t[2] and t[3]) then
			setPlayerStorageValue(player, key, value)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "One of the params is malformed.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This command requires 3 params.")
	end

	return true
end
 
If you're using TFS 0.3+ (?) then it already exist.

Code:
function onSay(cid, words, param)
	local t = string.explode(param, ",")
	if(not t[2]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
		return true
	end

	local tid = getPlayerByNameWildcard(t[1])
	if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
		return true
	end

	if(not t[3]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, " [" .. t[1] .. " - " .. t[2] .. "] = " .. getPlayerStorageValue(tid, t[2]))
	else
		setPlayerStorageValue(tid, t[2], t[3])
	end

	return true
end

/storage name, key, value
 
excellent was what I was looking for, but there is a problem that I need for every player if someone can help me create a talkaction to remove a player storange all just run / removestorange xxxx
 
Just make sure players are offline before doing this... You can also do this manually in the database when the server is offline.

Code:
local yourStorage = 1234 -- you can set this to param or w.e you want
db.executeQuery("UPDATE `player_storage` SET `value` = -1 WHERE `key` = ".. yourStorage)
 
Back
Top