Advertisement
RoksasNunes

OWN_YOUR_SPAW

Apr 22nd, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. function onSay(cid, words, param)
  2.  
  3. local t = string.explode(param, ",")  
  4. local pos = getCreaturePosition(cid)
  5.  
  6. local cfg = {
  7.     max_summon = 9,
  8.     price = 100000,
  9. }      
  10.  
  11.     if #getPlayersInArea({fromx = pos.x+4, fromy = pos.y+4, fromz = pos.z, tox = pos.x-4, toy = pos.y-4, toz = pos.z}) > 1 then
  12. doPlayerSendTextMessage(cid, 20, "Do this in a place where no other players.") return true end
  13.  
  14.     if not t[1] or not t[2] or not tonumber(t[2]) then
  15. doPlayerSendTextMessage(cid, 20, "The command does not recognize these parameters.") return true end
  16.  
  17.     if tonumber(t[2]) > cfg.max_summon then
  18. doPlayerSendTextMessage(cid, 20, "Maximum monsters in your spawn is "..cfg.max_summon..", rushed.") return true end
  19.  
  20.     if not doPlayerRemoveMoney(cid, cfg.price) then
  21. doPlayerSendTextMessage(cid, 20, "You do not have enough money to buy their own spawn!") return true end
  22.  
  23.     for i = 1, t[2] do
  24.         doCreateMonster(t[1], {x = pos.x+3, y = pos.y+3, z = pos.z})
  25.     end
  26.         doPlayerSendTextMessage(cid, 20, "His spawn was summoned, good level up for you!")
  27.             return true
  28.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement