Raised This Month: $ Target: $400
 0% 

Tag Mismatch - where?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kempus
Member
Join Date: Jan 2016
Old 12-26-2016 , 17:41   Tag Mismatch - where?
Reply With Quote #1

Hi,
I wrote a small plugin for blocking 4 commands (in external plugin), as a temporary fix for problems, but i'm getting errors when trying to compile.

I don't know how to get rid of those tag mismatch errors

Code:
//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// shit.sp
//
// D:\sm\shit.sp(58) : warning 213: tag mismatch
// D:\sm\shit.sp(63) : warning 213: tag mismatch
// D:\sm\shit.sp(66) : warning 213: tag mismatch
// D:\sm\shit.sp(87) : warning 203: symbol is never used: "OnClientDisconnect"
// D:\sm\shit.sp(87) : warning 203: symbol is never used: "OnClientPostAdminCheck"
// Code size:             3776 bytes
// Data size:             2564 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   22724 bytes
//
// 5 Warnings.
//
// Compilation Time: 0,22 sec
// ----------------------------------------

Press enter to exit ...
Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

Handle AdminOnServer;

public OnPluginStart()
{
    RegConsoleCmd("voteban", CommandVote);
    RegConsoleCmd("votekick", CommandVote);
    RegConsoleCmd("votemute", CommandVote);
    RegConsoleCmd("votegag", CommandVote);
    
    CreateTimer(10.0, IsAdminOnline);
}

OnClientPostAdminCheck(int client)
{
    if((IsClientInGame(client)) && (!IsFakeClient(client)) && (GetUserFlagBits(client) & (ADMFLAG_GENERIC)))
    {
        AdminOnServer = true;
    }
    else
    {
        return Plugin_Handled;
    }
}

OnClientDisconnect(int client)
{
    if((IsClientInGame(client) && (!IsFakeClient(client)) && (GetUserFlagBits(client) & (ADMFLAG_GENERIC)))
    {
        AdminOnServer = false;
    }
    else
    {
        return Plugin_Handled;
    }
}

public Action:IsAdminOnline(Handle:Timer)
{
    for (new i = 1; i <= MaxClients; i++)
    
            if(IsClientInGame(i) && (!IsFakeClient(i)) && (GetUserFlagBits(i) & (ADMFLAG_GENERIC)))
            {
                if(!AdminOnServer)
                    AdminOnServer = true;
                else
                    return Plugin_Handled;
            }
            else if(IsClientInGame(i) && (!IsFakeClient(i)) && (!GetUserFlagBits(i) & (ADMFLAG_GENERIC)))
            {
                if(AdminOnServer)
                    AdminOnServer = false;
                else
                    return Plugin_Handled;
            }
        
    return Plugin_Continue;
    
}

public Action:CommandVote(int client, args)
{
    if(AdminOnServer)
    {
        PrintToChat(client, "[\x06Gamevoting\x01] \x06 Głosowanie jest niedostępne, administrator jest dostępny");
        
        return Plugin_Stop;
    }
    else
    {
        return Plugin_Continue;
    }
}

Last edited by Kempus; 12-26-2016 at 17:52.
Kempus is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 12-26-2016 , 18:27   Re: Tag Mismatch - where?
Reply With Quote #2

PHP Code:
 Handle AdminOnServer
You're declaring a handle, but using it as a boolean.

Also, you must put public infront of forwards for them to be used properly (OnClientDisconnect, OnClientPostAdminCheck, etc).

Last edited by headline; 12-26-2016 at 18:29.
headline is offline
Kempus
Member
Join Date: Jan 2016
Old 12-26-2016 , 18:44   Re: Tag Mismatch - where?
Reply With Quote #3

Quote:
Originally Posted by Headline View Post
PHP Code:
 Handle AdminOnServer
You're declaring a handle, but using it as a boolean.

Also, you must put public infront of forwards for them to be used properly (OnClientDisconnect, OnClientPostAdminCheck, etc).
Thanks man!
Kempus is offline
Kempus
Member
Join Date: Jan 2016
Old 12-26-2016 , 19:37   Re: Tag Mismatch - where?
Reply With Quote #4

Edited the plugin and got new tag mismatch errors, i dont understand why...

Code:
//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// Gamevoting_Disable.sp
//
// D:\sm\Gamevoting_Disable.sp(34) :
warning 213: tag mismatch
// D:\sm\Gamevoting_Disable.sp(37) :
warning 213: tag mismatch
// D:\sm\Gamevoting_Disable.sp(48) :
warning 213: tag mismatch
// D:\sm\Gamevoting_Disable.sp(51) :
warning 213: tag mismatch
// D:\sm\Gamevoting_Disable.sp(65) :
warning 213: tag mismatch
// D:\sm\Gamevoting_Disable.sp(72) :
warning 213: tag mismatch
// D:\sm\Gamevoting_Disable.sp(76) :
warning 213: tag mismatch
// Code size:             4380 bytes
// Data size:             2560 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   23324 bytes
//
// 7 Warnings.
//
// Compilation Time: 0,25 sec
// ----------------------------------------

Press enter to exit ...
Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

bool:AdminOnServer = false;

public Plugin myinfo = 
{
    name = "Gamevoting Disable",
    author = "Kempus",
    description = "Wyłącza głosowanie gdy admini są dostępni",
    version = "1.0",
    url = "http://cs-lajtowo.pl/"
};

public OnPluginStart()
{
    RegConsoleCmd("voteban", CommandVote);
    RegConsoleCmd("votekick", CommandVote);
    RegConsoleCmd("votemute", CommandVote);
    RegConsoleCmd("votegag", CommandVote);
    
    CreateTimer(10.0, IsAdminOnline, TIMER_REPEAT);
}

public void OnClientPostAdminCheck(int client)
{
    if(IsClientInGame(client) && !IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_GENERIC))
    {
        AdminOnServer = true;
    }
    else
    {
        return Plugin_Continue;
    }
    
    return Plugin_Continue;
}

public void OnClientDisconnect(int client)
{
    if(IsClientInGame(client) && !IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_GENERIC))
    {
        CheckAdminsOnline();
    }
    else
    {
        return Plugin_Continue;
    }
    
    return Plugin_Continue;
}

void CheckAdminsOnline()
{
    for (new i = 1; i <= MaxClients; i++)
    
        if(IsClientInGame(i) && !IsFakeClient(i))
        {
            if(GetUserFlagBits(i) & (ADMFLAG_GENERIC))
            {
                if(!AdminOnServer)
                    AdminOnServer = true;
                else
                    return Plugin_Handled;
            }
            else
            {
                if(AdminOnServer)
                    AdminOnServer = false;
                else
                    return Plugin_Handled;
            }
        }
        
    return Plugin_Continue;
}

public Action:IsAdminOnline(Handle:Timer)
{
    for (new i = 1; i <= MaxClients; i++)
    
        if(IsClientInGame(i) && !IsFakeClient(i))
        {
            if(GetUserFlagBits(i) & (ADMFLAG_GENERIC))
            {
                if(!AdminOnServer)
                    AdminOnServer = true;
                else
                    return Plugin_Continue;
            }
            else
            {
                if(AdminOnServer)
                    AdminOnServer = false;
                else
                    return Plugin_Continue;
            }
        }
        
    return Plugin_Continue;
    
}

public Action:CommandVote(int client, args)
{
    if(AdminOnServer)
    {
        PrintToChat(client, "[\x06Gamevoting\x01] \x06Głosowanie jest niedostępne, administrator jest dostępny");
        
        return Plugin_Stop;
    }
    else
    {
        return Plugin_Continue;
    }
}

Last edited by Kempus; 12-26-2016 at 19:37.
Kempus is offline
JOMENVEST
Member
Join Date: Dec 2016
Location: Sweden
Old 12-26-2016 , 19:49   Re: Tag Mismatch - where?
Reply With Quote #5

I made it a go, might have changed something.

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

bool:AdminOnServer false;

public 
Plugin myinfo 
{
    
name "Gamevoting Disable"
    
author "Kempus"
    
description "Wyłącza głosowanie gdy admini są dostępni"
    
version "1.0"
    
url "http://cs-lajtowo.pl/"
};

public 
OnPluginStart()
{
    
RegConsoleCmd("voteban"CommandVote);
    
RegConsoleCmd("votekick"CommandVote);
    
RegConsoleCmd("votemute"CommandVote);
    
RegConsoleCmd("votegag"CommandVote);
    
    
CreateTimer(10.0IsAdminOnlineTIMER_REPEAT);
}

