Issuse with errors with firework
#1

D:\New folder\gamemodes\FW.pwn(19) : error 017: undefined symbol "Rocket"
D:\New folder\gamemodes\FW.pwn(19) : warning 215: expression has no effect
D:\New folder\gamemodes\FW.pwn(19) : error 001: expected token: ";", but found "]"
D:\New folder\gamemodes\FW.pwn(19) : error 029: invalid expression, assumed zero
D:\New folder\gamemodes\FW.pwn(19) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Код:
	    DestroyDynamicObject(Rocket[playerid]);
Reply
#2

Could you show the whole code please
Reply
#3

Try this:

Код:
#include <a_samp>
#include <streamer>

// Firework System
#define RocketHeight 50
#define TYPE_COUNTDOWN 2000
#define TYPE_LAUNCH 2001
#define TYPE_EXPLODE 2002
#define MAX_FIREWORKS 100
#define FireworkSpread 30

new Rocket[MAX_PLAYERS];
new RocketLight[MAX_PLAYERS];
new RocketSmoke[MAX_PLAYERS];



forward Firework(playerid, type);
public Firework(playerid, type)
{
	if(!IsPlayerConnected(playerid))
	{
	    DestroyDynamicObject(Rocket[playerid]);
	    DestroyDynamicObject(RocketLight[playerid]);
	    DestroyDynamicObject(RocketSmoke[playerid]);
	    return 1;
	}
    new Float:x, Float:y, Float:z;
    x = GetPVarFloat(playerid, "fxpos");
    y = GetPVarFloat(playerid, "fypos");
    z = GetPVarFloat(playerid, "fzpos");
    if (type == TYPE_COUNTDOWN)
    {
        new string[128];
		format(string, sizeof(string), "STAND BACK! 5 seconds till launch!", GetPlayerNameEx(playerid));
	    ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
	    SetTimerEx("Firework", 5000, 0, "ii", playerid, TYPE_LAUNCH);
    }
	else if(type == TYPE_LAUNCH)
	{
	    CreateExplosion(x ,y, z, 12, 5);
		new time = MoveDynamicObject(Rocket[playerid], x, y, z + RocketHeight, 10);
		MoveDynamicObject(RocketLight[playerid], x, y, z + 2 + RocketHeight, 10);
		MoveDynamicObject(RocketSmoke[playerid], x, y, z + RocketHeight, 10);
		SetTimerEx("Firework", time, 0, "ii", playerid, TYPE_EXPLODE);
	}
	else if(type == TYPE_EXPLODE)
	{
	    z += RocketHeight;
	    if (RocketExplosions[playerid] == 0)
		{
		    DestroyDynamicObject(Rocket[playerid]);
		    DestroyDynamicObject(RocketLight[playerid]);
		    DestroyDynamicObject(RocketSmoke[playerid]);
		    CreateExplosion(x ,y, z, 4, 10);
		    CreateExplosion(x ,y, z, 5, 10);
		    CreateExplosion(x ,y, z, 6, 10);
		}
		else if (RocketExplosions[playerid] >= MAX_FIREWORKS)
		{
		    for (new i = 0; i <= FireworkSpread; i++)
		    {
		    	CreateExplosion(x + float(i - (FireworkSpread / 2)), y, z, 7, 10);
		    	CreateExplosion(x, y + float(i - (FireworkSpread / 2)), z, 7, 10);
		    	CreateExplosion(x, y, z + float(i - (FireworkSpread / 2)), 7, 10);
		    }
		    RocketExplosions[playerid] = -1;
		    return 1;
		}
		else
		{
			x += float(random(FireworkSpread) - (FireworkSpread / 2));
			y += float(random(FireworkSpread) - (FireworkSpread / 2));
			z += float(random(FireworkSpread) - (FireworkSpread / 2));
		    CreateExplosion(x, y, z, 7, 10);
		}
		RocketExplosions[playerid]++;
  		SetTimerEx("Firework", 250, 0, "ii", playerid, TYPE_EXPLODE);
	}
	return 1;
}



CMD:placefirework(playerid, params[])
{
	if(GetPVarInt(playerid, "IsInArena") >= 0)
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
		return 1;
	}
	if(WatchingTV[playerid] != 0) {
        SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
        return 1;
    }
	if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
		return 1;
	}
	if(RocketExplosions[playerid] != -1)
	{
	    SendClientMessageEx(playerid, COLOR_WHITE, "You are already using another firework!");
		return 1;
	}
	if (PlayerInfo[playerid][pVW] != 0 || PlayerInfo[playerid][pInt] != 0)
	{
	    SendClientMessageEx(playerid, COLOR_WHITE, "You can't launch fireworks indoors!");
		return 1;
	}
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new string[128];
		format(string, sizeof(string), "%s has placed a firework which will go off in 30 seconds!", GetPlayerNameEx(playerid));
	    ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
	    new Float:x, Float:y, Float:z, Float:a;
	    GetPlayerPos(playerid, x, y, z);
	    GetPlayerFacingAngle(playerid, a);
	    ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
	    x += (2 * floatsin(-a, degrees));
    	y += (2 * floatcos(-a, degrees));
	    Rocket[playerid] = CreateDynamicObject(3786, x, y, z, 0, 90, 0);
	    RocketLight[playerid] = CreateDynamicObject(354, x, y, z + 1, 0, 0, 0);
		RocketSmoke[playerid] = CreateDynamicObject(18716, x, y, z - 4, 0, 0, 0);
	    SetPVarFloat(playerid,"fxpos",x);
  		SetPVarFloat(playerid,"fypos",y);
  		SetPVarFloat(playerid,"fzpos",z);
  		RocketExplosions[playerid] = 0;
  		SetTimerEx("Firework", 25000, 0, "ii", playerid, TYPE_COUNTDOWN);
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You arent authorized to use this command!");
	}
	return 1;
}

CMD:clearfirework(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command!");
	new giveplayerid;
	if(sscanf(params, "i", giveplayerid)) return Syntax(playerid, "clearfirework", "[playerid]");
	if(!IsPlayerConnected(giveplayerid)) return Error(playerid, "That player is not online!");

	if(RocketExplosions[giveplayerid] == 1 || RocketExplosions[giveplayerid] == 0)
	{
		RocketExplosions[giveplayerid] = -1;
	}
	 return 1;
}
Reply
#4

Код:
#include <a_samp>
#include <streamer>

// Firework System
#define RocketHeight 50
#define TYPE_COUNTDOWN 2000
#define TYPE_LAUNCH 2001
#define TYPE_EXPLODE 2002
#define MAX_FIREWORKS 100
#define FireworkSpread 30



forward Firework(playerid, type);
public Firework(playerid, type)
{
	if(!IsPlayerConnected(playerid))
	{
	    DestroyDynamicObject(Rocket[playerid]);
	    DestroyDynamicObject(RocketLight[playerid]);
	    DestroyDynamicObject(RocketSmoke[playerid]);
	    return 1;
	}
    new Float:x, Float:y, Float:z;
    x = GetPVarFloat(playerid, "fxpos");
    y = GetPVarFloat(playerid, "fypos");
    z = GetPVarFloat(playerid, "fzpos");
    if (type == TYPE_COUNTDOWN)
    {
        new string[128];
		format(string, sizeof(string), "STAND BACK! 5 seconds till launch!", GetPlayerNameEx(playerid));
	    ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
	    SetTimerEx("Firework", 5000, 0, "ii", playerid, TYPE_LAUNCH);
    }
	else if(type == TYPE_LAUNCH)
	{
	    CreateExplosion(x ,y, z, 12, 5);
		new time = MoveDynamicObject(Rocket[playerid], x, y, z + RocketHeight, 10);
		MoveDynamicObject(RocketLight[playerid], x, y, z + 2 + RocketHeight, 10);
		MoveDynamicObject(RocketSmoke[playerid], x, y, z + RocketHeight, 10);
		SetTimerEx("Firework", time, 0, "ii", playerid, TYPE_EXPLODE);
	}
	else if(type == TYPE_EXPLODE)
	{
	    z += RocketHeight;
	    if (RocketExplosions[playerid] == 0)
		{
		    DestroyDynamicObject(Rocket[playerid]);
		    DestroyDynamicObject(RocketLight[playerid]);
		    DestroyDynamicObject(RocketSmoke[playerid]);
		    CreateExplosion(x ,y, z, 4, 10);
		    CreateExplosion(x ,y, z, 5, 10);
		    CreateExplosion(x ,y, z, 6, 10);
		}
		else if (RocketExplosions[playerid] >= MAX_FIREWORKS)
		{
		    for (new i = 0; i <= FireworkSpread; i++)
		    {
		    	CreateExplosion(x + float(i - (FireworkSpread / 2)), y, z, 7, 10);
		    	CreateExplosion(x, y + float(i - (FireworkSpread / 2)), z, 7, 10);
		    	CreateExplosion(x, y, z + float(i - (FireworkSpread / 2)), 7, 10);
		    }
		    RocketExplosions[playerid] = -1;
		    return 1;
		}
		else
		{
			x += float(random(FireworkSpread) - (FireworkSpread / 2));
			y += float(random(FireworkSpread) - (FireworkSpread / 2));
			z += float(random(FireworkSpread) - (FireworkSpread / 2));
		    CreateExplosion(x, y, z, 7, 10);
		}
		RocketExplosions[playerid]++;
  		SetTimerEx("Firework", 250, 0, "ii", playerid, TYPE_EXPLODE);
	}
	return 1;
}



CMD:placefirework(playerid, params[])
{
	if(GetPVarInt(playerid, "IsInArena") >= 0)
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
		return 1;
	}
	if(WatchingTV[playerid] != 0) {
        SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
        return 1;
    }
	if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
		return 1;
	}
	if(RocketExplosions[playerid] != -1)
	{
	    SendClientMessageEx(playerid, COLOR_WHITE, "You are already using another firework!");
		return 1;
	}
	if (PlayerInfo[playerid][pVW] != 0 || PlayerInfo[playerid][pInt] != 0)
	{
	    SendClientMessageEx(playerid, COLOR_WHITE, "You can't launch fireworks indoors!");
		return 1;
	}
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new string[128];
		format(string, sizeof(string), "%s has placed a firework which will go off in 30 seconds!", GetPlayerNameEx(playerid));
	    ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
	    new Float:x, Float:y, Float:z, Float:a;
	    GetPlayerPos(playerid, x, y, z);
	    GetPlayerFacingAngle(playerid, a);
	    ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
	    x += (2 * floatsin(-a, degrees));
    	y += (2 * floatcos(-a, degrees));
	    Rocket[playerid] = CreateDynamicObject(3786, x, y, z, 0, 90, 0);
	    RocketLight[playerid] = CreateDynamicObject(354, x, y, z + 1, 0, 0, 0);
		RocketSmoke[playerid] = CreateDynamicObject(18716, x, y, z - 4, 0, 0, 0);
	    SetPVarFloat(playerid,"fxpos",x);
  		SetPVarFloat(playerid,"fypos",y);
  		SetPVarFloat(playerid,"fzpos",z);
  		RocketExplosions[playerid] = 0;
  		SetTimerEx("Firework", 25000, 0, "ii", playerid, TYPE_COUNTDOWN);
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You arent authorized to use this command!");
	}
	return 1;
}

CMD:clearfirework(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command!");
	new giveplayerid;
	if(sscanf(params, "i", giveplayerid)) return Syntax(playerid, "clearfirework", "[playerid]");
	if(!IsPlayerConnected(giveplayerid)) return Error(playerid, "That player is not online!");

	if(RocketExplosions[giveplayerid] == 1 || RocketExplosions[giveplayerid] == 0)
	{
		RocketExplosions[giveplayerid] = -1;
	}
	 return 1;
}
Reply
#5

D:\New folder\gamemodes\FW.pwn(35) : error 017: undefined symbol "GetPlayerNameEx"
D:\New folder\gamemodes\FW.pwn(36) : error 017: undefined symbol "ProxDetector"
D:\New folder\gamemodes\FW.pwn(50) : error 017: undefined symbol "RocketExplosions"
D:\New folder\gamemodes\FW.pwn(50) : warning 215: expression has no effect
D:\New folder\gamemodes\FW.pwn(50) : error 001: expected token: ";", but found "]"
D:\New folder\gamemodes\FW.pwn(50) : error 029: invalid expression, assumed zero
D:\New folder\gamemodes\FW.pwn(50) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#6

You will need to make the function for RocketExplosions

But here are the functions for GetPlayerNameEx and ProxDetector:
Код:
 
stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    for(new i; MAX_PLAYERS>i; i++)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
    return 1;
}

stock GetPlayerNameEx(playerid)
{
    new
        name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Reply
#7

Dosen't work...
Reply
#8

What doesn't work?
Reply
#9

When I compile same errors.
Reply
#10

What errors?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)