Off Topic > PAWN Scripting
Firework system
(1/1)
Life:
Hello today i will be giving you a firework system.
#include <a_samp>
#include <zcmd>
#define COLOR_RED 0xFF0000FF
#define COLOR_GREEN 0x00FF00FF
#define EXPLOSION_FIREWORK 18
// Command to create a fireworks show in the player's location
CMD:fireworks(playerid)
{
// Get the player's position
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
// Create fireworks
for(new i = 0; i < 50; i++)
{
new fx = CreateExplosion(x + random(-10, 10), y + random(-10, 10), z + random(5, 50), EXPLOSION_FIREWORK, 0.0);
SetTimerEx("DestroyFirework", 2000, false, "i", i);
}
// Send message to player
SendClientMessage(playerid, COLOR_GREEN, "You have created a fireworks show in your location!");
return 1;
}
// Function to destroy a firework after it explodes
public DestroyFirework(i)
{
DestroyObject(i);
return 1;
}
// Register the command with zcmd
public OnGameModeInit()
{
RegisterZcmd("fireworks", "Create a fireworks show at your location.", ACCESS_PLAYER);
return 1;
}
Navigation
[0] Message Index
Go to full version