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

[CSGO] Country TAG


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sHoC
Senior Member
Join Date: Nov 2015
Location: Italy
Old 09-21-2017 , 10:13   [CSGO] Country TAG
Reply With Quote #1

Can someone remake this plugin?
__________________
sHoC is offline
nhnkl159
Senior Member
Join Date: Jul 2012
Location: Israel 3>
Old 09-21-2017 , 10:46   Re: [CSGO] Country TAG
Reply With Quote #2

Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "nhnkl159"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>
#include <geoip>
#include <cstrike>

ConVar gS_Enabled;

public Plugin myinfo = 
{
	name = "[CS:GO] Scoreboard Country", 
	author = PLUGIN_AUTHOR, 
	description = "Add [Country] tag to the player near his name.", 
	version = PLUGIN_VERSION, 
	url = "keepomod.com"
};

public void OnPluginStart()
{
	// === ConVars === //
	gS_Enabled = CreateConVar("sm_scoreboardcountry_enable", "1", "Sets whether or not to set player tags");
	
	// === Events && Shit === //
	HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
}

public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	if (gS_Enabled.BoolValue)
	{
		int client = GetClientOfUserId(event.GetInt("userid"));
		if (IsValidClient(client))
		{
			CreateTimer(1.5, SetTag_Timer, client, TIMER_FLAG_NO_MAPCHANGE);
		}
	}
}

public Action SetTag_Timer(Handle Timer, any client)
{
	char gS_IP[14], gS_Country[3], gS_Shit[32];
	
	GetClientIP(client, gS_IP, 14);
	if (GeoipCode2(gS_IP, gS_Country))
	{
		FormatEx(gS_Shit, 32, "[%s]", gS_Country);
	}
	else
	{
		FormatEx(gS_Shit, 32, "[--]");
	}
	
	CS_SetClientClanTag(client, gS_Shit);
}

stock bool IsValidClient(int client, bool alive = false, bool bots = false)
{
	if (client > 0 && client <= MaxClients && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)) && (bots == false && !IsFakeClient(client)))
	{
		return true;
	}
	return false;
}
__________________

Last edited by nhnkl159; 09-21-2017 at 10:47.
nhnkl159 is offline
Send a message via Skype™ to nhnkl159
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 09-21-2017 , 10:58   Re: [CSGO] Country TAG
Reply With Quote #3

https://forums.alliedmods.net/showthread.php?p=1433016
8guawong 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 18:13.


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