ProDude

Snow System

Mar 22nd, 2016
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. //-_-_-_-_-_-_-_-_-_-_-_-_This is my sixth release!!-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  2. //-_-_-_-_-_-_-_-_-_-_-_-_-_- {Indian Keval} _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  3. //-_-_-_-_-_-_-_-_-_-_-_-_- Nick : {ProDude}-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  4. //-_-_-_-_-_-_-_-_-_-_-_-Mail ID : kevalbro@outlook.com-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  5. //-_-_-_-_-_-_-_-_-_-_-_-_-_-Dont Take Credits :@-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  6.  
  7.  
  8. #include <a_samp>
  9. #include <streamer>
  10. #include <zcmd>
  11.  
  12.  
  13. #define COLOR_LIGHTRED 0xFF6347AA
  14. #define COLOR_WHITE 0xFFFFFFAA
  15. #define COLOR_LIGHTBLUE 0x00BFFFAA
  16.  
  17. #undef MAX_PLAYERS
  18. #define MAX_SLOTS 200
  19.  
  20. #define MAX_SNOW_OBJECTS 20
  21. #define UPDATE_INTERVAL 750
  22.  
  23. #if MAX_SLOTS == -1
  24. #error Change MAX_SLOTS to the max players of your server! (At line 6)
  25. #endif
  26.  
  27. #define ploop(%0) for(new %0 = 0; %0 < MAX_SLOTS; %0++) if(IsPlayerConnected(%0))
  28. #define CB:%0(%1) forward %0(%1); public %0(%1)
  29.  
  30. new bool:snowOn[MAX_SLOTS char],
  31. snowObject[MAX_SLOTS][MAX_SNOW_OBJECTS],
  32. updateTimer[MAX_SLOTS char]
  33. ;
  34.  
  35. public OnFilterScriptExit()
  36. {
  37. ploop(i)
  38. {
  39. if(snowOn{i})
  40. {
  41. for(new j = 0; j < MAX_SNOW_OBJECTS; j++) DestroyDynamicObject(snowObject[i][j]);
  42. KillTimer(updateTimer{i});
  43. }
  44. }
  45. return 1;
  46. }
  47. public OnPlayerDisconnect(playerid)
  48. {
  49. if(snowOn{playerid})
  50. {
  51. for(new i = 0; i < MAX_SNOW_OBJECTS; i++) DestroyDynamicObject(snowObject[playerid][i]);
  52. snowOn{playerid} = false;
  53. KillTimer(updateTimer{playerid});
  54. }
  55. return 1;
  56. }
  57.  
  58. CB:UpdateSnow(playerid)
  59. {
  60. if(!snowOn{playerid}) return 0;
  61. new Float:pPos[3];
  62. GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
  63. for(new i = 0; i < MAX_SNOW_OBJECTS; i++) SetDynamicObjectPos(snowObject[playerid][i], pPos[0] + random(25), pPos[1] + random(25), pPos[2] - 5);
  64. return 1;
  65. }
  66.  
  67. stock CreateSnow(playerid)
  68. {
  69. if(snowOn{playerid}) return 0;
  70. new Float:pPos[3];
  71. GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
  72. for(new i = 0; i < MAX_SNOW_OBJECTS; i++) snowObject[playerid][i] = CreateDynamicObject(18864, pPos[0] + random(25), pPos[1] + random (25), pPos[2] - 5, random(100), random(100), random(100), -1, -1, playerid);
  73. snowOn{playerid} = true;
  74. updateTimer{playerid} = SetTimerEx("UpdateSnow", UPDATE_INTERVAL, true, "i", playerid);
  75. return 1;
  76. }
  77.  
  78. stock DeleteSnow(playerid)
  79. {
  80. if(!snowOn{playerid}) return 0;
  81. for(new i = 0; i < MAX_SNOW_OBJECTS; i++) DestroyDynamicObject(snowObject[playerid][i]);
  82. KillTimer(updateTimer{playerid});
  83. snowOn{playerid} = false;
  84. return 1;
  85. }
  86.  
  87. CMD:snow(playerid, params[])
  88. {
  89. if(snowOn{playerid})
  90. {
  91. DeleteSnow(playerid);
  92. SendClientMessage(playerid, 0xFF6347AA, "* Pak Reality Roleplay Gaming Info."); // Your Server Name
  93. SendClientMessage(playerid, 0x00FF00AA, "* ____----Snow Is De-Activated----____.");
  94. SendClientMessage(playerid, 0xFF6347AA, "* Pak Reality Roleplay Gaming Info."); }
  95. else
  96. {
  97. CreateSnow(playerid);
  98. SendClientMessage(playerid, 0xFF6347AA, "* Pak Reality Roleplay Gaming Info."); // Your Server Name
  99. SendClientMessage(playerid, 0x00FF00AA, "* ____----Snow Is Activated----____.");
  100. SendClientMessage(playerid, 0xFF6347AA, "* Pak Reality Roleplay Gaming Info.");
  101. }
  102. return 1;
  103. }
  104.  
  105. CMD:allsnowon(playerid, params[])
  106. {
  107. new String[128];
  108. new St[118];
  109. if(!IsPlayerAdmin(playerid)) return 0;
  110. ploop(i) //This is included in my FS! It's the '#define ploop(%0)' thing.
  111. {
  112. if(snowOn{i}) continue;
  113. CreateSnow(i);
  114. format(St, 118, "ServerCMD : Pak Reality Roleplay Gaming Weather Info ."); // Your Server Name
  115. SendClientMessageToAll(COLOR_LIGHTRED, St);
  116. format(String, 128, "ServerCMD : ------Guys , Enjoy The Snow Season------ .");
  117. SendClientMessageToAll(COLOR_LIGHTBLUE, String);
  118. }
  119. return 1;
  120. }
  121.  
  122. CMD:allsnowoff(playerid, params[])
  123. {
  124. new String[138];
  125. new Str[148];
  126. if(!IsPlayerAdmin(playerid)) return 0;
  127. ploop(i)
  128. {
  129. if(!snowOn{i}) continue;
  130. DeleteSnow(i);
  131. format(Str, 148, "ServerCMD : Pak Reality Roleplay Gaming Weather Info ."); // Your Server Name
  132. SendClientMessageToAll(COLOR_LIGHTRED, Str);
  133. format(String, 138, "ServerCMD : ----Guys , Snow Season Is Gonna End---- .");
  134. SendClientMessageToAll(COLOR_LIGHTBLUE, String);
  135. }
  136. return 1;
  137. }
Add Comment
Please, Sign In to add comment