SA-MP Forums Archive
Warning 213: tag mismatch - 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)
+--- Thread: Warning 213: tag mismatch (/showthread.php?tid=583137)



Warning 213: tag mismatch - TheRaGeLord - 26.07.2015

What's Wrong here.. why is it giving a warning (Warning 213: tag mismatch) Here:

PHP код:
//My Enums
enum hinfo
{
    
id,
    
Cost,
    
Owner[MAX_PLAYER_NAME],
    
bool:hBought,
    
VW,
    
Interior,
    
Float:extX,
    
Float:extY,
    
Float:extZ,
    
Float:intX,
    
Float:intY,
    
Float:intZ,
    
hpickup,
    
htext,
};
new 
pHouse[MAX_HOUSES][hinfo]; 
PHP код:
/*>>>---Here--->>>>*/UpdateDynamic3DTextLabelText(pHouse[i][htext],0x00B900AF,str5); 
PHP код:
forward CreateHouse(hidcostFloat:xFloat:yFloat:zbool:Bought,hOwner[24]);
public 
CreateHouse(hidcostFloat:xFloat:yFloat:zbool:Bought,hOwner[24])
{
    
pHouse[hid][hpickup]=CreateDynamicPickup(1273,1,x,y,z);
    if(
Bought)
    {
        new 
str1[128];
        
format(str1,sizeof(str1),"House Owner: %s\nHID: %d",hOwner,hid);
/*>>>---Here--->>>>*/ pHouse[hid][htext]=CreateDynamic3DTextLabel(str1,0x00B900AF,x,y,z+1,5);
    }
    if(!
Bought)
    {
    new 
str2[128];
    
format(str2,sizeof(str2),"House for Sale\nCost: $%d\nHID: %d",cost,hid);
/*>>>>and Here--->>>>*/pHouse[hid][htext]=CreateDynamic3DTextLabel(str2,0x00B900AF,x,y,z+1,5);    
    }
return 
1;

and its also giving this warning: error 047: array sizes do not match, or destination array is too small

Here
PHP код:
if(pHouse[i][id]==0)
            {
                
pHouse[i][id]=CreateHouse(i,cost,x,y,z,false,"NULL");
                
pHouse[i][Cost]=cost;
                
pHouse[i][hBought]=false;
            
/*Here-->*/pHouse[i][Owner]="NULL";
                
pHouse[i][VW]=GetPlayerVirtualWorld(playerid);    
                
pHouse[i][extX]=x;
                
pHouse[i][extY]=y;
                
pHouse[i][extZ]=z;
                new 
str3[123];
                
format(str3sizeof(str3),"{E85656}[House Created]{FFFFFF} You have successfully created House(ID:%d) Cost: $%d",i,cost);
                
SendClientMessage(playeridCOLOR_YELLOW,str3);
                break;
            } 



Re: Warning 213: tag mismatch - dominik523 - 26.07.2015

Variable that stores a text label has to have different tag:
pawn Код:
enum hinfo
{
    id,
    Cost,
    Owner[MAX_PLAYER_NAME],
    bool:hBought,
    VW,
    Interior,
    Float:extX,
    Float:extY,
    Float:extZ,
    Float:intX,
    Float:intY,
    Float:intZ,
    hpickup,
    Text3D:htext   <---
};

new pHouse[MAX_HOUSES][hinfo];
And when you want to empty that variable, you will have to store '0' inside, not "NULL".
pawn Код:
pHouse[i][Owner]= Text3D:0; <-- Let's say 0 doesn't have a tag (actually it has, and it is _: ) and you want to store it inside of a variable with Text3D:, so you will have to add a tag to the 0 so you won't get tag mismatch
EDIT: Oops, sorry I didn't see you were emptying pHouse[i][Owner] which is a string. I thought you were setting your htext to a 0.


Re: Warning 213: tag mismatch - TheRaGeLord - 26.07.2015

Quote:
Originally Posted by dominik523
Посмотреть сообщение
pHouse[i][Owner]= Text3D:0; <-- Let's say 0 doesn't have a tag (actually it has, and it is _: ) and you want to store it inside of a variable with Text3D:, so you will have to add a tag to the 0 so you won't get tag mismatch
[/pawn]
I'm not getting tag mismatch with pHouse[i][Owner].. I'm getting " error 047: array sizes do not match, or destination array is too small" This warning


Re: Warning 213: tag mismatch - kloning1 - 26.07.2015

first you must know the native of 'Create3DTextLabel' and ' Update3DTextLabelText'
Код:
native Text3D:Create3DTextLabel(text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, virtualworld, testLOS=0);
native Update3DTextLabelText(Text3D:id, color, text[]);
then for 'pHouse[i][Owner]="NULL";'
change to
Код:
 format(pHouse[i][Owner], MAX_PLAYER_NAME, "NULL" );



Re: Warning 213: tag mismatch - TheRaGeLord - 26.07.2015

Quote:
Originally Posted by kloning1
Посмотреть сообщение
first you must know the native of 'Create3DTextLabel' and ' Update3DTextLabelText'
Код:
native Text3D:Create3DTextLabel(text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, virtualworld, testLOS=0);
native Update3DTextLabelText(Text3D:id, color, text[]);
then for 'pHouse[i][Owner]="NULL";'
change to
Код:
 format(pHouse[i][Owner], MAX_PLAYER_NAME, "NULL" );
Does that means that we can't assign the Value String to a variable directly - Just with = ?


Re: Warning 213: tag mismatch - kloning1 - 26.07.2015

Quote:
Originally Posted by TheRaGeLord
Посмотреть сообщение
Does that means that we can't assign the Value String to a variable directly - Just with = ?
yeah


Re: Warning 213: tag mismatch - TheRaGeLord - 26.07.2015

Oh.. Thanks.. You Both guys helped me a lot..

Well, can you tell me that How to Return a String..For eg. Returing a string in switch statements?
If case 1 then return Red, if case 2 then return Blue

Should I do format ?


Re: Warning 213: tag mismatch - kloning1 - 26.07.2015

I do not know what you mean, can you give some logic / clue?


Re: Warning 213: tag mismatch - TheRaGeLord - 26.07.2015

uhmm.. Well I figured it out.. Thanks


Re: Warning 213: tag mismatch - xVIP3Rx - 26.07.2015

Quote:
Originally Posted by TheRaGeLord
Посмотреть сообщение
Oh.. Thanks.. You Both guys helped me a lot..

Well, can you tell me that How to Return a String..For eg. Returing a string in switch statements?
If case 1 then return Red, if case 2 then return Blue

Should I do format ?
Yes, format or
pawn Код:
stock returncolor(color)
{
    new Col[5];
    switch(color)
    {
        case 1: Col = "Red";
        case 2: Col = "Blue";
    }

    return Col;
}