23.12.2013, 18:30
(
Last edited by Pottus; 23/12/2013 at 08:23 PM.
)
This thread is dedicated to joke filterscripts
Please feel free to post any silly scripts you might come up with.
Keep in mind a few things when creating scripts, only standard libraries and includes should be used that way anyone trying to compile can easily get anything they might need.
Here are some links to what I consider standard stuff and should be in any scripters toolbox.
YSI - http://ysi.tl/
ZCMD - https://sampforum.blast.hk/showthread.php?tid=91354
SQLite Improved - https://sampforum.blast.hk/showthread.php?tid=303682
Strlib - https://sampforum.blast.hk/showthread.php?tid=362764
sscanf2 plugin - https://sampforum.blast.hk/showthread.php?tid=120356
Streamer plugin - https://sampforum.blast.hk/showthread.php?tid=102865
RNPC - https://sampforum.blast.hk/showthread.php?tid=355849
FCNPC - https://sampforum.blast.hk/showthread.php?tid=428066 (Keep in mind this still has problems with Linux version, possibility of becoming unusable in the future)
In the spirit of Christmas I present the cheesy snow effect! Flashy and consuming over 250kb/sec bandwidth per second what a joke!
Please feel free to post any silly scripts you might come up with.
Keep in mind a few things when creating scripts, only standard libraries and includes should be used that way anyone trying to compile can easily get anything they might need.
Here are some links to what I consider standard stuff and should be in any scripters toolbox.
YSI - http://ysi.tl/
ZCMD - https://sampforum.blast.hk/showthread.php?tid=91354
SQLite Improved - https://sampforum.blast.hk/showthread.php?tid=303682
Strlib - https://sampforum.blast.hk/showthread.php?tid=362764
sscanf2 plugin - https://sampforum.blast.hk/showthread.php?tid=120356
Streamer plugin - https://sampforum.blast.hk/showthread.php?tid=102865
RNPC - https://sampforum.blast.hk/showthread.php?tid=355849
FCNPC - https://sampforum.blast.hk/showthread.php?tid=428066 (Keep in mind this still has problems with Linux version, possibility of becoming unusable in the future)
In the spirit of Christmas I present the cheesy snow effect! Flashy and consuming over 250kb/sec bandwidth per second what a joke!
pawn Code:
// Cheesy snow effect
#include <a_samp>
#include <zcmd>
#define MAX_SNOW_FLAKES 100 //snow on screen
#define X_SIZE 640
#define Y_SIZE 480
#define SNOW_SPEED 30
new Text:SnowFlakes[MAX_SNOW_FLAKES];
new bool:SnowOn[MAX_PLAYERS];
enum FLAKEINFO
{
Float:FallSpeed,
Float:x,
Float:y,
}
new FlakeData[MAX_SNOW_FLAKES][FLAKEINFO];
public OnFilterScriptInit()
{
//randomize starting points for snowflakes
for(new i = 0; i < MAX_SNOW_FLAKES; i++)
{
FlakeData[i][x] = float(random(X_SIZE));
FlakeData[i][y] = float(random(Y_SIZE));
}
// Pre-create so we don't need to check if the textdraw has actually been created since it would only happen once
for(new i = 0; i < MAX_SNOW_FLAKES; i++)
{
SnowFlakes[i] = TextDrawCreate(FlakeData[i][x], 0.000000, ".");
FlakeData[i][FallSpeed] = floatdiv(random(250), 100) + 0.5;
}
// Start snowflake update timer
SetTimer("SnowLoop", SNOW_SPEED, true);
return 1;
}
// Make Sure we delete all snowflakes
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_SNOW_FLAKES; i++)
{
TextDrawDestroy(SnowFlakes[i]);
}
return 1;
}
// Snow is off by default
public OnPlayerConnect(playerid)
{
SnowOn[playerid] = false;
return 1;
}
// Toggle snow on/off
CMD:snow(playerid, arg[])
{
if(SnowOn[playerid])
{
SnowOn[playerid] = false;
SendClientMessage(playerid, -1, "Snow Off");
}
else
{
SnowOn[playerid] = true;
SendClientMessage(playerid, -1, "Snow On");
}
return 1;
}
// Update Snowflake positions and show to players
forward SnowLoop();
public SnowLoop()
{
for(new i = 0; i < MAX_SNOW_FLAKES; i++)
{
FlakeData[i][y] += FlakeData[i][FallSpeed];
if(FlakeData[i][y] >= Y_SIZE)
{
FlakeData[i][y] = 0.0;
FlakeData[i][FallSpeed] = floatdiv(random(250), 100) + 0.5;
}
TextDrawDestroy(SnowFlakes[i]);
DrawFlake(i, FlakeData[i][x], FlakeData[i][y]);
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(SnowOn[i])
{
for(new j = 0; j < MAX_SNOW_FLAKES; j++)
{
TextDrawShowForPlayer(i, SnowFlakes[j]);
}
}
}
}
// Draw a snowflake
stock DrawFlake(index, Float:sx, Float:sy)
{
SnowFlakes[index] = TextDrawCreate(sx, sy, ".");
TextDrawBackgroundColor(SnowFlakes[index], 255);
TextDrawFont(SnowFlakes[index], 1);
TextDrawLetterSize(SnowFlakes[index], 0.900000, 3.500000);
TextDrawColor(SnowFlakes[index], -1);
TextDrawSetOutline(SnowFlakes[index], 0);
TextDrawSetProportional(SnowFlakes[index], 1);
TextDrawSetShadow(SnowFlakes[index], 0);
TextDrawSetSelectable(SnowFlakes[index], 0);
}