Advertisement
Guest User

Untitled

a guest
Dec 14th, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #if defined _we_snowfalling_included
  2. #endinput
  3. #endif
  4.  
  5. #define _we_snowfalling_included
  6. #pragma library we_snowfalling
  7.  
  8. /**
  9. * Variables
  10. */
  11. static
  12. __g_snowObject[MAX_PLAYERS],
  13. __g_snowFallingTimer[MAX_PLAYERS],
  14.  
  15. bool: __g_snowObjectCreated[MAX_PLAYERS],
  16. bool: __g_snowFallingStatus[MAX_PLAYERS];
  17.  
  18. /**
  19. * Callbacks
  20. */
  21. forward __Winter_SnowFallingTimer(const playerid);
  22. public __Winter_SnowFallingTimer(const playerid)
  23. {
  24. if (Winter_GetSnowflakeStatus(playerid))
  25. {
  26. if (!GetPlayerInterior(playerid) && !GetPlayerVirtualWorld(playerid))
  27. {
  28. static x, y, z;
  29. GetPlayerCameraPos(playerid, Float: x, Float: y, Float:z);
  30.  
  31. MovePlayerObject(playerid, __g_snowObject[playerid],
  32. Float: x, Float: y, (Float:z - 2.5), Float: 4000.0
  33. );
  34. }
  35. }
  36.  
  37. return 1;
  38. }
  39.  
  40. /**
  41. * Functions
  42. */
  43. stock Winter_GetSnowflakeStatus(const playerid) return __g_snowFallingStatus[playerid];
  44. stock Winter_SetSnowflakeStatus(const playerid, bool: status = true)
  45. {
  46. if(status == false)
  47. {
  48. __g_snowFallingStatus[playerid] = false;
  49. DestroyPlayerObject(playerid, __g_snowObject[playerid]);
  50. KillTimer(__g_snowFallingTimer[playerid]);
  51. return 1;
  52. }
  53.  
  54. if (__g_snowObjectCreated[playerid])
  55. {
  56. return 0;
  57. }
  58.  
  59. static x, y, z;
  60. GetPlayerCameraPos(playerid, Float: x, Float: z, Float: z);
  61.  
  62. __g_snowObject[playerid] = CreatePlayerObject(playerid, 18864,
  63. (Float: x + random(25)), (Float: y + random(25)), (Float: z - 5), 0.0, 0.0, 0.0, 300.0
  64. );
  65.  
  66. __g_snowFallingTimer[playerid] = SetTimerEx("__Winter_SnowFallingTimer", 500, 1, "d", playerid);
  67. __g_snowFallingStatus[playerid] = true;
  68.  
  69. return 1;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement