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

VIP Talkactions

Animera

* * * * *
Joined
Dec 9, 2008
Messages
2,449
Solutions
5
Reaction score
618
Location
ANIMERARPG.ONLINE
I want a vip system working with items with a poins system.

I want the following talkactions:
!vipp PLAYERNAME , amount
!vipm PLAYERNAME , amount
!(donationitem) removes -XX from XXX storage


!vipp = plus XX (adds +XX in XXX storage)
!vipm = minus XX (removes -XX in XXX storage)

i gave it a try but it doesn't work:
PHP:
function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 35456) > 4 then
setPlayerStorageValue(player,35456,getPlayerStorageValue(player) - 4)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN, cid)
doCreatureSay(cid, "Congratulations you just bought solar axe.", TALKTYPE_ORANGE_1)    
doCreateItemEx(8925, 1)
elseif getPlayerStorageValue(cid, 35456) < 4 then
doPlayerSendCancel(cid,'You have not enough points to buy this item.') 
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF, cid)
return TRUE
end
end

PHP:
function onUse(cid, item, frompos, item2, topos)
doCreatureSay(cid, "CONGRATULATIONS! You got now 10 donation points", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 35456 + 10)
doRemoveItem(item.uid, 1)
        return TRUE
end
 
Code:
local t = {
	['solaraxe'] = {5, 8925},
}
function onSay(cid, words, param, channel)
	local i = t[words:sub(2)]
	if getPlayerStorageValue(cid, 35456) >= i[1] then
		setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) - i[1])
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
		doCreatureSay(cid, "Congratulations, you just bought " .. getItemInfo(i[2]).article .. " " .. getItemInfo(i[2]).name .. " for " .. i[1] .. " points!", TALKTYPE_ORANGE_1)
		doPlayerAddItem(cid, i[2], 1)
	else
		doPlayerSendCancel(cid, "You need atleast " .. i[1] .. " points to buy this item.") 
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	end
	return true
end
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doCreatureSay(cid, "CONGRATULATIONS! You just gained 10 donation points!", TALKTYPE_ORANGE_1)
	setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) + 10)
	doRemoveItem(item.uid, 1)
	return true
end
 
@Up,
Pwnt you back! ^_^

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) return doCreatureSay(cid, "CONGRATULATIONS! You just gained 10 donation points!", TALKTYPE_ORANGE_1) and setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) + 10) and doRemoveItem(item.uid, 1) end

Code:
function onSay(cid, words, param, channel)
	local t = {
		['solaraxe'] = {5, 8925}
	}
	local i = t[words:sub(2)]
	return getPlayerStorageValue(cid, 35456) >= i[1] and setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) - i[1]) and doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN) and doCreatureSay(cid, "Congratulations, you just bought " .. getItemInfo(i[2]).article .. " " .. getItemInfo(i[2]).name .. " for " .. i[1] .. " points!", TALKTYPE_ORANGE_1) and doPlayerAddItem(cid, i[2], 1) or getPlayerStorageValue(cid, 35456) < i[1] and doPlayerSendCancel(cid, "You need atleast " .. i[1] .. " points to buy this item.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
 
@Up,
Pwnt you back! ^_^

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) return doCreatureSay(cid, "CONGRATULATIONS! You just gained 10 donation points!", TALKTYPE_ORANGE_1) and setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) + 10) and doRemoveItem(item.uid, 1) end

Code:
function onSay(cid, words, param, channel)
	local t = {
		['solaraxe'] = {5, 8925}
	}
	local i = t[words:sub(2)]
	return getPlayerStorageValue(cid, 35456) >= i[1] and setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) - i[1]) and doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN) and doCreatureSay(cid, "Congratulations, you just bought " .. getItemInfo(i[2]).article .. " " .. getItemInfo(i[2]).name .. " for " .. i[1] .. " points!", TALKTYPE_ORANGE_1) and doPlayerAddItem(cid, i[2], 1) or getPlayerStorageValue(cid, 35456) < i[1] and doPlayerSendCancel(cid, "You need atleast " .. i[1] .. " points to buy this item.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
IMO, this is just annoying & hard to read + copy & paste.
 
2qjk7wg.png

Iget this error if i use the same script but other id and name at first lines
 
here are 2 examples
Fusionhammer doesn't work.. Solaraxe does..

PHP:
<talkaction words="!fusionhammer" event="script" value="fusionhammer.lua"/>
<talkaction words="!solaraxe" event="script" value="solaraxe.lua"/>

PHP:
local t = {
	['solaraxe'] = {4, 8925},
}
function onSay(cid, words, param, channel)
	local i = t[words:sub(2)]
	if getPlayerStorageValue(cid, 35456) >= i[1] then
		setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) - i[1])
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
		doCreatureSay(cid, "Congratulations, you just bought " .. getItemInfo(i[2]).article .. " " .. getItemInfo(i[2]).name .. " for " .. i[1] .. " points!", TALKTYPE_ORANGE_1)
		doPlayerAddItem(cid, i[2], 1)
	else
		doPlayerSendCancel(cid, "You need atleast " .. i[1] .. " points to buy this item.") 
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	end
	return true
