Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. local sBike = 2547
  2. local t = {
  3. [13984] = {article='', name='', text='', dtext='', s=32001, condition=bikeCondition},
  4. }
  5.  
  6. function BikeSpeedOn(cid,nSpeed)
  7. setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))
  8. doChangeSpeed(cid,-getCreatureSpeed(cid))
  9. doChangeSpeed(cid,nSpeed)
  10. end
  11.  
  12. function BikeSpeedOff(cid)
  13. doChangeSpeed(cid,-getCreatureSpeed(cid))
  14. doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))
  15. end
  16.  
  17. function onUse(cid, item, fromPosition, itemEx, toPosition)
  18.  
  19. local v, r = getCreaturePosition(cid), t[item.itemid]
  20. local s = r.s
  21. local pos = {x = v.x, y = v.y, z = v.z}
  22.  
  23. if r then
  24. if getPlayerStorageValue(cid, 25000) == 5 then
  25. return
  26. end
  27. if getPlayerStorageValue(cid, 23000) == 5 then
  28. return
  29. end
  30.  
  31. if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or
  32. getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or
  33. getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then --alterado v1.9
  34. return doPlayerSendCancel(cid, "You can't do that right now.")
  35. end
  36.  
  37. local underwater = {231, 670, 671, 5405, 5406, 5407, 5408, 5409, 5410, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438}
  38.  
  39. if isInArray(underwater, getTileInfo(getThingPos(cid)).itemid) then
  40. return doPlayerSendCancel(cid, "Você não pode usar bike nesse local.")
  41. end
  42.  
  43. if getPlayerStorageValue(cid, 154585) >= 1 then
  44. return doPlayerSendCancel(cid, "Desculpe, isso não é possível.")
  45. end
  46.  
  47. if ( getPlayerItemCount(cid, 13984) <= 0 ) then
  48. return doPlayerSendCancel(cid, 'Coloque na mochila para poder usar.')
  49. end
  50.  
  51. if getPlayerStorageValue(cid, s) <= 0 then
  52. doCreatureSay(cid, r.text, 19)
  53. setPlayerStorageValue(cid, s, 1)
  54. BikeSpeedOn(cid,600)
  55. if getPlayerSex(cid) == 1 then
  56. doSetCreatureOutfit(cid, {lookType = 603, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
  57. else
  58. doSetCreatureOutfit(cid, {lookType = 602, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
  59. end
  60.  
  61. elseif getPlayerStorageValue(cid, s) == 1 then
  62. doCreatureSay(cid, r.dtext, 19)
  63. setPlayerStorageValue(cid, s, 0)
  64. BikeSpeedOff(cid)
  65. return doRemoveCondition(cid, CONDITION_OUTFIT)
  66. else
  67. return doPlayerSendCancel(cid, 'You can\'t do this.')
  68. end
  69. else
  70. return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.')
  71. end
  72. return true
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement