[FilterScript] [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas
#29

This is an edit from chaosnz. Basically, it creates explosions when the "snow" hits the ground. May be useful for other means, such as dm servers. Good going



Quote:
Originally Posted by chaosnz
Quote:

/************************************************** *****************************

Snow filterscript to simulate falling snow effects for SA:MP
SA:MP 0.3


Author: James "Jay" Wilkinson


irc.gtanet.com #Jay
irc.gtanet.com #ww3
irc.sa-mp.com #ww3


Copyright © Jay 2009

************************************************** *****************************/
#include <a_samp>



#define SNOW_OBJECT 354

#define SLOTS 200 // aka MAX_PLAYERS

#define MAX_SNOW 20


static snowObject[SLOTS][MAX_SNOW+1];
static snowActive[SLOTS];




public OnFilterScriptExit()
{
for(new i = 0; i < SLOTS; i++)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i))
continue;

DestroySnow(i);
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
if(!IsPlayerNPC(playerid))
DestroySnow(playerid);
}

public OnPlayerSpawn(playerid)
{
CreateSnow(playerid);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/bombs"))
{
for(new i=0; i <= MAX_PLAYERS; i++)
{
if(!snowActive[playerid])
{
CreateSnow(i);
SendClientMessage(i, 0xFFFFFFFF, "DANGER BOMBS ARE FALLING!");
}else{
DestroySnow(i);
SendClientMessage(i, 0xFFFFFFFF, "Bombs have been removed.");
}
}
return 1;
}
return 0;
}


stock CreateSnow(playerid)
{
if(GetPlayerState(playerid) == 0 || GetPlayerState(playerid) > 6)
return;

if(GetPlayerInterior(playerid) != 0)
return;

if(snowActive[playerid] == 1)
return;

snowActive[playerid] = 1;

new
Float,
Float:y,
Float:z;

GetPlayerPos(playerid, x, y, z);

for(new i = 0; i < MAX_SNOW; i++)
{
snowObject[playerid][i] = CreatePlayerObject(playerid, SNOW_OBJECT, x, y , z , 0, 0, 0);
RecreateSnow(playerid, snowObject[playerid][i]);
}
}



stock DestroySnow(playerid)
{
snowActive[playerid] = 0;

for(new i = 0; i < MAX_SNOW; i++)
{
DestroyPlayerObject(playerid, snowObject[playerid][i]);
}
}

stock RecreateSnow(playerid, objectid)
{
if(snowActive[playerid] == 0)
return;


new
Float,
Float:y,
Float:z,
FloatbjX,
FloatbjY,
FloatbjZ;

GetPlayerPos(playerid, x, y, z);

// And before you ask, I use random twice because SA:MP's random sucks ass
new i = random(random(100));

if(i < 20)
{
SetPlayerObjectPos(playerid, objectid, x - random(random(2400)), y + random (random(2400)), z + random(70)+30);
}
else if(i >= 21 && i <= 30)
{
SetPlayerObjectPos(playerid, objectid, x + random(random(2400)), y + random (random(2400)), z + random(60)+40);
}
else if (i >= 31 && i < 40)
{
SetPlayerObjectPos(playerid, objectid, x + random(random(2400)), y - random (random(2400)), z + random(50)+50);
}
else
{
SetPlayerObjectPos(playerid, objectid, x + random(random(2400)), y + random (random(2400)), z + random(40)+60);
}

GetPlayerObjectPos(playerid, objectid, objX, objY, objZ);

MovePlayerObject(playerid, objectid, objX, objY, z, random(0.2)+0.4);


}

public OnPlayerObjectMoved(playerid, objectid)
{
new
Float,
Float:y,
Float:z,
FloatbjX,
FloatbjY,
FloatbjZ;
if(snowActive[playerid] == 0)
return 1;

for(new i = 0; i < MAX_SNOW; i++)
{
if(objectid == snowObject[playerid][i])
{
GetPlayerPos(playerid, x, y, z);
GetPlayerObjectPos(playerid, objectid, objX, objY, objZ);
CreateExplosion(objX,objY,z,6,0.5);
RecreateSnow(playerid, objectid);
return 1;
}
}
return 1;
}

Reply


Messages In This Thread
[FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Jay_ - 01.12.2009, 01:13
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by lolumadd - 01.12.2009, 01:57
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by BP13 - 01.12.2009, 02:42
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by [SW]thekillaer - 01.12.2009, 02:58
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Virtual_Pancake - 01.12.2009, 03:13
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Deat_Itself - 01.12.2009, 04:39
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Jay_ - 01.12.2009, 10:49
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Karlip - 01.12.2009, 12:54
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by XRVX - 01.12.2009, 13:09
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Jese - 01.12.2009, 13:11
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by [03]Garsino - 01.12.2009, 13:12
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Fj0rtizFredde - 01.12.2009, 14:11
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by ImRico - 01.12.2009, 14:23
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Striker_Moe - 01.12.2009, 18:59
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by _Gangster_ - 01.12.2009, 19:30
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by westre - 01.12.2009, 22:02
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Rac3r - 02.12.2009, 13:59
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by [SU][FB]Skyline - 02.12.2009, 21:28
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Haji - 02.12.2009, 21:43
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Guedes747 - 02.12.2009, 21:58
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Grim_ - 02.12.2009, 22:29
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Backwardsman97 - 03.12.2009, 01:39
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by BP13 - 03.12.2009, 02:16
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by HydraX - 03.12.2009, 03:30
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by [03]Garsino - 03.12.2009, 06:46
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Cedimedi - 03.12.2009, 10:35
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by [03]Garsino - 03.12.2009, 13:08
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Larry. - 03.12.2009, 13:42
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Jay_ - 03.12.2009, 23:08
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by HydraX - 03.12.2009, 23:47
Respuesta: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Mr.GeEk - 28.10.2014, 14:47
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by VeggieBoy - 28.10.2014, 20:00
Re: [FS] Snow in SA:MP! 0.3 Compatiable - Good for christmas - by Private200 - 28.10.2014, 20:37

Forum Jump:


Users browsing this thread: 3 Guest(s)