Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. function BuyCommand(PlayerID, ...)
  2.     local ItemName = table.concat(arg, " ")
  3.     local ItemID = (arg[1]) and getItemID(ItemName)
  4.     local ItemPrice, ItemAreas, ItemMaxAmount
  5.     if ItemID then
  6.         ItemPrice = getItemPrice(ItemID)
  7.         ItemAreas = getItemAreas(ItemID)
  8.         ItemMaxAmount = getItemMaxAmount(ItemID)
  9.     end
  10.    
  11.     local PlayerCash = mgGetPlayerCash(PlayerID)
  12.     local PlayerArea = getPlayerArea(PlayerID)
  13.     local PlayerItemAmount = getPlayerItemAmount(PlayerID, ItemID)
  14.    
  15.     if not ItemName then
  16.         -- type item name!
  17.     elseif not ItemID then
  18.         -- item not found man!
  19.     elseif PlayerCash < ItemPrice then
  20.         -- not enuf cash
  21.     elseif isPlayerSpawned(PlayerID) == 0 or not vinTable(ItemAreas, PlayerArea) then
  22.         -- not in the right area to buy this item!
  23.     elseif PlayerItemAmount == ItemMaxAmount then
  24.         -- cant buy anymore!
  25.     else
  26.         -- valid
  27.     end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement