Guest User

Untitled

a guest
Jan 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. function give()
  2.     if isPlayer(cid) == 1 then                                          -- if it's a player then
  3.         doPlayerAddItem(cid, 2195, 1)                                   -- add an item to the player. In this case ONE pair of BOH
  4.     elseif not isPlayer(cid) == 1 then                                  -- else if it's not a player
  5.         doPlayerSendTextMessage(cid, 22, "Only players can get items")  -- Sends message to player 22 = green text
  6.     else
  7.         doPlayerSendCancel(cid, "Sorry, not possible.")                 -- If none of the statements is correct, send cancel message to player
  8.     end                                                                 -- this "end" close the "if"
  9.    
  10.     return true                                                         -- this function can be used because it return true
  11. end                                                                     -- closes the function give()
  12.  
  13. -- Another thing
  14.  
  15.     if item.itemid == 1000 then
  16.         doShit()
  17.     elseif item.itemid == 1001 then
  18.         doOtherShit()
  19.     elseif item.itemid == 1002 then
  20.         doSomeOtherShit()
  21.     end
  22.    
  23. -- As you can see inside the "if" to the "end" you can use elseif statement how ever you want
  24.  
  25.     if item.itemid == 1000 then                         -- Starter IF
  26.         if getPlayerItemCount(cid, 2000) >= 1 then      -- use if else end inside a started if
  27.             doSomeFuckingShit()
  28.         else
  29.             send("You don't have that item of id 2000")
  30.         end
  31.     elseif item.itemid == 1001 then
  32.         if getPlayerItemCount(cid, 2001)
  33.             doSomeMoreShitFFS()
  34.         else
  35.             send("You don't have that item of id 2001")
  36.         end
  37.     end                                                 -- closes the first if
Add Comment
Please, Sign In to add comment