end


PHP:
local t = {
	['Fusion hammer'] = {3, 2444},
}
function onSay(cid, words, param, channel)
	local i = t[words:sub(2)]
	if getPlayerStorageValue(cid, 35456) >= i[1] then
		setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) - i[1])
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
		doCreatureSay(cid, "Congratulations, you just bought " .. getItemInfo(i[2]).article .. " " .. getItemInfo(i[2]).name .. " for " .. i[1] .. " points!", TALKTYPE_ORANGE_1)
		doPlayerAddItem(cid, i[2], 1)
	else
		doPlayerSendCancel(cid, "You need atleast " .. i[1] .. " points to buy this item.") 
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	end
	return true
end
 
Code:
function onSay(cid, words, param, channel)
	local t = {
		["Fusion hammer"] = {s = 3, k = 2444},
		["solaraxe"] = {s = 4, k = 8925}
	}
	local v = t[words:gsub("^%s*(.-)%s*$", "%1")]
	if getPlayerStorageValue(cid, 35456) >= v.s then
		setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456)-v.s)
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
		doCreatureSay(cid, "Congratulations, you just bought " .. getItemInfo(v.k).article .. " " .. getItemInfo(v.k).name .. " for " .. v.s .. " points!", TALKTYPE_ORANGE_1)
		doPlayerAddItem(cid, v.k, 1)
	else
		doPlayerSendCancel(cid, "You need atleast " .. v.s .. " points to buy this item.")
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	end
	return true
end
;d
 
Last edited:
Code:
<talkaction words="!solaraxe;!fusionhammer" event="script" value="script.lua"/>
Code:
local t = {
	['solaraxe'] = {5, 8925},
	['fusionhammer'] = {3, 2444},
}
function onSay(cid, words, param, channel)
	local i = t[words:sub(2)]
	if getPlayerStorageValue(cid, 35456) >= i[1] then
		setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) - i[1])
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
		doCreatureSay(cid, "Congratulations, you just bought " .. getItemInfo(i[2]).article .. " " .. getItemInfo(i[2]).name .. " for " .. i[1] .. " points!", TALKTYPE_ORANGE_1)
		doPlayerAddItem(cid, i[2], 1)
	else
		doPlayerSendCancel(cid, "You need atleast " .. i[1] .. " points to buy this item.") 
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	end
	return true
end
 
Thanks a lot it works but i have also a item (assassin bolt) how can i edit it so i get 100 instead of 1? i tried this:
PHP:
['assassin bolt'] = {1, 6529, 100},

Wich didn't work also no errors ;d
 
Code:
local t = {
	['solaraxe'] = {5, 8925},
	['fusionhammer'] = {3, 2444},
	['assassin bolt'] = {1, 6529, 100},
}
function onSay(cid, words, param, channel)
	local i = t[words:sub(2)]
	if getPlayerStorageValue(cid, 35456) >= i[1] then
		setPlayerStorageValue(cid, 35456, getPlayerStorageValue(cid, 35456) - i[1])
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
		doCreatureSay(cid, "Congratulations, you just bought " .. (i[3] or getItemInfo(i[2]).article) .. " " .. (i[3] and getItemInfo(i[2]).plural or getItemInfo(i[2]).name) .. " for " .. i[1] .. " points!", TALKTYPE_ORANGE_1)
		doPlayerAddItem(cid, i[2], i[3] or 1)
	else
		doPlayerSendCancel(cid, "You need atleast " .. i[1] .. " points to buy this item.") 
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	end
	return true
end
 
Back
Top