Raised This Month: $51 Target: $400
 12% 

What is a tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
king999
Member
Join Date: Feb 2015
Location: Mars
Old 10-21-2016 , 19:28   What is a tag mismatch
Reply With Quote #1

please tell me what is tag mismatch
thank you
as i am new in sourcemod
king999 is offline
Send a message via Skype™ to king999
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 10-22-2016 , 07:38   Re: What is a tag mismatch
Reply With Quote #2

Give your code for us.
There you can read what is tag mismatch: https://forums.alliedmods.net/showthread.php?t=94187
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
General Lentils
Senior Member
Join Date: Jul 2016
Old 10-22-2016 , 08:47   Re: What is a tag mismatch
Reply With Quote #3

A tag mismatch is basically a piece of code that is either missing or wrongly defined. For example:


PHP Code:
new Handle:arr CreateArray(Map);

decl map[Map];
strcopy(map[MAP_NAME], sizeof(map[MAP_NAME]), "cp_dustbowl");
strcopy(map[GROUP_NAME], sizeof(map[GROUP_NAME]), "Attack / Defend");
PushArrayArray(arrmap); 
is wrong, since Map would be wrongly used multiple times. To fix that, you could to this:

PHP Code:
//Manually define size
#define MAP_CELLS 128

new Handle:arr CreateArray(MAP_CELLS);

decl map[Map];
strcopy(map[MAP_NAME], sizeof(map[MAP_NAME]), "cp_dustbowl");
strcopy(map[GROUP_NAME], sizeof(map[GROUP_NAME]), "Attack / Defend");
PushArrayArray(arrmap[0]); 
Down below is a better example ;)

Last edited by General Lentils; 10-22-2016 at 09:10.
General Lentils is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 10-22-2016 , 09:01   Re: What is a tag mismatch
Reply With Quote #4

Quote:
Originally Posted by General Lentils View Post
A tag mismatch is basically a piece of code that is either missing or wrongly defined.
Actually, a tag mismatch means you are trying to use something typed as something for something expecting a different type.
Your example results in an "Argument type mismatch error" and not a "tag mismatch WARNING"
Note: Warnings ARE NOT ERRORS, a warning means the code was accepted, but it may result in UNDEFINED behavior.

Example of tag mismatch WARNING:
PHP Code:
Handle x 5// Tag mismatch: Expected type "Handle" got "int" 
__________________

Last edited by WildCard65; 10-22-2016 at 09:04.
WildCard65 is offline
General Lentils
Senior Member
Join Date: Jul 2016
Old 10-22-2016 , 09:12   Re: What is a tag mismatch
Reply With Quote #5

You can still count em as an Error in a way, since your code won't work anyways if you have your tags mismatched... ;)
General Lentils is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-22-2016 , 21:38   Re: What is a tag mismatch
Reply With Quote #6

In any other language, this would be a type mismatch compiler error.

The only reason this isn't here is because almost everything is really the type "cell" (read: 32-bit signed integer) in Pawn with a tag telling it if it has a special purpose (Float, bool, Handle, an enum type, etc...). The only exception is String/char which is an 8-bit type.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 12-01-2016 , 00:17   Re: What is a tag mismatch
Reply With Quote #7

Quote:
Originally Posted by General Lentils View Post
You can still count em as an Error in a way, since your code won't work anyways if you have your tags mismatched... ;)
Wrong. Tag mismatches often still result in code that works as intended.
__________________
ddhoward is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-01-2016 , 02:40   Re: What is a tag mismatch
Reply With Quote #8

In a typed language that would be an error unless you cast it (view_as<T>(expr) in our case). It can work, but you better make sure to fix those.
klippy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode