Raised This Month: $32 Target: $400
 8% 

Help needed with a plugin [CS:GO]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Killer NL
AlliedModders Donor
Join Date: Aug 2018
Location: The Netherlands
Old 09-02-2018 , 12:54   Help needed with a plugin [CS:GO]
Reply With Quote #1

This is the code but for some reason the Player Clantag and Founder Clantag work fine but the others like Admin, Head-Admin, Owner, VIP and VIP+ won't work at all i'm lost i would appreciate it if someone could help me.

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

#pragma semicolon 1

public Plugin:myinfo =
{
    
name "CountryTags",
    
description "CountryTags for scoreboard and Admin tags",
    
author "Killer",
    
version "1.0.1",
    
url ""
};

public 
void:OnPluginStart()
{
    
HookEvent("player_team"EventSpawnEventHookMode:1);
    
HookEvent("player_spawn"EventSpawnEventHookMode:1);
    
HookEvent("round_start"EventSpawnEventHookMode:1);
    
HookEvent("round_end"EventSpawnEventHookMode:1);
    return 
void:0;
}

public 
void:OnClientPutInServer(client)
{
    new 
client 1;
    while (
client <= MaxClients)
    {
        if (
IsClientInGame(client))
        {
            if (
client)
            {
                
HandleTag(client);
            }
        }
        
client++;
    }
    return 
void:0;
}

public 
Action:EventSpawn(Event:eventString:name[], bool:dontBroadcast)
{
    new 
client 1;
    while (
client <= MaxClients)
    {
        if (
IsClientInGame(client))
        {
            if (
client)
            {
                
HandleTag(client);
            }
        }
        
client++;
    }
    return 
Action:0;
}

void:HandleTag(client)
{
    new 
String:szClanTag[32];
    new 
String:sIP[28];
    new 
String:szBuffer[4];
    
GetClientIP(clientsIP26true);
    
GeoipCode2(sIPszBuffer);
    if (
CheckCommandAccess(client"owner"16384false))
    {
        
Format(szClanTag32"%s | Founder"szBuffer);
        
CS_SetClientClanTag(clientszClanTag);
    }
    else
    {
        if (
CheckCommandAccess(client"owner"8192false))
        {
            
Format(szClanTag32"%s | Owner"szBuffer);
            
CS_SetClientClanTag(clientszClanTag);
        }
        if (
CheckCommandAccess(client"headadmin"64false))
        {
            
Format(szClanTag32"%s | Head-Admin"szBuffer);
            
CS_SetClientClanTag(clientszClanTag);
        }
        if (
CheckCommandAccess(client"admin"2false))
        {
            
Format(szClanTag32"%s | Admin"szBuffer);
            
CS_SetClientClanTag(clientszClanTag);
        }
        if (
CheckCommandAccess(client"vipplus"524288false))
        {
            
Format(szClanTag32"%s | VIP+"szBuffer);
            
CS_SetClientClanTag(clientszClanTag);
        }
        if (
CheckCommandAccess(client"vip"1048576false))
        {
            
Format(szClanTag32"%s | VIP"szBuffer);
            
CS_SetClientClanTag(clientszClanTag);
        }
        
Format(szClanTag32"%s | Player"szBuffer);
        
CS_SetClientClanTag(clientszClanTag);
    }
    return 
void:0;

The Killer NL is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 09-02-2018 , 13:56   Re: Help needed with a plugin [CS:GO]
Reply With Quote #2

"return void:0;" lmao

I like that you return value in void function.

Wrote a lil snippet, take notes
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <geoip>

#pragma semicolon 1

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_Spawn);
}

public 
Action Event_Spawn(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid"));
    
    if (
IsClientInGame(iClient))
    {
        
char sIP[32], sCountry[32], sClanTag[64];
        
GetClientIP(iClientsIPsizeof(sIP));
        
        if (!
GeoipCountry(sIPsCountrysizeof(sCountry)))
            
sCountry "Unknown Country";
        
        
Format(sClanTagsizeof(sClanTag), "%s | Player"sCountry);
        
        if (
CheckCommandAccess(iClient""ADMFLAG_))
        {
            
Format(sClanTagsizeof(sClanTag), "%s | Whatever-Tag"sCountry);
        }
        
        
CS_SetClientClanTag(iClientsClanTag);
    }

mug1wara is offline
The Killer NL
AlliedModders Donor
Join Date: Aug 2018
Location: The Netherlands
Old 09-02-2018 , 14:12   Re: Help needed with a plugin [CS:GO]
Reply With Quote #3

Quote:
Originally Posted by mug1wara View Post
"return void:0;" lmao

I like that you return value in void function.

Wrote a lil snippet, take notes
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <geoip>

#pragma semicolon 1

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_Spawn);
}

public 
Action Event_Spawn(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid"));
    
    if (
IsClientInGame(iClient))
    {
        
char sIP[32], sCountry[32], sClanTag[64];
        
GetClientIP(iClientsIPsizeof(sIP));
        
        if (!
GeoipCountry(sIPsCountrysizeof(sCountry)))
            
sCountry "Unknown Country";
        
        
Format(sClanTagsizeof(sClanTag), "%s | Player"sCountry);
        
        if (
CheckCommandAccess(iClient""ADMFLAG_))
        {
            
Format(sClanTagsizeof(sClanTag), "%s | Whatever-Tag"sCountry);
        }
        
        
CS_SetClientClanTag(iClientsClanTag);
    }

Thanks for Helping but i have 1 more question it's showing the full "Country" so now u barely see "Admin" Because it will more look like this Netherland | A

Is it possible to make it like NL

Last edited by The Killer NL; 09-02-2018 at 14:13.
The Killer NL is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-02-2018 , 14:20   Re: Help needed with a plugin [CS:GO]
Reply With Quote #4

Quote:
Originally Posted by The Killer NL View Post
Thanks for Helping but i have 1 more question it's showing the full "Country" so now u barely see "Admin" Because it will more look like this Netherland | A

Is it possible to make it like NL
Code:
/**
 * Gets the two character country code from an IP address. (US, CA, etc)
 *
 * @param ip			Ip to determine the country code.
 * @param ccode			Destination string buffer to store the code.
 * @return				True on success, false if no country found.
 */
native bool GeoipCode2(const char[] ip, char ccode[3]);

/**
 * Gets the three character country code from an IP address. (USA, CAN, etc)
 *
 * @param ip			Ip to determine the country code.
 * @param ccode			Destination string buffer to store the code.
 * @return				True on success, false if no country found.
 */
native bool GeoipCode3(const char[] ip, char ccode[4]);
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
The Killer NL
AlliedModders Donor
Join Date: Aug 2018
Location: The Netherlands
Old 09-02-2018 , 16:16   Re: Help needed with a plugin [CS:GO]
Reply With Quote #5

Quote:
Originally Posted by eyal282 View Post
Code:
/**
 * Gets the two character country code from an IP address. (US, CA, etc)
 *
 * @param ip			Ip to determine the country code.
 * @param ccode			Destination string buffer to store the code.
 * @return				True on success, false if no country found.
 */
native bool GeoipCode2(const char[] ip, char ccode[3]);

/**
 * Gets the three character country code from an IP address. (USA, CAN, etc)
 *
 * @param ip			Ip to determine the country code.
 * @param ccode			Destination string buffer to store the code.
 * @return				True on success, false if no country found.
 */
native bool GeoipCode3(const char[] ip, char ccode[4]);
Hello, do you have any idea how i can make the tags overwrite to so when i have more tags and it uses like abcd "A = vip" B = Mod
but right now it still shows the vip tag instead of the Mod tag

Last edited by The Killer NL; 09-03-2018 at 10:59.
The Killer NL is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-08-2018 , 17:26   Re: Help needed with a plugin [CS:GO]
Reply With Quote #6

Quote:
Originally Posted by The Killer NL View Post
Hello, do you have any idea how i can make the tags overwrite to so when i have more tags and it uses like abcd "A = vip" B = Mod
but right now it still shows the vip tag instead of the Mod tag
if (CheckCommandAccess(client, "owner", 8192, false))
{
Format(szClanTag, 32, "%s | Owner", szBuffer);
CS_SetClientClanTag(client, szClanTag);
}
if (CheckCommandAccess(client, "headadmin", 64, false))
{
Format(szClanTag, 32, "%s | Head-Admin", szBuffer);
CS_SetClientClanTag(client, szClanTag);
}
if (CheckCommandAccess(client, "admin", 2, false))
{
Format(szClanTag, 32, "%s | Admin", szBuffer);
CS_SetClientClanTag(client, szClanTag);
}
if (CheckCommandAccess(client, "vipplus", 524288, false))
{
Format(szClanTag, 32, "%s | VIP+", szBuffer);
CS_SetClientClanTag(client, szClanTag);
}
if (CheckCommandAccess(client, "vip", 1048576, false))
{
Format(szClanTag, 32, "%s | VIP", szBuffer);
CS_SetClientClanTag(client, szClanTag);
}

This is what happens if the player has all commands above:

Format(szClanTag, 32, "%s | Owner", szBuffer);
CS_SetClientClanTag(client, szClanTag);

Format(szClanTag, 32, "%s | Head-Admin", szBuffer);
CS_SetClientClanTag(client, szClanTag);

Format(szClanTag, 32, "%s | Admin", szBuffer);
CS_SetClientClanTag(client, szClanTag);

Format(szClanTag, 32, "%s | VIP+", szBuffer);
CS_SetClientClanTag(client, szClanTag);

Format(szClanTag, 32, "%s | VIP", szBuffer);
CS_SetClientClanTag(client, szClanTag);

You simply overwrite everything, and spam the CS_SetClientClanTag 5 times and Format.

Write else if in all "if" statements except the first. This will make the first access to be found to be used.

If you're lazy to try and understand my guidance:

Code:
       if (CheckCommandAccess(client, "owner", 8192, false))  
        { 
            Format(szClanTag, 32, "%s | Owner", szBuffer); 
            CS_SetClientClanTag(client, szClanTag); 
        } 
        else if (CheckCommandAccess(client, "headadmin", 64, false)) 
        { 
            Format(szClanTag, 32, "%s | Head-Admin", szBuffer); 
            CS_SetClientClanTag(client, szClanTag); 
        } 
        else if (CheckCommandAccess(client, "admin", 2, false)) 
        { 
            Format(szClanTag, 32, "%s | Admin", szBuffer); 
            CS_SetClientClanTag(client, szClanTag); 
        } 
        else if (CheckCommandAccess(client, "vipplus", 524288, false)) 
        { 
            Format(szClanTag, 32, "%s | VIP+", szBuffer); 
            CS_SetClientClanTag(client, szClanTag); 
        } 
        else if (CheckCommandAccess(client, "vip", 1048576, false)) // VIP will not be executed if any of the above statements are found true.
        { 
            Format(szClanTag, 32, "%s | VIP", szBuffer); 
            CS_SetClientClanTag(client, szClanTag); 
        }
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 09-08-2018 at 17:27.
eyal282 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 00:35.


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