#4

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.
Reply


Messages In This Thread
Snow - by Kitten - 16.12.2010, 02:40
Re: Snow - by [L3th4l] - 16.12.2010, 02:55
Re: Snow - by Kitten - 16.12.2010, 02:59
Re: Snow - by Kwarde - 16.12.2010, 04:53
Re: Snow - by [MWR]Blood - 16.12.2010, 07:17
Re: Snow - by DVDK - 16.12.2010, 07:51
Re: Snow - by Souvlaki - 16.12.2010, 08:00
Re: Snow - by kurta999 - 16.12.2010, 19:13
Re: Snow - by DVDK - 16.12.2010, 19:14
Re: Snow - by The_Gangstas - 21.12.2010, 18:28

Forum Jump:


Users browsing this thread: 1 Guest(s)