public 
void OnClientPostAdminCheck(int client)
{
    if (
IsClientInGame(client) && !IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_GENERIC))
    {
        
AdminOnServer true;
    }
}

public 
void OnClientDisconnect(int client)
{
    if (
IsClientInGame(client) && !IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_GENERIC))
    {
        
CheckAdminsOnline();
    }
}

public 
void CheckAdminsOnline()
{
    for (new 
1<= MaxClientsi++)
    
    if (
IsClientInGame(i) && !IsFakeClient(i))
    {
        if (
GetUserFlagBits(i) & (ADMFLAG_GENERIC))
        {
            if (!
AdminOnServer)
                
AdminOnServer true;
        }
        else
        {
            if (
AdminOnServer)
                
AdminOnServer false;
        }
    }
}

public 
Action:IsAdminOnline(Handle:Timer)
{
    for (new 
1<= MaxClientsi++)
    
    if (
IsClientInGame(i) && !IsFakeClient(i))
    {
        if (
GetUserFlagBits(i) & (ADMFLAG_GENERIC))
        {
            if (!
AdminOnServer)
                
AdminOnServer true;
            else
                return 
Plugin_Continue;
        }
        else
        {
            if (
AdminOnServer)
                
AdminOnServer false;
            else
                return 
Plugin_Continue;
        }
    }
    
    return 
Plugin_Continue;
    
}

public 
Action:CommandVote(int clientargs)
{
    if (
AdminOnServer)
    {
        
PrintToChat(client"[\x06Gamevoting\x01] \x06Głosowanie jest niedostępne, administrator jest dostępny");
        return 
Plugin_Stop;
    }
    else
    {
        return 
Plugin_Continue;
    }

JOMENVEST is offline
Michael Shoe Maker
Senior Member
Join Date: Apr 2016
Old 12-26-2016 , 19:49   Re: Tag Mismatch - where?
Reply With Quote #6

Read the API....

PHP Code:
CreateTimer(10.0IsAdminOnlineTIMER_REPEAT); 
Arg2 is a function.
Michael Shoe Maker is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 12-27-2016 , 01:28   Re: Tag Mismatch - where?
Reply With Quote #7

Quote:
Originally Posted by Michael Shoe Maker View Post
Read the API....

PHP Code:
CreateTimer(10.0IsAdminOnlineTIMER_REPEAT); 
Arg2 is a function.
+1

Also, I think OnClientDisconnect and OnClientPostAdminCheck are useless since you're applying a repeating 10 seconds timer to check for admins. Why not 1 second?

Edit: Didn't read the first post thoroughly. If you're blocking those commands from another plugin, it should be:
PHP Code:
#pragma semicolon 1 // I really love semi-colons
#pragma newdecls required // it is the hip thing now, baby!
#include <sourcemod>
#include <sdktools>
#include <cstrike>

bool AdminOnServer;

public 
Plugin myinfo 
{
    
name "Gamevoting Disable"
    
author "Kempus"
    
description "Wyłącza głosowanie gdy admini są dostępni"
    
version "1.0"
    
url "http://cs-lajtowo.pl/"
};

public 
void OnPluginStart()
{
    
AddCommandListener(CommandVote"voteban");
    
AddCommandListener(CommandVote"votekick");
    
AddCommandListener(CommandVote"votemute");
    
AddCommandListener(CommandVote"votegag");
    
    
CreateTimer(1.0IsAdminOnline_TIMER_REPEAT);
}

public 
Action IsAdminOnline(Handle timer)
{
    if (!
IsServerProcessing())
    {
        return 
Plugin_Continue;
    }
    
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            if (
GetUserFlagBits(i) & ADMFLAG_GENERIC)
            {
                if (!
AdminOnServer)
                {
                    
AdminOnServer true;
                }
            }
            else
            {
                if (
AdminOnServer)
                {
                    
AdminOnServer false;
                }
            }
        }
    }
    
    return 
Plugin_Continue;
}

public 
Action CommandVote(int client, const char[] commandint args)
{
    if (!
AdminOnServer)
    {
        return 
Plugin_Continue;
    }
    
    
PrintToChat(client"[\x06Gamevoting\x01] \x06Głosowanie jest niedostępne, administrator jest dostępny");
    return 
Plugin_Handled;


Last edited by cravenge; 12-27-2016 at 01:44.
cravenge 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 15:57.


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