Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 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
  5.     if ItemID then
  6.         ItemPrice = getItemPrice(ItemID)
  7.         ItemAreas = getItemAreas(ItemID)
  8.     end
  9.    
  10.     local PlayerCash = mgGetPlayerCash(PlayerID)
  11.     local PlayerArea = getPlayerArea(PlayerID)
  12.    
  13.     if not ItemName then
  14.         -- type item name!
  15.     elseif not ItemID then
  16.         -- item not found man!
  17.     elseif PlayerCash < ItemPrice then
  18.         -- not enuf cash
  19.     elseif isPlayerSpawned(PlayerID) == 0 or not vinTable(ItemAreas, PlayerArea) then
  20.         -- not in the right area to buy this item!
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement