5lave Ots
Active Member
// Update 16/6 1:35 am >> improve the text message for the player to send pop up text msg with rewarded item //
@caquinha asked for a talkaction to send offline / online reward to a player
how it works?
you type / reward Player Name, Item ID or name, Item Count
if the player is offline a depot parcel is send. if he is online he will get a notify and magic effect
**you can use item id or item name. wrong ids or name will not make tfs error and will not be sent
**i had modify the maximum item count to 999 so its dosnt send +12 item spot in a parcel with 12 container spots
//tell me if i should make any thing with it//
as always thanks for @Gesior.pl for overlook the code
Please keep UP to date with that script because in case of finding anything mistake
@caquinha asked for a talkaction to send offline / online reward to a player
how it works?
you type / reward Player Name, Item ID or name, Item Count
if the player is offline a depot parcel is send. if he is online he will get a notify and magic effect
**you can use item id or item name. wrong ids or name will not make tfs error and will not be sent
**i had modify the maximum item count to 999 so its dosnt send +12 item spot in a parcel with 12 container spots
//tell me if i should make any thing with it//
Lua:
function onSay(cid, words, param)
local par = string.explode(param, ",")
if(not par[1]) or (not par[2]) or (not par[3]) or (param == "") then
doPlayerSendCancel(cid,'please enter a vailed params\nuse:['..words..' Player_name, Item_id, Item Count]')
doSendMagicEffect(getCreaturePosition(cid),2)
return true
end
if(not isNumber(par[3])) or (tonumber(par[3]) > 999)then
doPlayerSendCancel(cid, 'please enter a valid numeric item count')
return true
end
--/reward Name, item Id or name, Count
player = db.getResult('SELECT `name`, `town_id` FROM `players` WHERE `name` = "' .. par[1] .. '";')
if(player:getID() == -1) then --wrong player name
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'invalid player name.')
return true
else
if not isNumber(par[2])then --item name??
item = getItemIdByName(par[2], false)
p_item = par[2]
if not item then
doPlayerSendCancel(cid, 'please enter a valid item name')
return true
end
else
p_item = getItemNameById(par[2])
item = par[2]
end
local pp = getPlayerByNameWildcard(par[1])
if isPlayer(pp) then
doPlayerPopupFYI(pp,'you have been rewarded with '..par[3]..'x '..p_item..' by '.. getPlayerName(cid)..'\nPlease go ahead to your main depot!')
doSendMagicEffect(getCreaturePosition(pp),27)
end
local chest = doCreateItemEx(2595)
doAddContainerItem(chest, item, par[3])
doPlayerSendMailByName(par[1], chest, player.town_id)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'items was sent to '..par[1]..' succesfuly')
end
return true
end
Please keep UP to date with that script because in case of finding anything mistake
Last edited: