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

TFS 0.2.15 - Reward talkaction

Tamiko

Member
Joined
Sep 1, 2014
Messages
24
Reaction score
0
Hi all

My TFS: 0.2.15


I would like to ask you guys and girls for script to give players specific reward.

I mean lets say server crashed due to some bugs and before fixed was offline for few hours.
I would like to reward people with random item


!reward 2160 100
!reward id

Like that I could choose what id of an item I wanna give to every person with a red broadcast msg that they received an item due to server problems or anything like recompense due to problems
- via mail or directly to backpack, but Idk tho how it would work with offline players o,o

thx in advance!
Tamiko
 
Code:
function onSay(cid, words, param)

     if param == "" then
         doPlayerSendCancel(cid, "Missing param")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         return false
     end
     local t = {}
     for s in string.gmatch(param, "%S+") do
         table.insert(t, s)
     end
     if not tonumber(t[1]) or tonumber(t[1]) < 1000 or tonumber(t[1]) > 20305 then
         doPlayerSendCancel(cid, "Missing or wrong itemid")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         return false         
     end
     local count = tonumber(t[2]) and t[2] or 1
     local text = (count == 1 and getItemDescriptions(t[1]).article or count).." "..(count == 1 and getItemDescriptions(t[1]).name or getItemDescriptions(t[1]).plural)
     for _, player in pairs(getOnlinePlayers()) do
         local pid = getPlayerByName(player)
         if pid ~= cid then
             doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received "..text..".")
             doPlayerAddItem(pid, t[1], count)
             doSendMagicEffect(getThingPos(pid), CONST_ME_FIREWORK_YELLOW)
         end
     end
     broadcastMessage("Because of the crash all players received "..text..".")
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have send "..text.." to all online players.")
     doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_RED)
     return true
end

Code:
!reward "2160 100
!reward "2160
If you don't add a count it will be 1.
 
Back
Top