Skocz do zawartości
Headshotplay

[Rozwiązane] Prośba o aktualizację pluginu

Rekomendowane odpowiedzi

Witam,

Czy mógłby ktoś aktualizować ten plugin ?

 

Cytat

L 03/21/2019 - 19:41:27: [SM] Exception reported: Could not send a usermessage L 03/21/2019 - 19:41:27: [SM] Blaming: connectmessage (1).smx L 03/21/2019 - 19:41:27: [SM] Call stack

trace: L 03/21/2019 - 19:41:27: [SM] [0] PrintToChat L 03/21/2019 - 19:41:27: [SM] [1] Line 386, C:\Users\dell\Desktop\scripting\include\halflife.inc::PrintToChatAll L 03/21/2019 - 19:41:27: [SM] [2] Line 68, C:\Users\dell\Desktop\scripting\connectmessage (1).sp::OnClientDisconnect

 

kod:
 

Cytat

#include <sourcemod>
#include <geoip>
#pragma tabsize 0

new Handle:h_connectmsg = INVALID_HANDLE;
new Handle:h_disconnectmsg = INVALID_HANDLE;

public Plugin:myinfo = 
{
    name = "Connect MSG",
    author = "Crazy",
    description = "Provides Info of the player when he joins",
    version = "1.0",
    url = ""
};

public OnPluginStart()
{    
    h_connectmsg = CreateConVar("sm_connectmsg", "1", "Shows a connect message in the chat once a player joins.", FCVAR_NOTIFY | FCVAR_DONTRECORD);
    h_disconnectmsg = CreateConVar("sm_disconnectmsg", "1", "Shows a disconnect message in the chat once a player leaves.", FCVAR_NOTIFY | FCVAR_DONTRECORD);
}

public OnClientPutInServer(client)
{
    new Connect = GetConVarInt(h_connectmsg);
    if(Connect == 1)
    {
        new String:name[99], String:authid[99], String:IP[99], String:Country[99];
        
        GetClientName(client, name, sizeof(name));
        
        GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
        
        GetClientIP(client, IP, sizeof(IP), true);
        
    if(!GeoipCountry(IP, Country, sizeof Country))
    {
        Country = "Unknown Country";
    }  
        PrintToChatAll(" \x04[CONNECT]\x03 %s (%s) dołączył na serwer z [%s]", name, authid, Country);
        
    } else {
  
    CloseHandle(h_connectmsg);
   }
}

public OnClientDisconnect(client)
{
    new Disconnect = GetConVarInt(h_disconnectmsg);
    if(Disconnect == 1)
    
    {
        new String:name[99], String:authid[99], String:IP[99], String:Country[99];
        
        GetClientName(client, name, sizeof(name));
        
        GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
        
        GetClientIP(client, IP, sizeof(IP), true);
        
    if(!GeoipCountry(IP, Country, sizeof Country))
    
    {
        Country = "Unknown Country";
    }
    
        PrintToChatAll(" \x04[DISCONNECT]\x03 %s (%s) wyszedł z serwera z [%s]", name, authid, Country);
        
    } else {
    
    CloseHandle(h_disconnectmsg);
}

}

 

Cytat

Stack Trace

Function

0sourcemod.2.csgo.so!UTIL_SendHudText [cstrike15_usermessages.pb.h:7770 + 0x0] 

1sourcemod.2.csgo.so!ShowHudText [smn_hudtext.cpp:490 + 0x14] 

 

Edytowane przez Headshotplay

Udostępnij tę odpowiedź


Odnośnik do odpowiedzi
Udostępnij na innych stronach
Spoiler

#include <sourcemod>
#include <geoip>
#include <multicolors>
#pragma tabsize 0

#pragma newdecls required
#pragma semicolon 1

Handle h_connectmsg = INVALID_HANDLE;
Handle h_disconnectmsg = INVALID_HANDLE;

public Plugin myinfo = 
{
	name = "Connect MSG",
	author = "Crazy",
	description = "Provides Info of the player when he joins",
	version = "1.0",
	url = ""
};

public void OnPluginStart()
{	
	h_connectmsg = CreateConVar("sm_connectmsg", "1", "Shows a connect message in the chat once a player joins.", FCVAR_NOTIFY | FCVAR_DONTRECORD);
	h_disconnectmsg = CreateConVar("sm_disconnectmsg", "1", "Shows a disconnect message in the chat once a player leaves.", FCVAR_NOTIFY | FCVAR_DONTRECORD);
}

public void OnClientPutInServer(int client)
{
	int Connect = GetConVarInt(h_connectmsg);
	if(Connect == 1)
	{
	
	char name[99];
	char authid[99];
	char IP[99];
	char Country[99];
		
	GetClientName(client, name, sizeof(name));
	GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
	GetClientIP(client, IP, sizeof(IP), true);
		
	if(!GeoipCountry(IP, Country, sizeof Country))
	{
		Country = "Nieznany kraj";
	}  
	
		CPrintToChatAll("{lightred}%s (%s) {yellow}dołączył do serwera z {lightred}[%s]", name, authid, Country); 
		
	} else {
	
		CloseHandle(h_connectmsg);
	}
}

public void OnClientDisconnect(int client)
{
	int Disconnect = GetConVarInt(h_disconnectmsg);
	if(Disconnect == 1)
	{
	
	char name[99];
	char authid[99];
	char IP[99];
	char Country[99];
		
	GetClientName(client, name, sizeof(name));
	GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
	GetClientIP(client, IP, sizeof(IP), true);
		
	if(!GeoipCountry(IP, Country, sizeof Country))
	{
        Country = "Nieznany kraj";
	}
	
		CPrintToChatAll("{lightred} %s (%s) {yellow}opuścił serwer z {lightred}[%s]", name, authid, Country);
		
    } else {
	
		CloseHandle(h_disconnectmsg);
	}
}

 

?

Udostępnij tę odpowiedź


Odnośnik do odpowiedzi
Udostępnij na innych stronach

Wiadomość wygenerowana automatycznie

 

Pomoc udzielona

Udostępnij tę odpowiedź


Odnośnik do odpowiedzi
Udostępnij na innych stronach
Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.

×
×
  • Dodaj nową pozycję...