Advertisement
Guest User

Pixels

a guest
Jan 18th, 2009
5,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.28 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define sHeightStart 50
  4. #define sModel 354
  5.  
  6. forward SnowTimer();
  7. forward SnowOn();
  8. forward SnowOff();
  9. forward ToggleBlizzard(onoff);
  10. forward SetSnowColor(color);
  11. forward SetSnowStartHeight(height);
  12.  
  13. new Spawned[MAX_PLAYERS];
  14. new SnowTrack;
  15. new Blizzard;
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.     print("\n--------------------------------------");
  20.     print(" [FS] Falling Snow by Pixels^");
  21.     print("--------------------------------------\n");
  22.     SnowTrack = SetTimer("SnowTimer",4000,1);
  23.     return 1;
  24. }
  25.  
  26. public OnFilterScriptExit()
  27. {
  28.     KillTimer(SnowTrack);
  29.     return 1;
  30. }
  31.  
  32. public OnPlayerConnect(playerid)
  33. {
  34.     for(new o=0; o<60; o++) CreatePlayerObject(playerid,sModel,0,0,0,0,0,0);
  35.     Spawned[playerid] = 0;
  36.     ToggleBlizzard(1);
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerSpawn(playerid)
  41. {
  42.     Spawned[playerid] = 1;
  43.     return 1;
  44. }
  45.  
  46. public OnPlayerDeath(playerid, killerid, reason)
  47. {
  48.     Spawned[playerid] = 0;
  49.     return 1;
  50. }
  51.  
  52. public SnowTimer()
  53. {
  54.     SetWorldTime(1);
  55.     for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i) && Spawned[i] == 1)
  56.     {
  57.         new Float:Pos[3],Float:pObjectPos[3];
  58.         GetPlayerPos(i,Pos[0],Pos[1],Pos[2]);
  59.         for(new b=0; b<60; b++)
  60.         {
  61.             if(Blizzard == 0)
  62.             {
  63.                 if(b<=20)
  64.                     SetPlayerObjectPos(i,b,Pos[0]-random(100),Pos[1]+random(70),Pos[2]+sHeightStart+random(10));
  65.                 if(b>=21 && b<= 30)
  66.                     SetPlayerObjectPos(i,b,Pos[0]+random(100),Pos[1]+random(70),Pos[2]+sHeightStart+random(10));
  67.                 if(b>=31 && b<= 40)
  68.                     SetPlayerObjectPos(i,b,Pos[0]+random(70),Pos[1]-random(100),Pos[2]+sHeightStart+random(10));
  69.                 if(b>=41 && b<= 60)
  70.                     SetPlayerObjectPos(i,b,Pos[0]+random(70),Pos[1]+random(100),Pos[2]+sHeightStart+random(10));
  71.                 GetPlayerObjectPos(i,b,pObjectPos[0],pObjectPos[1],pObjectPos[2]);
  72.                 MovePlayerObject(i,b,pObjectPos[0],pObjectPos[1],Pos[2]-7,16);
  73.             }
  74.             else
  75.             {
  76.                 if(b<=20)
  77.                     SetPlayerObjectPos(i,b,Pos[0]-random(100),Pos[1]+random(70),Pos[2]+sHeightStart+random(10));
  78.                 if(b>=21 && b<= 30)
  79.                     SetPlayerObjectPos(i,b,Pos[0]+random(100),Pos[1]+random(70),Pos[2]+sHeightStart+random(10));
  80.                 if(b>=31 && b<= 40)
  81.                     SetPlayerObjectPos(i,b,Pos[0]+random(70),Pos[1]-random(100),Pos[2]+sHeightStart+random(10));
  82.                 if(b>=41 && b<= 60)
  83.                     SetPlayerObjectPos(i,b,Pos[0]+random(70),Pos[1]+random(100),Pos[2]+sHeightStart+random(10));
  84.                 GetPlayerObjectPos(i,b,pObjectPos[0],pObjectPos[1],pObjectPos[2]);
  85.                 MovePlayerObject(i,b,pObjectPos[0],pObjectPos[1],Pos[2]-7,56);
  86.             }
  87.         }
  88.     }
  89.     return 1;
  90. }
  91.  
  92. public SnowOff()
  93.     KillTimer(SnowTrack);
  94.    
  95. public SnowOn()
  96.     SnowTrack = SetTimer("SnowTimer",4000,1);
  97.  
  98. public ToggleBlizzard(onoff)
  99. {
  100.     KillTimer(SnowTrack);
  101.     if(onoff == 0) SnowTrack = SetTimer("SnowTimer",4000,1);
  102.     else SnowTrack = SetTimer("SnowTimer",1300,1);
  103.     Blizzard = onoff;
  104. }
  105.  
  106. public SetSnowStartHeight(height)
  107. {
  108.     #undef sHeightStart
  109.     #define sHeightStart height
  110. }
  111.  
  112. public SetSnowColor(color)
  113. {
  114.     new model,b;
  115.     switch(color)
  116.     {
  117.         case 1: model = 1213;
  118.         case 2: model = 354;
  119.     }
  120.     if(sModel == model) return -1;
  121.     #undef sModel
  122.     #define sModel model
  123.     for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i))
  124.     {
  125.         for(b=0; b<60; b++)
  126.         {
  127.             DestroyPlayerObject(i,b);
  128.             CreatePlayerObject(i,sModel,0,0,0,0,0,0);
  129.         }
  130.     }
  131.     return 1;
  132. }
  133.  
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement