SA-MP Forums Archive
Quick help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Quick help (/showthread.php?tid=232244)



Quick help - Swiftz - 27.02.2011

I get lot of tag mismatch errors on these lines
Код:
public ChangeStreamPickupModel(ID,newmodel)
{
    if(Pickup[ID][pickupCreated])
	{
	    DestroyPickup(Pickup[ID][pickupID]);
	    Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupModel] = newmodel;
		return 1;
	}
	return 0;
}
public MoveStreamPickup(ID,Float:x,Float:y,Float:z)
{
	if(Pickup[ID][pickupCreated])
	{
	    DestroyPickup(Pickup[ID][pickupID]);
	    Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupX] = x;
		Pickup[ID][pickupY] = y;
		Pickup[ID][pickupZ] = z;
		return 1;
	}
	return 0;
}
public CreateStreamPickup(model,type,Float:x,Float:y,Float:z,range)
{
	new FoundID = 0;
	new ID;

	for ( new i = 0; FoundID <= 0 ; i++)
	{
	    if( Pickup[i][pickupCreated] == 0 )
	    {
	        if( FoundID == 0 )
	        {
	     	   ID = i;
	     	   FoundID = 1;
	        }
	    }
	    if( i > MAX_S_PICKUPS )
	    {
		    FoundID = 2;
		}
	}
	if( FoundID == 2 )
	{
	    print("[Error:] Pickup limit reached. Pickup not created");
	    return -1;
	}
	Pickup[ID][pickupCreated] = 1;
	Pickup[ID][pickupVisible] = 0;
	Pickup[ID][pickupModel] = model;
	Pickup[ID][pickupType] = type;
	Pickup[ID][pickupX] = x;
	Pickup[ID][pickupY] = y;
	Pickup[ID][pickupZ] = z;
	Pickup[ID][pickupRange] = range;
	return ID;

}
Defines
Код:
enum pickupINFO
{
	pickupCreated,
	pickupVisible,
	pickupID,
	pickupRange,
	Float:pickupX,
	Float:pickupY,
	Float:pickupZ,
 	pickupType,
	pickupModel
}
new Pickup[MAX_S_PICKUPS+1][pickupINFO];
Please help thnx


Re: Quick help - Bogdanovic - 27.02.2011

Specific line with error...


Re: Quick help - Swiftz - 27.02.2011

many


Re: Quick help - Leon_Rahil! - 27.02.2011

He meant to post the errors that you're getting, along with their lines.


Re: Quick help - Swiftz - 27.02.2011

It has many error lines i extracted it from my gm

F:\Copy of Pawnofinal\gamemodes\mrp.pwn(4857 : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48579) : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48580) : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48581) : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48582) : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48583) : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48584) : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48585) : warning 213: tag mismatch
F:\Copy of Pawnofinal\gamemodes\mrp.pwn(48586) : warning 213: tag mismatch


Re: Quick help - Swiftz - 27.02.2011

Please tell me where is the error
P.S first error is in the 2nd line of the code i posted


Re: Quick help - Swiftz - 27.02.2011

Help please!


Re: Quick help - Master_Gangster - 27.02.2011

what are the lines that are giving off these errors though, enlighten me with the lines please. Post the code of the lines here.


Re: Quick help - Swiftz - 27.02.2011

These lines
Код:
	Pickup[ID][pickupCreated] = 1;
	Pickup[ID][pickupVisible] = 0;
	Pickup[ID][pickupModel] = model;
	Pickup[ID][pickupType] = type;
	Pickup[ID][pickupX] = x;
	Pickup[ID][pickupY] = y;
	Pickup[ID][pickupZ] = z;
	Pickup[ID][pickupRange] = range;
	return ID;
Код:
public ChangeStreamPickupModel(ID,newmodel)
{
    if(Pickup[ID][pickupCreated])
	{
	    DestroyPickup(Pickup[ID][pickupID]);
	    Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupModel] = newmodel;
		return 1;
	}
	return 0;
}
public MoveStreamPickup(ID,Float:x,Float:y,Float:z)
{
	if(Pickup[ID][pickupCreated])
	{
	    DestroyPickup(Pickup[ID][pickupID]);
	    Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupX] = x;
		Pickup[ID][pickupY] = y;
		Pickup[ID][pickupZ] = z;
And the following lines cause the error local variable "ID" shadows a variable at a preceding level
Код:
public MoveStreamPickup(ID,Float:x,Float:y,Float:z)
public CreateStreamPickup(model,type,Float:x,Float:y,Float:z,range)
{
	new FoundID = 0;
	new ID;//This line cause the error

	for ( new i = 0; FoundID <= 0 ; i++)
	{
	    if( Pickup[i][pickupCreated] == 0 )
	    {
	        if( FoundID == 0 )
	        {
	     	   ID = i;
	     	   FoundID = 1;
	        }
	    }
	    if( i > MAX_S_PICKUPS )
	    {
		    FoundID = 2;
		}
	}
	if( FoundID == 2 )
	{
	    print("[Error:] Pickup limit reached. Pickup not created");
	    return -1;
	}
	Pickup[ID][pickupCreated] = 1;
	Pickup[ID][pickupVisible] = 0;
	Pickup[ID][pickupModel] = model;
	Pickup[ID][pickupType] = type;
	Pickup[ID][pickupX] = x;
	Pickup[ID][pickupY] = y;
	Pickup[ID][pickupZ] = z;
	Pickup[ID][pickupRange] = range;
	return ID;

}



Re: Quick help - Master_Gangster - 27.02.2011

Quote:
Originally Posted by Swiftz
Посмотреть сообщение
These lines
Код:
	Pickup[ID][pickupCreated] = 1;
	Pickup[ID][pickupVisible] = 0;
	Pickup[ID][pickupModel] = model;
	Pickup[ID][pickupType] = type;
	Pickup[ID][pickupX] = x;
	Pickup[ID][pickupY] = y;
	Pickup[ID][pickupZ] = z;
	Pickup[ID][pickupRange] = range;
	return ID;
Код:
public ChangeStreamPickupModel(ID,newmodel)
{
    if(Pickup[ID][pickupCreated])
	{
	    DestroyPickup(Pickup[ID][pickupID]);
	    Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupModel] = newmodel;
		return 1;
	}
	return 0;
}
public MoveStreamPickup(ID,Float:x,Float:y,Float:z)
{
	if(Pickup[ID][pickupCreated])
	{
	    DestroyPickup(Pickup[ID][pickupID]);
	    Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupX] = x;
		Pickup[ID][pickupY] = y;
		Pickup[ID][pickupZ] = z;
And the following lines cause the error local variable "ID" shadows a variable at a preceding level
Код:
public MoveStreamPickup(ID,Float:x,Float:y,Float:z)
public CreateStreamPickup(model,type,Float:x,Float:y,Float:z,range)
{
	new FoundID = 0;
	new ID;//This line cause the error

	for ( new i = 0; FoundID <= 0 ; i++)
	{
	    if( Pickup[i][pickupCreated] == 0 )
	    {
	        if( FoundID == 0 )
	        {
	     	   ID = i;
	     	   FoundID = 1;
	        }
	    }
	    if( i > MAX_S_PICKUPS )
	    {
		    FoundID = 2;
		}
	}
	if( FoundID == 2 )
	{
	    print("[Error:] Pickup limit reached. Pickup not created");
	    return -1;
	}
	Pickup[ID][pickupCreated] = 1;
	Pickup[ID][pickupVisible] = 0;
	Pickup[ID][pickupModel] = model;
	Pickup[ID][pickupType] = type;
	Pickup[ID][pickupX] = x;
	Pickup[ID][pickupY] = y;
	Pickup[ID][pickupZ] = z;
	Pickup[ID][pickupRange] = range;
	return ID;

}
tag mismatch mean that you have two things that maybe can have conflict...
Try searching maybe you have TWO stock/non-stock callbacks or maybe some definitons are already used/defined.

the "Shadows a variable at a preceding level" warning means you have defined the variable "ID" as a global variable at the top of your script. Meaning you can either delete the global variable at the top or delete the one you are using at the bottom, or even better just rename "ID" to something else. for example "ID1" etc...