16.12.2010, 04:53
Quote:
would this work though?
pawn Код:
|
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;
}