[CSGO] Rezolvare Plugin

Descărcări de pluginuri și discuții despre acestea.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
[Royal]Fido
Membru nou
Membru nou
Posts: 3
Joined: 02 Sep 2019, 11:15
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time

04 Jun 2021, 18:49

Salut, daca am gresit sectiunea, sau daca era un model anume de urmat pentru asta, imi cer scuze din avans, insa am cautat si nu am gasit.

Am si eu o problema, la compilarea unui plugin de !admins (care arata adminii in chat). Imi da 7 erori de tag mismatch. Aveti vreo rezolvare?
Sursa:
| Afiseaza codul
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>
#include <colors>

#pragma newdecls required

public Plugin myinfo = 
{
    name = "Admini online",
    author = "zLow",
    description = "Arata admini online",
    version = "",
    url = ""
};

public void OnPluginStart()
{
    RegConsoleCmd("sm_admins", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_admini", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_adminionline", Command_ShowAdminsOnline);
}

public Action Command_ShowAdminsOnline(int client, int args)
{
    for (int index = 1; index < MaxClients; index++)
    {
        if(IsClientInGame(index))
        {
            AdminId ClientAccess = GetUserAdmin(index);
            
            if(ClientAccess)
            {
                int AdminGroupsCount = GetAdminGroupCount(ClientAccess);
                
                for (int x = 0; x < AdminGroupsCount; x++)
                {
                    char GroupName[32];
   
                    if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_ROOT)
                    {                        
                        PrintToChat(client, "\x01★\x02 Owners: \x01 %N", client );                        
                    }                 
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM1)
                    {                        
                        PrintToChat(client, "\x01★\x08 Managers: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM2)
                    {
                        PrintToChat(client, "\x01★\x07 Admins: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM3)
                    {
                        PrintToChat(client, "\x01★\x04 Super-Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM4)
                    {
                        PrintToChat(client, "\x01★\x05 Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM5)
                    {
                        PrintToChat(client, "\x01★\x06 Helpers: \x01 %N", client );                        
                    }
                }
            }
        }
    }
}
User avatar
robbencsgo
Membru, skill 0
Membru, skill 0
Posts: 96
Joined: 31 Aug 2019, 18:14
Detinator Steam: Da
CS Status: aimer
SteamID: an prevat
Fond eXtream: 0
Has thanked: 9 times
Been thanked: 11 times
Contact:

21 Jun 2021, 18:53

[Royal]Fido wrote:
04 Jun 2021, 18:49
Salut, daca am gresit sectiunea, sau daca era un model anume de urmat pentru asta, imi cer scuze din avans, insa am cautat si nu am gasit.

Am si eu o problema, la compilarea unui plugin de !admins (care arata adminii in chat). Imi da 7 erori de tag mismatch. Aveti vreo rezolvare?
Sursa:
| Afiseaza codul
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>
#include <colors>

#pragma newdecls required

public Plugin myinfo = 
{
    name = "Admini online",
    author = "zLow",
    description = "Arata admini online",
    version = "",
    url = ""
};

public void OnPluginStart()
{
    RegConsoleCmd("sm_admins", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_admini", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_adminionline", Command_ShowAdminsOnline);
}

public Action Command_ShowAdminsOnline(int client, int args)
{
    for (int index = 1; index < MaxClients; index++)
    {
        if(IsClientInGame(index))
        {
            AdminId ClientAccess = GetUserAdmin(index);
            
            if(ClientAccess)
            {
                int AdminGroupsCount = GetAdminGroupCount(ClientAccess);
                
                for (int x = 0; x < AdminGroupsCount; x++)
                {
                    char GroupName[32];
   
                    if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_ROOT)
                    {                        
                        PrintToChat(client, "\x01★\x02 Owners: \x01 %N", client );                        
                    }                 
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM1)
                    {                        
                        PrintToChat(client, "\x01★\x08 Managers: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM2)
                    {
                        PrintToChat(client, "\x01★\x07 Admins: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM3)
                    {
                        PrintToChat(client, "\x01★\x04 Super-Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM4)
                    {
                        PrintToChat(client, "\x01★\x05 Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM5)
                    {
                        PrintToChat(client, "\x01★\x06 Helpers: \x01 %N", client );                        
                    }
                }
            }
        }
    }
}
De obicei tag mismatch e pentru ca nu este aranjat codul si de obicei nu e o eroare ci un warning care nu deranjeaza neaparat.
Daca te-am ajutat, lasa si tu un +1
User avatar
Sorinel
Fost moderator
Fost moderator
Posts: 4994
Joined: 25 Aug 2014, 20:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Christmas, A k c 3 n 7
Fond eXtream: 0
Location: Ploiesti
Been thanked: 16 times

21 Jun 2021, 19:28

loose identation este acel warning care te avertizeaza ca ai spatii inutile in cod, in cazul lui este altceva, vezi poate te ajuta asta https://forums.alliedmods.net/showthread.php?t=320415
XMAS EVERYDAY
Filiq_
Utilizator neserios
Utilizator neserios
Posts: 775
Joined: 02 Nov 2014, 18:21
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Fost Scripter eXtreamCS
Utilizator neserios
Fond eXtream: 0
Location: Constanta
Has thanked: 27 times
Been thanked: 21 times

22 Jun 2021, 19:37

robbencsgo wrote:
21 Jun 2021, 18:53
[Royal]Fido wrote:
04 Jun 2021, 18:49
Salut, daca am gresit sectiunea, sau daca era un model anume de urmat pentru asta, imi cer scuze din avans, insa am cautat si nu am gasit.

Am si eu o problema, la compilarea unui plugin de !admins (care arata adminii in chat). Imi da 7 erori de tag mismatch. Aveti vreo rezolvare?
Sursa:
| Afiseaza codul
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>
#include <colors>

#pragma newdecls required

public Plugin myinfo = 
{
    name = "Admini online",
    author = "zLow",
    description = "Arata admini online",
    version = "",
    url = ""
};

public void OnPluginStart()
{
    RegConsoleCmd("sm_admins", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_admini", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_adminionline", Command_ShowAdminsOnline);
}

public Action Command_ShowAdminsOnline(int client, int args)
{
    for (int index = 1; index < MaxClients; index++)
    {
        if(IsClientInGame(index))
        {
            AdminId ClientAccess = GetUserAdmin(index);
            
            if(ClientAccess)
            {
                int AdminGroupsCount = GetAdminGroupCount(ClientAccess);
                
                for (int x = 0; x < AdminGroupsCount; x++)
                {
                    char GroupName[32];
   
                    if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_ROOT)
                    {                        
                        PrintToChat(client, "\x01★\x02 Owners: \x01 %N", client );                        
                    }                 
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM1)
                    {                        
                        PrintToChat(client, "\x01★\x08 Managers: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM2)
                    {
                        PrintToChat(client, "\x01★\x07 Admins: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM3)
                    {
                        PrintToChat(client, "\x01★\x04 Super-Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM4)
                    {
                        PrintToChat(client, "\x01★\x05 Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM5)
                    {
                        PrintToChat(client, "\x01★\x06 Helpers: \x01 %N", client );                        
                    }
                }
            }
        }
    }
}
De obicei tag mismatch e pentru ca nu este aranjat codul si de obicei nu e o eroare ci un warning care nu deranjeaza neaparat.
amuzant esti
User avatar
Sorinel
Fost moderator
Fost moderator
Posts: 4994
Joined: 25 Aug 2014, 20:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Christmas, A k c 3 n 7
Fond eXtream: 0
Location: Ploiesti
Been thanked: 16 times

22 Jun 2021, 20:03

....
XMAS EVERYDAY
User avatar
TheOne1812
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 381
Joined: 13 Apr 2018, 22:57
Detinator Steam: Da
CS Status: kRatoss#9725 @ Discord
Detinator server CS: go.strix.ro
SteamID: STEAM_0:1:65095681
Fond eXtream: 0
Location: www.strix.ro
Has thanked: 27 times
Been thanked: 12 times

23 Jun 2021, 13:35

Code: Select all

native GroupId GetAdminGroup(AdminId id, int index, char[] name, int maxlength)
functia asta da return la un GroupId, iar tu le compari cu FlagBits https://cs.alliedmods.net/sourcemod/sou ... m.h#95-115, e normal ca dea warning tag mistmatch(care iti spune ca tu compari 2 variabile de tip diferit, de ex string cu integer si nu are treaba cum asezi tu codul, tab, space, etc.)

poti sa obtii ce doresti in 2 moduri:
daca vrei sa te iei dupa numele grupei de admin, aflat in configs/admin_groups.cfg | Afiseaza codul
public Action Command_ShowAdminsOnline(int client, int args)
{
	char GroupName[32];
	int AdminGroupsCount;
	AdminId ClientAccess;

	for (int index = 1; index < MaxClients; index++)
	{
		if(IsClientInGame(index))
		{
			ClientAccess = GetUserAdmin(index);
			
			if(ClientAccess)
			{
				AdminGroupsCount = GetAdminGroupCount(ClientAccess);
				
				for (int x = 0; x < AdminGroupsCount; x++)
				{
					if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != INVALID_GROUP_ID)
					{ 
						/* Daca grupa de admin se numeste "Owner", "Owners", "ServerOwner", etc.. - orice ce contine "owner" */
						/* Regula se aplica si la celelalte grade */
						if(StrContains(GroupName, "owner", false) != -1)
						{
							PrintToChat(client, "\x01★\x02 Owners: \x01 %N", index);
						}
						else if(StrContains(GroupName, "managers", false) != -1)
						{
							PrintToChat(client, "\x01★\x08 Managers: \x01 %N", index);
						}
						else if(StrContains(GroupName, "admins", false) != -1)
						{
							PrintToChat(client, "\x01★\x07 Admins: \x01 %N", index);
						}
						else if(StrContains(GroupName, "super-moderator", false) != -1)
						{
							PrintToChat(client, "\x01★\x04 Super-Moderators: \x01 %N", index);
						}
						else if(StrContains(GroupName, "moderator", false) != -1)
						{
							PrintToChat(client, "\x01★\x05 Moderators: \x01 %N", index);
						}
						else if(StrContains(GroupName, "helpers", false) != -1)
						{
							PrintToChat(client, "\x01★\x06 Helpers: \x01 %N", index);
						}
					}
				}
			}
		}
	}
}
daca vrei sa te iei dupa flagbits, de ex ADMFLAG_ROOT, ca in sursa ta | Afiseaza codul
public Action Command_ShowAdminsOnline(int client, int args)
{
	int FlagBits;
	
	for (int index = 1; index < MaxClients; index++)
	{
		if(IsClientInGame(index))
		{
			FlagBits = GetUserFlagBits(index);
			
			if(FlagBits != 0)
			{
				if(FlagBits & ADMFLAG_ROOT)
				{
					PrintToChat(client, "\x01★\x02 Owners: \x01 %N", index);
				}
				else if(FlagBits & ADMFLAG_CUSTOM1)
				{
					PrintToChat(client, "\x01★\x08 Managers: \x01 %N", index);
				}
				else if(FlagBits & ADMFLAG_CUSTOM2)
				{
					PrintToChat(client, "\x01★\x07 Admins: \x01 %N", index);
				}
				else if(FlagBits & ADMFLAG_CUSTOM3)
				{
					PrintToChat(client, "\x01★\x04 Super-Moderators: \x01 %N", index);
				}
				else if(FlagBits & ADMFLAG_CUSTOM4)
				{
					PrintToChat(client, "\x01★\x05 Moderators: \x01 %N", index);
				}
				else if(FlagBits & ADMFLAG_CUSTOM5)
				{
					PrintToChat(client, "\x01★\x06 Helpers: \x01 %N", index);
				}		
			}
		}
	}
}
.. si apropo, un alt bug din sursa pe care ai pus o tu ar fi ca tu dai print la numele celui care a folosit comanda in loc de numele adminului cu grupa respectiva, deci nu e bine dar ti am fixat asta + aia cu loose identation ca aveai niste spatii puse cu space in loc de tab si poate unele compilere puteau da warning, not sure tho.

vezi ca zLow e un nume cam neinspirat :P https://forums.alliedmods.net/member.php?u=291996
╔═════ DETINATOR SI DEVELOPER ═════╗
GO.STRIX.RO & FFA.WARMUP.RO
User avatar
robbencsgo
Membru, skill 0
Membru, skill 0
Posts: 96
Joined: 31 Aug 2019, 18:14
Detinator Steam: Da
CS Status: aimer
SteamID: an prevat
Fond eXtream: 0
Has thanked: 9 times
Been thanked: 11 times
Contact:

23 Jun 2021, 20:36

Filiq_ wrote:
22 Jun 2021, 19:37
robbencsgo wrote:
21 Jun 2021, 18:53
[Royal]Fido wrote:
04 Jun 2021, 18:49
Salut, daca am gresit sectiunea, sau daca era un model anume de urmat pentru asta, imi cer scuze din avans, insa am cautat si nu am gasit.

Am si eu o problema, la compilarea unui plugin de !admins (care arata adminii in chat). Imi da 7 erori de tag mismatch. Aveti vreo rezolvare?
Sursa:
| Afiseaza codul
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>
#include <colors>

#pragma newdecls required

public Plugin myinfo = 
{
    name = "Admini online",
    author = "zLow",
    description = "Arata admini online",
    version = "",
    url = ""
};

public void OnPluginStart()
{
    RegConsoleCmd("sm_admins", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_admini", Command_ShowAdminsOnline);
    RegConsoleCmd("sm_adminionline", Command_ShowAdminsOnline);
}

public Action Command_ShowAdminsOnline(int client, int args)
{
    for (int index = 1; index < MaxClients; index++)
    {
        if(IsClientInGame(index))
        {
            AdminId ClientAccess = GetUserAdmin(index);
            
            if(ClientAccess)
            {
                int AdminGroupsCount = GetAdminGroupCount(ClientAccess);
                
                for (int x = 0; x < AdminGroupsCount; x++)
                {
                    char GroupName[32];
   
                    if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_ROOT)
                    {                        
                        PrintToChat(client, "\x01★\x02 Owners: \x01 %N", client );                        
                    }                 
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM1)
                    {                        
                        PrintToChat(client, "\x01★\x08 Managers: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM2)
                    {
                        PrintToChat(client, "\x01★\x07 Admins: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM3)
                    {
                        PrintToChat(client, "\x01★\x04 Super-Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM4)
                    {
                        PrintToChat(client, "\x01★\x05 Moderators: \x01 %N", client );                        
                    }
                    else if(GetAdminGroup(ClientAccess, x, GroupName, sizeof(GroupName)) != ADMFLAG_CUSTOM5)
                    {
                        PrintToChat(client, "\x01★\x06 Helpers: \x01 %N", client );                        
                    }
                }
            }
        }
    }
}
De obicei tag mismatch e pentru ca nu este aranjat codul si de obicei nu e o eroare ci un warning care nu deranjeaza neaparat.
amuzant esti
ups, my bad.. am uitat ca lose identation era aia, nu am mai scris un cod de ceva timp :)
Daca te-am ajutat, lasa si tu un +1
Post Reply

Return to “Pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests