Raised This Month: $ Target: $400
 0% 

[CS:S] Connect-Disconnect with county tag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
playhardloveenemy
Member
Join Date: Dec 2015
Old 12-31-2018 , 02:15   [CS:S] Connect-Disconnect with county tag
Reply With Quote #1

Hallo!
Would someone help me finish this plugin by KorDen ? I would like to have disconnect option with (reason) and county if possible.
Thank you in advance!

PHP Code:
#pragma semicolon 1 
#include <sourcemod> 
#include <geoip> 

public Plugin:myinfo 

    
name "[KDLP] Game Events"
    
author "KorDen"
    
description ""
    
version "1.0"
    
url "dev.sky-play.ru" 

public 
OnPluginStart() 

    
HookEvent("player_connect"OnConnEventHookMode_Pre); 


public 
Action:OnConn(Handle:event, const String:name[], bool:dontBroadcast

    if (!
dontBroadcast
    
SetEventBroadcast(eventtrue); 
    new 
String:rawmsg[255], String:nick[MAX_NAME_LENGTH], 
    
String:steam[24], String:ip[16], String:reason[192]; 
    new 
i
    
GetEventString(event"networkid"steamsizeof(steam)); 
    
GetEventString(event"name"nicksizeof(nick)); 

     
    
GetEventString(event"address"ipsizeof(ip)); 
    
SplitString(ip":"ipsizeof(ip)); 
     
    new 
String:country[45]; 
    
GeoipCountry(ipcountry); 

    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x03%s \x01connecting (%s)"nickcountry); 

    for (
1<= MaxClientsi++) 
    if(
IsClientInGame(i)) 
    
PrintToChat(irawmsg); 

playhardloveenemy is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-31-2018 , 02:37   Re: [CS:S] Connect-Disconnect with county tag
Reply With Quote #2

not tested

PHP Code:
#pragma semicolon 1  
#include <sourcemod>  
#include <geoip>  

public Plugin:myinfo =  
{  
    
name "[KDLP] Game Events",  
    
author "KorDen",  
    
description "",  
    
version "1.0",  
    
url "dev.sky-play.ru"  
}  
public 
OnPluginStart()  
{  
    
HookEvent("player_connect"OnConnEventHookMode_Pre);  
}  

public 
Action:OnConn(Handle:event, const String:name[], bool:dontBroadcast)  
{  
    if (!
dontBroadcast)  
    
SetEventBroadcast(eventtrue);  
    new 
String:rawmsg[255], String:nick[MAX_NAME_LENGTH],  
    
String:steam[24], String:ip[16], String:reason[192];  
    new 
i;  
    
GetEventString(event"networkid"steamsizeof(steam));  
    
GetEventString(event"name"nicksizeof(nick));  

      
    
GetEventString(event"address"ipsizeof(ip));  
    
SplitString(ip":"ipsizeof(ip));  
      
    new 
String:country[45];  
    
GeoipCountry(ipcountry);  

    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x03%s \x01connecting (%s)"nickcountry);  

    for (
1<= MaxClientsi++)  
    if(
IsClientInGame(i))  
    
PrintToChat(irawmsg);  
}  

public 
OnClientDisconnect(client)  
{  
    new 
String:ip[16], String:rawmsg[255], country[45];
    
GetClientIP(clientipsizeof(ip));  
    
GeoipCountry(ipcountry); 
    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x03%N \x01disconnecting (%s)"clientcountry);   
    
PrintToChatAll(rawmsg); 

__________________
8guawong is offline
playhardloveenemy
Member
Join Date: Dec 2015
Old 12-31-2018 , 02:55   Re: [CS:S] Connect-Disconnect with county tag
Reply With Quote #3

Thank you for your quick replay!

can't compile ,btw.

Picture included
Attached Images
File Type: jpg asd.jpg (87.0 KB, 118 views)
playhardloveenemy is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-31-2018 , 03:28   Re: [CS:S] Connect-Disconnect with county tag
Reply With Quote #4

Quote:
Originally Posted by playhardloveenemy View Post
Thank you for your quick replay!

can't compile ,btw.

Picture included
PHP Code:
#pragma semicolon 1  
#include <sourcemod>  
#include <geoip>  

public Plugin:myinfo =  
{  
    
name "[KDLP] Game Events",  
    
author "KorDen",  
    
description "",  
    
version "1.0",  
    
url "dev.sky-play.ru"  
}  
public 
OnPluginStart()  
{  
    
HookEvent("player_connect"OnConnEventHookMode_Pre);  
}  

public 
Action:OnConn(Handle:event, const String:name[], bool:dontBroadcast)  
{  
    if (!
dontBroadcast)  
    
SetEventBroadcast(eventtrue);  
    new 
String:rawmsg[255], String:nick[MAX_NAME_LENGTH],  
    
String:steam[24], String:ip[16], String:reason[192];  
    new 
i;  
    
GetEventString(event"networkid"steamsizeof(steam));  
    
GetEventString(event"name"nicksizeof(nick));  

      
    
GetEventString(event"address"ipsizeof(ip));  
    
SplitString(ip":"ipsizeof(ip));  
      
    new 
String:country[45];   
    
GeoipCountry(ipcountrysizeof(country));

    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x03%s \x01connecting (%s)"nickcountry);  

    for (
1<= MaxClientsi++)  
    if(
IsClientInGame(i))  
    
PrintToChat(irawmsg);  
}  

public 
OnClientDisconnect(client)  
{  
    new 
String:ip[16], String:rawmsg[255], String:country[45];
    
GetClientIP(clientipsizeof(ip));  
    
GeoipCountry(ipcountrysizeof(country)); 
    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x03%N \x01disconnecting (%s)"clientcountry);   
    
PrintToChatAll(rawmsg); 

__________________

Last edited by 8guawong; 12-31-2018 at 03:28.
8guawong is offline
playhardloveenemy
Member
Join Date: Dec 2015
Old 12-31-2018 , 13:13   Re: [CS:S] Connect-Disconnect with county tag
Reply With Quote #5

Thank you!

It's working right now!
But can we add reason to the disconnect message ?
Like: Player X has left the game (country) (Disconnected by user.)
playhardloveenemy is offline
playhardloveenemy
Member
Join Date: Dec 2015
Old 12-31-2018 , 13:37   Re: [CS:S] Connect-Disconnect with county tag
Reply With Quote #6

I've made it working like this, but doesn't print the reason message:

PHP Code:
public OnClientDisconnect(client)  
{  
    new 
String:ip[16], String:rawmsg[255], String:reason[192], String:country[45];
    
GetClientIP(clientipsizeof(ip));  
    
GeoipCountry(ipcountrysizeof(country)); 
    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x04%N \x01has left the game (%s) (%s)"clientcountryreason);   
    
PrintToChatAll(rawmsg); 


Last edited by playhardloveenemy; 12-31-2018 at 13:37.
playhardloveenemy is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-31-2018 , 18:33   Re: [CS:S] Connect-Disconnect with county tag
Reply With Quote #7

not tested

PHP Code:
#pragma semicolon 1  
#include <sourcemod>  
#include <geoip>  

public Plugin:myinfo =  
{  
    
name "[KDLP] Game Events",  
    
author "KorDen",  
    
description "",  
    
version "1.0",  
    
url "dev.sky-play.ru"  
}  
public 
OnPluginStart()  
{  
    
HookEvent("player_connect"OnConnEventHookMode_Pre);  
    
HookEvent("player_disconnect"OnDisConnEventHookMode_Pre);  
}  

public 
Action:OnConn(Handle:event, const String:name[], bool:dontBroadcast)  
{  
    if (!
dontBroadcast)  
    
SetEventBroadcast(eventtrue);  
    new 
String:rawmsg[255], String:nick[MAX_NAME_LENGTH],  
    
String:steam[24], String:ip[16], String:reason[192];  
    new 
i;  
    
GetEventString(event"networkid"steamsizeof(steam));  
    
GetEventString(event"name"nicksizeof(nick));  

      
    
GetEventString(event"address"ipsizeof(ip));  
    
SplitString(ip":"ipsizeof(ip));  
      
    new 
String:country[45];   
    
GeoipCountry(ipcountrysizeof(country));

    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x03%s \x01connecting (%s)"nickcountry);  

    for (
1<= MaxClientsi++)  
    if(
IsClientInGame(i))  
    
PrintToChat(irawmsg);  
}

public 
Action:OnDisConn(Handle:event, const String:name[], bool:dontBroadcast)  
{  
    new 
String:rawmsg[255], String:ip[16], String:reason[192], String:country[45];   

    new 
client GetClientOfUserId(GetEventInt(event"userid"));      
    
GetClientIP(clientipsizeof(ip));  
    
GeoipCountry(ipcountrysizeof(country)); 

    
GetEventString(event"reason"reasonsizeof(reason));  

    
FormatEx(rawmsgsizeof(rawmsg), "\x01Player \x03%N \x01disconnecting (%s) (%s)"clientcountryreason);  

    
PrintToChatAll(rawmsg); 

__________________
8guawong is offline
playhardloveenemy
Member
Join Date: Dec 2015
Old 01-01-2019 , 04:23   Re: [CS:S] Connect-Disconnect with county tag
Reply With Quote #8

Thank you very much!
Works perfect!
Have an incredible 2019!
playhardloveenemy 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 13:51.


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