[Tutorial] Falling Snow!
#1

Hello Guys!!

You can use this snow script in your gamemode for free!

Just put this script in "OnPlayerConnect" callback and it will work fine!
Code:
	
for(new x = 0; x < 61; x++)
for(new y = 0; y < 61; y++)
CreateDynamicObject(18864,-3000.0+x*100.0,-3000+y*100,0.0,0.0,0.0,0.0);
Thank you and happy new year!
Reply
#2

You forgot to mention that you need incognito's streamer plugin for this to work.
Also, you are creating falling snow for every player based on his own coordinates.
What happens when 30 players are in the same area? Did you think of that?
Reply
#3

pic ?
Reply
#4

Really bad idea to do that.
Reply
#5

To be honest this is a bad idea and your FPS(Frames per second) will decrease. There's another way you could create a falling snow by using the sa-mp function called GetPlayerCameraPos + you don't need to use loop

GetPlayerCameraPos
Quote:
Originally Posted by SA-MP Wikipedia
Players' camera positions are only updated once a second, unless aiming.
It is recommended to set a 1 second timer if you wish to take action that relies on a player's camera position.
Example Code
pawn Code:
#include <a_samp>

public OnPlayerSpawn(playerid)
{
    return SnowSettings(playerid, true);
}

SnowSettings(playerid, bool:on = true)
{
    new
        FallingSnowObject
    ;
    if(on)
    {
        new Float:Position[3];
        GetPlayerCameraPos( playerid, Position[0], Position[1], Position[2] /*-----------------------------------------------*/);
        FallingSnowObject = CreatePlayerObject( playerid, 18864, Position[0], Position[1], Position[2]-5, 0.0, 0.0, 0.0, 300.0 );
        SendClientMessage(playerid, -1, "[DEBUG] - SnowSettings - Enabled");
    }
    else if(!on)
    {
        DestroyPlayerObject( playerid, FallingSnowObject);
        SendClientMessage(playerid, -1, "[DEBUG] - SnowSettings - disabled");
    }
    return true;  
}
Compilation compiled with -d3
Code:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:            256 bytes
Code size:              664 bytes
Data size:                0 bytes
Stack/heap size:      16384 bytes; estimated max. usage=29 cells (116 bytes)
Total requirements:   17304 bytes
[Finished in 0.1s]
Reply
#6

can u add PIC?
Reply
#7

Quote:
Originally Posted by Stgnature
View Post
can u add PIC?
Here You go, I used the code I made (Above Your Post)

Reply
#8

Quote:
Originally Posted by pds2k12
View Post
To be honest this is a bad idea and your FPS(Frames per second) will decrease. There's another way you could create a falling snow by using the sa-mp function called GetPlayerCameraPos + you don't need to use loop

GetPlayerCameraPos


Example Code
pawn Code:
#include <a_samp>

public OnPlayerSpawn(playerid)
{
    return SnowSettings(playerid, true);
}

SnowSettings(playerid, bool:on = true)
{
    new
        FallingSnowObject
    ;
    if(on)
    {
        new Float:Position[3];
        GetPlayerCameraPos( playerid, Position[0], Position[1], Position[2] /*-----------------------------------------------*/);
        FallingSnowObject = CreatePlayerObject( playerid, 18864, Position[0], Position[1], Position[2]-5, 0.0, 0.0, 0.0, 300.0 );
        SendClientMessage(playerid, -1, "[DEBUG] - SnowSettings - Enabled");
    }
    else if(!on)
    {
        DestroyPlayerObject( playerid, FallingSnowObject);
        SendClientMessage(playerid, -1, "[DEBUG] - SnowSettings - disabled");
    }
    return true;  
}
Compilation compiled with -d3
Code:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:            256 bytes
Code size:              664 bytes
Data size:                0 bytes
Stack/heap size:      16384 bytes; estimated max. usage=29 cells (116 bytes)
Total requirements:   17304 bytes
[Finished in 0.1s]
this one is fine, the topic's one could cause lag, bad idea.
nice job anyways..
Reply
#9

The object's position should also depend on the player's camera position. Because it's basically composed of multiple layers of falling snow. You can look from a certain side and see the space between those layers.
Also, to prevent the FPS drop, the snow should be created for each specific player. Meaning the players should not see the falling snow created for other players.
Reply
#10

Nice One Dude Pds2k12 its Nice without Lagg Can you tell how i can Make Snow On Ground !!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)