SA-MP Forums Archive
Snow - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Snow (/showthread.php?tid=199618)



Snow - Kitten - 16.12.2010

Код:
18863	SnowArc1
18864	FakeSnow1
Does any one of these make whole SA Snow or its just a snow object?


Re: Snow - [L3th4l] - 16.12.2010

pawn Код:
CMD:snow(playerid, params[])
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    return CreateObject(18863, X, Y, Z, 0.0, 0.0, 0.0);
}
Its just like a small area. I get huge lags with that object tho, don't know if Matite fixed them.


Re: Snow - Kitten - 16.12.2010

would this work though?

pawn Код:
SetTimer("Snow",1000,true);

stock Snow(playerid)
{
 new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    return CreateObject(18863, X, Y, Z, 0.0, 0.0, 0.0);
}



Re: Snow - Kwarde - 16.12.2010

Quote:
Originally Posted by Kitten
Посмотреть сообщение
would this work though?

pawn Код:
SetTimer("Snow",1000,true);

stock Snow(playerid)
{
 new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    return CreateObject(18863, X, Y, Z, 0.0, 0.0, 0.0);
}
Actually, it's not really good.
You now call an function "Snow()". But it is "Snow(playerid)". And with timers, you need an callback (I think. Stock didn't work for me).
So you need, an callback, SetTimerEx, and a forward. And btw. With this, it means it makes every second a new object! This will give:
* after 400 seconds with one player, you've reached the 400 objects limit.
-- And with 2 players you'll reach it in +- 200 seconds etc..
* Lagg. Such much snow, that will be probally a lagg. Because, every second there will be more!

And you can also check if the show already exists. If it not exists yet, create it. Otherwise, set the position. I'll give an example of the whole script:

pawn Код:
#include <a_samp>

new bool:SnowCreated[MAX_PLAYERS] = false;
new CreatedSnow[MAX_PLAYERS] = (-1);
new SnowTimer[MAX_PLAYERS] = (-1);

forward UpdateSnow(playerid);

public OnPlayerConnect(playerid)
{
    SnowCreated[playerid] = false;
    SnowTimer[playerid] = SetTimerEx("UpdateSnow", 1000, true, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    SnowCreated[playerid] = false;
    DestroyObject(CreatedSnow[playerid]);
    KillTimer(SnowTimer[playerid]);
    CreatedSnow[playerid] = (-1);
    SnowTimer[playerid] = (-1);
    return 1;
}

public UpdateSnow(playerid)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    if(!SnowCreated[playerid])
        CreatedSnow[playerid] = CreateObject(18863, pX, pY, pZ, 0.0, 0.0, 0.0);
    else
        SetObjectPos(CreatedSnow[playerid], pX, pY, pZ, 0.0, 0.0, 0.0);
    return 1;
}
You can also use MoveObject instead of SetObjectPos.


Re: Snow - [MWR]Blood - 16.12.2010

Quote:
Originally Posted by Kitten
Посмотреть сообщение
would this work though?

pawn Код:
SetTimer("Snow",1000,true);

stock Snow(playerid)
{
 new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    return CreateObject(18863, X, Y, Z, 0.0, 0.0, 0.0);
}
You need callbacks for timers.


Re: Snow - DVDK - 16.12.2010

Quote:
Originally Posted by Kitten
Посмотреть сообщение
would this work though?

pawn Код:
SetTimer("Snow",1000,true);

stock Snow(playerid)
{
 new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    return CreateObject(18863, X, Y, Z, 0.0, 0.0, 0.0);
}
Great! now after a while your object limit (400 max.) will be reached, then you also don't see it anymore because it cannot be created anymore, and you'll have a massive amount of lag!


Re: Snow - Souvlaki - 16.12.2010

Quote:
Originally Posted by DVDK
Посмотреть сообщение
Great! now after a while your object limit (400 max.) will be reached, then you also don't see it anymore because it cannot be created anymore, and you'll have a massive amount of lag!
You can always use a streamer..


Re: Snow - kurta999 - 16.12.2010

pawn Код:
AttachPlayerObjectToPlayer()
This function removed since 0.3a..


Re: Snow - DVDK - 16.12.2010

Quote:
Originally Posted by kurta999
Посмотреть сообщение
pawn Код:
AttachPlayerObjectToPlayer()
This function removed since 0.3a..
Uuhm no?


Re: Snow - The_Gangstas - 21.12.2010

Quote:
Originally Posted by DVDK
Посмотреть сообщение
Uuhm no?
it was removed. try it u'll get a error in your server.exe