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

Tag Mismatch?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 03-12-2022 , 09:25   Tag Mismatch?
Reply With Quote #1

I am encountering a very strange issue with the compilation of plugins. This could be a simple mistake on my end, but I am very confused. First, let me show you my code:
PHP Code:
#include <sourcemod>
#include <tf2>

ConVar g_Cvar_Test[view_as<int>(TFTeam)][view_as<int>(TFClassType)];

Handle g_hTest[view_as<int>(TFTeam)][view_as<int>(TFClassType)];

int g_iTest[view_as<int>(TFTeam)][view_as<int>(TFClassType)];

public 
void OnPluginStart()
{
    
// Testing with ConVars
    
g_Cvar_Test[2][1] = CreateConVar("sm_cvar_test""1""Test"); // Works
    
g_Cvar_Test[view_as<int>(TFTeam_Red)][1] = CreateConVar("sm_cvar_test2""1""Test"); // Works
    
g_Cvar_Test[view_as<int>(TFTeam_Red)][view_as<int>(TFClass_Scout)] = CreateConVar("sm_cvar_test3""1""Test"); // warning 213: tag mismatch

    // Testing with handles
    
g_hTest[2][1] = CreateArray(); // Works
    
g_hTest[view_as<int>(TFTeam_Red)][1] = CreateArray(); // Works
    
g_hTest[view_as<int>(TFTeam_Red)][view_as<int>(TFClass_Scout)] = CreateArray(); // warning 213: tag mismatch

    // Testing with integers
    
g_iTest[2][1] = 1// Works
    
g_iTest[view_as<int>(TFTeam_Red)][1] = 1// Works
    
g_iTest[view_as<int>(TFTeam_Red)][view_as<int>(TFClass_Scout)] = 1// Works

As you can see, I am attempting to assign certain values to multi-dimensional arrays. However, I encountered a very strange behavior when it comes to handles. For some reason, when I attempt to index the second set of brackets with, for example:
Code:
view_as<int>(TFClass_Scout)
It gives me this warning:
Code:
warning 213: tag mismatch
However, if I use a normal integer, it works completely fine. The weirdest part is that this warning does not occur when I attempt to do it with the integer based array. Why is this?

Last edited by ThatKidWhoGames; 03-12-2022 at 09:27.
ThatKidWhoGames 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 16:21.


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