Raised This Month: $ Target: $400
 0% 

Detecting team change, tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-14-2020 , 09:57   Re: Detecting team change, tag mismatch
Reply With Quote #1

You didn't get a "tag mismatch error", you got a warning. The warning means the left-hand side(lhs) tag and the right-hand side(rhs) tag do not match.

Check the expression:
PHP Code:
 g_PreTeam[id] = cs_get_user_team(id); 
g_PreTeam[id] is the lhs and it is created as:
PHP Code:
new g_PreTeam[33
so it doesn't have a tag.

Check rhs: cs_get_user_team(id). http://amxmodx.org/api/cstrike/cs_get_user_team

PHP Code:
native CsTeams:cs_get_user_team(index, &any:model CS_DONTCHANGE); 
The native returns a tagged value, with the tag "CsTeams". Te solution is simple, either tag g_PreTeam with CsTeams or detag the return value of the native with _:

About looping: search for get_players.

Also, please edit your posts instead of making multiple unneeded posts.
__________________

Last edited by HamletEagle; 06-14-2020 at 10:01.
HamletEagle is offline
Old 06-14-2020, 10:03
supertrio17
This message has been deleted by supertrio17. Reason: stupid
Old 06-14-2020, 10:16
alferd
This message has been deleted by alferd.
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-14-2020 , 12:37   Re: Detecting team change, tag mismatch
Reply With Quote #4

Hey, so I did this:
PHP Code:
new CsTeams:g_PreTeam[33]
new 
CsTeams:g_PostTeam[33
and it fixed g_PreTeam, but now I get this 2 messages:
Code:
// D:\Games\srw\cstrike\addons\amxmodx\scripting\Moji PLOVI\adminmodel.sma(58) : error 033: array must be indexed (variable "g_PostTeam")
// D:\Games\srw\cstrike\addons\amxmodx\scripting\Moji PLOVI\adminmodel.sma(62) : error 033: array must be indexed (variable "g_PostTeam")
My code looks like this:
PHP Code:
public logevent_round_end(id)
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
g_PreTeam[id] = cs_get_user_team(id);
    }
}

public 
OnPlayerSpawn(id)
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
g_PostTeam[id] = cs_get_user_team(id)
        
set_task(0.5"CheckModel"id);
    }

PHP Code:
public CheckModel(id)
{
    if(
g_PostTeam == g_PreTeam)
    {
        
CC_SendMessage(id"!n>> !gYour model was set, no need for change!");
    }
    else if(
g_PostTeam != g_PreTeam)
    {
        
cs_reset_user_model(id)
        
CC_SendMessage(id"!n>> !gModel reset applied, change your model!");
    }

__________________
Contact! || Discord:
Mr_Boopsy_#2066
supertrio17 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 17:12.


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