Advertisement
Guest User

Sprunk Machines System By 4ir W4ys

a guest
Aug 20th, 2011
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. /*
  2. +----------+
  3. |**********| * * * * *** * * * * * ** ** ***
  4. |*******&&&| * * ** * * * * * * ** ** * _
  5. |@@*****&&@| ***** * * * * * * ***** *** *
  6. |*@@@***&&@| * * * ** ** * * ***
  7. |**@@***&@@|
  8. |*******@@@| 4ir W4ys's Sprunk Machine.
  9. |**********|
  10. |***%%%%***| Version: 1.1
  11. |**********| Features: *1* Creating a Spunk Machine in 1 Line. *2* 3D Text Supporting.
  12. +----------+ *3* Good For RolePlay Servers. *4* Anims Suppoting. *5* Controlled By the Defines.
  13. */
  14. #include <a_samp>
  15.  
  16. #define SprunkCMD "/drink" // Change it, To the Command you want, The player will need to Type near the Sprunk Machine.
  17. #define PlaceErrorMessage "Warning: You are not near Sprunk/Snack Machine" // Change It, To the Message you want the server show, If the PlayerIsn't near Sprunk Machine...
  18. #define ErColor 0xFFFFFFFF // Change it, To the Color You want the server will send With the Error Messages ( It's Currectly White )
  19. #define Cost 3 // Change it, To the Cost of a drink in the Sprunk Machine.
  20. #define GiveHP 20 // Change it, To the Health the playe Will get if He using Sprunk Machine
  21. #define CostErrorMessage "Warning: You don't Have Enough Money." // Chanhe it, To the Message That will show if the player Don't hav Enought Money
  22. #define SPRUNK_COUNT 10 // Chanhe it, To the Max Sprunk Machnies you create'd ;D
  23.  
  24. new SM[SPRUNK_COUNT];
  25.  
  26. public OnFilterScriptInit()
  27. {
  28. SM[0] = CreateSprunkMachine(149.2466,-1949.1434,3.7734,73.6045);
  29. SM[1] = CreateSprunkMachine(148.9184,-1953.8967,3.7734,145);
  30. return 1;
  31. }
  32.  
  33. public OnPlayerCommandText(playerid, cmdtext[])
  34. {
  35. if(strcmp(SprunkCMD, cmdtext, true) == 0)
  36. {
  37. if(!IsPlayerNearSprunkMachine(playerid)) return SendClientMessage(playerid, ErColor, PlaceErrorMessage);
  38. if(GetPlayerMoney(playerid) < Cost) return SendClientMessage(playerid, ErColor, CostErrorMessage);
  39. GivePlayerMoney(playerid, -Cost);
  40. new Float:H;
  41. GetPlayerHealth(playerid, H);
  42. SetPlayerHealth(playerid, H+GiveHP);
  43. ApplyAnimation(playerid, "VENDING", "VEND_Drink2_P", 0, 0, 0, 0, 0, 4);
  44. return 1;
  45. }
  46. return 0;
  47. }
  48.  
  49. stock CreateSprunkMachine(Float:X,Float:Y,Float:Z,Float:Angle)
  50. {
  51. CreateObject(955, Float:X, Float:Y, Float:Z-0.75, 0.0, 0.0, Float:Angle+180, 0.0);
  52. new Text[128];
  53. format(Text, sizeof(Text), "{FFFF00}Snack/Sprunk Machine.\nType %s to Use.", SprunkCMD);
  54. Create3DTextLabel(Text, 0xFFFF0000, Float:X, Float:Y, Float:Z, 40, 0, 0);
  55. return 1;
  56. }
  57.  
  58. stock IsPlayerNearSprunkMachine(playerid)
  59. {
  60. for(new i; i < SPRUNK_COUNT; i++) if(IsPlayerNearObject(playerid, SM[i], 2.0)) return i;
  61. return -1;
  62. }
  63.  
  64. stock IsPlayerNearObject(playerid, objectid, Float:range)
  65. {
  66. new Float:X, Float:Y, Float:Z;
  67. GetObjectPos(objectid, X, Y, Z);
  68. if(IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)) return false;
  69. return true;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement