Advertisement
Guest User

Untitled

a guest
Mar 16th, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. function onSay(cid, words, param, channel)
  2.  
  3. local T = string.explode(param, ",")
  4. local player = getPlayerByName(T[1])
  5. local blocked = {1, 2, 3, 4} -- blocked items
  6.  
  7. if not player then
  8. doPlayerSendTextMessage(cid, 27, "Player not found.") return true
  9. elseif not tonumber(T[2]) or not tonumber(T[3]) then
  10. doPlayerSendTextMessage(cid, 27, words .. " Player Name, Item Id, type.") return true
  11. elseif getCreatureName(cid) == T[1] then
  12. doPlayerSendTextMessage(cid, 27, "You can't send items for yourself.") return true
  13. elseif not doPlayerRemoveItem(cid, T[2], T[3]) then
  14. doPlayerSendTextMessage(cid, 27, "[ERROR] You don't have this item.") return true
  15. elseif isInArray(blocked, T[2]) then
  16. doPlayerSendTextMessage(cid, 27, "Blocked Id.") return true
  17. end
  18.  
  19. doPlayerSendTextMessage(cid, 27, "You send " .. T[3] .. "x " .. getItemNameById(T[2]) .. " to " .. T[1] .. ".")
  20. doPlayerSendTextMessage(player, 27, "You received " .. T[3] .. "x " .. getItemNameById(T[2]) .. ".")
  21. doPlayerAddItem(player, T[2], T[3])
  22. return true
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement