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

[CS:S] How to set up the Format and color in the my plug-in?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2389736818
Member
Join Date: Jul 2014
Location: China
Old 04-19-2018 , 00:00   [CS:S] How to set up the Format and color in the my plug-in?
Reply With Quote #1

What measures can be added or the.....

sp code
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <adminmenu>


#undef REQUIRE_EXTENSIONS
#include <93x_checkip>
#define REQUIRE_EXTENSIONS

#pragma newdecls required
ConVar g_cvEnabled;
int i_cvEnabled;

int g_OnClientPutInServer[MAXPLAYERS+1] = {false, ... };

public 
Plugin myinfo 
{
    
name "SM XnEt 93x IP Print",
    
author "bbs.93x.net Add More Translation By:2389736818",
    
description "<- Description ->",
    
version "1.6",
    
url "<- URL ->"
}

public 
void OnPluginStart()
{
    
LoadTranslations("93x_checkip.phrases"); 
    
g_cvEnabled CreateConVar("sm_93x_ip_print_enabled""2""1= show city 2 = show full 0 = disable");
    
i_cvEnabled GetConVarInt(g_cvEnabled);
    
HookConVarChange(g_cvEnabledHookConVar_Changed);
    
    
RegConsoleCmd("sm_ipcheck"checkplayerip);
    
    
AutoExecConfig(true);
    
    
HookEventEx("player_team",    Event_PlayerTeam);
}

public 
void HookConVar_Changed(ConVar convarchar[] oldValuechar[] newValue)
{
    if(
convar == g_cvEnabled)
        
    
i_cvEnabled view_as<int>(StringToInt(newValue));
}


public 
void OnClientPutInServer(int client)
{
    
g_OnClientPutInServer[client] = true;
}


public 
Action Event_PlayerTeam(Handle eventchar[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    if(!
client || !IsClientInGame(client) || IsFakeClient(client) || !g_OnClientPutInServer[client] || i_cvEnabled == 0)
    {
        return 
Plugin_Continue;
    }
    
    
CreateTimer(1.0TimerPostclient);
    
    return 
Plugin_Continue;
}





public 
Action TimerPost(Handle timer ,any client)
{
    if(!
client || !IsClientInGame(client) || IsFakeClient(client) || !g_OnClientPutInServer[client] || i_cvEnabled == 0) return;
    
    
char g_ip[32];
    
char g_city[128];
    
char g_network[64];
    
    
GetClientIP(clientg_ipsizeof(g_ip));
    
checkip_93x(g_ipg_citysizeof(g_city), g_networksizeof(g_network), 1);
    
    
g_OnClientPutInServer[client] = false;
    
    
    if(
i_cvEnabled !=&& i_cvEnabled ==1)
    {
        
PrintToChatAll("%t""Welcome message"clientg_cityg_network);
    }
    else if(
i_cvEnabled !=&& i_cvEnabled ==2)
    {
        
PrintToChatAll("%t""Welcome message Two"clientg_ipg_cityg_network);
    }
    
    
    
}


public 
Action checkplayerip(int clientint args)
{
    if(
client == 0)
    {
        
PrintToChat(client" \x04[SM] %t""Not use command RCON");
        return 
Plugin_Handled;
    }
    
    if(!
IsPlayerAdmin(client))
    {    
        
PrintToChat(client" \x04[SM] %t""Only OP can use set");
        return 
Plugin_Handled;
    }
    
    if(
args 1
    {
        
DisplayIPCheckMenu(client);
        return 
Plugin_Handled;
    }
    
    
char arg2[10];
    
    
GetCmdArg(2arg2sizeof(arg2));
    
    
    
    
char strTarget[32]; GetCmdArg(1strTargetsizeof(strTarget)); 
    
    
    
char strTargetName[MAX_TARGET_LENGTH]; 
    
int TargetList[MAXPLAYERS], TargetCount
    
bool TargetTranslate
    
    if ((
TargetCount ProcessTargetString(strTargetclientTargetListMAXPLAYERSCOMMAND_FILTER_CONNECTED
    
strTargetNamesizeof(strTargetName), TargetTranslate)) <= 0
    {
        
ReplyToTargetError(clientTargetCount); 
        return 
Plugin_Handled
    } 
    
    
    for (
int i 0TargetCounti++) 
    { 
        
int iClient TargetList[i]; 
        if (
IsClientInGame(iClient)) 
        {
            
char ipaddress[32];
            
char city[128];
            
char network[64];
            
GetClientIP(iClient,ipaddress,sizeof(ipaddress));
            
checkip_93x(ipaddresscitysizeof(city), networksizeof(network), 1);
            
PrintToChat(client"%t""Player IP network address"iClient,ipaddress,city,network);
            
PrintToChat(client"%t""Message only visible to me");
        }
    }
    
    return 
Plugin_Handled;
}




stock void DisplayIPCheckMenu(int client)
{
    
Handle menu CreateMenu(MenuHandler_IPCheckMenu);
    
SetMenuTitle(menu"%t""Query player IP information");
    
SetMenuExitBackButton(menutrue);
    
    
AddTargetsToMenu2(menu0COMMAND_FILTER_NO_BOTS);
    
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}


public 
int MenuHandler_IPCheckMenu(Handle menuMenuAction actionint param1int param2)
{
    switch (
action)
    {
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
        case 
MenuAction_Select:
        {
            
char info[32];
            
int target;
            
            
GetMenuItem(menuparam2infosizeof(info));
            
int userid StringToInt(info);
            
            if ((
target GetClientOfUserId(userid)) == 0)
            {
                
PrintToChat(param1" \x04[SM] %t""Player not available");
            }
            else
            {
                
char ipaddress[32];
                
char city[128];
                
char network[64];
                
GetClientIP(target,ipaddress,sizeof(ipaddress));
                
checkip_93x(ipaddresscitysizeof(city), networksizeof(network), 1);
                
PrintToChat(param1"%t""Player IP network address"target,ipaddress,city,network);
                
PrintToChat(param1"%t""Message only visible to me Two");
            }
        }
    }
}


stock bool IsPlayerAdmin(int client)
{
    if (
CheckCommandAccess(client"sm_ban"ADMFLAG_BANfalse))
    {
        return 
true;
    }
    return 
false;
    

translations
PHP Code:
"Phrases"
{
    
"Welcome message"
    
{
        
"en"        "x05Welcome\x01 \x04%N\x01 \x05Join Game => Come from \x01\x07%s%s\x01"
    
}

    
"Welcome message Two"
    
{
        
"en"        "\x05Welcome\x01 \x04%N\x01 \x05IP:%s => Come from \x01\x07%s%s\x01"
    
}

    
"Not use command RCON"
    
{
        
"en"        "Not use command RCON"
    
}

    
"Only OP can use set"
    
{
        
"en"        "Only OP can use has been set up"
    
}

    
"Player IP network address"
    
{
        
"en"        "Player:\x04%N\x01 \x05IP address:%s Come from:%s Network Type:%s"
    
}

    
"Message only visible to me"
    
{
        
"en"        "Tips:These messages are only visible to me"
    
}

    
"Query player IP information"
    
{
        
"en"        "Query the player's IP information."
    
}

    
"Player not available"
    
{
        
"en"        "Player no longer available."
    
}

    
"Player IP network address Two"
    
{
        
"en"        "Player:\x04%N\x01 \x05IP address:%s Come from:%s Network Type:%s"
    
}

    
"Message only visible to me Two"
    
{
        
"en"        "Tips:These messages are only visible to me"
    
}

Attached Files
File Type: zip SM XnEt 93x IP Print.zip (4.82 MB, 95 views)
File Type: sp Get Plugin or Get Source (93x_checkip.sp - 103 views - 4.9 KB)
__________________

Last edited by 2389736818; 04-19-2018 at 06:12.
2389736818 is offline
2389736818
Member
Join Date: Jul 2014
Location: China
Old 04-19-2018 , 05:26   Re: [CSGO] How to set up the Format and color in the my plug-in?
Reply With Quote #2

I succeeded in testing but the color did not display,How to modify?

__________________

Last edited by 2389736818; 04-19-2018 at 05:27.
2389736818 is offline
2389736818
Member
Join Date: Jul 2014
Location: China
Old 04-19-2018 , 06:12   Re: [CSGO] How to set up the Format and color in the my plug-in?
Reply With Quote #3

I succeeded but the color didn't show.

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <multicolors>
#include <adminmenu>


#undef REQUIRE_EXTENSIONS
#include <93x_checkip>
#define REQUIRE_EXTENSIONS

#pragma newdecls required
ConVar g_cvEnabled;
int i_cvEnabled;

int g_OnClientPutInServer[MAXPLAYERS+1] = {false, ... };

public 
Plugin myinfo 
{
    
name "SM XnEt 93x IP Print",
    
author "bbs.93x.net Add More Translation By:2389736818",
    
description "<- Description ->",
    
version "1.6",
    
url "<- URL ->"
}

public 
void OnPluginStart()
{
    
LoadTranslations("93x_checkip.phrases"); 
    
g_cvEnabled CreateConVar("sm_93x_ip_print_enabled""2""1= show city 2 = show full 0 = disable");
    
i_cvEnabled GetConVarInt(g_cvEnabled);
    
HookConVarChange(g_cvEnabledHookConVar_Changed);
    
    
RegConsoleCmd("sm_ipcheck"checkplayerip);
    
    
AutoExecConfig(true);
    
    
HookEventEx("player_team",    Event_PlayerTeam);
}

public 
void HookConVar_Changed(ConVar convarchar[] oldValuechar[] newValue)
{
    if(
convar == g_cvEnabled)
        
    
i_cvEnabled view_as<int>(StringToInt(newValue));
}


public 
void OnClientPutInServer(int client)
{
    
g_OnClientPutInServer[client] = true;
}


public 
Action Event_PlayerTeam(Handle eventchar[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    if(!
client || !IsClientInGame(client) || IsFakeClient(client) || !g_OnClientPutInServer[client] || i_cvEnabled == 0)
    {
        return 
Plugin_Continue;
    }
    
    
CreateTimer(1.0TimerPostclient);
    
    return 
Plugin_Continue;
}





public 
Action TimerPost(Handle timer ,any client)
{
    if(!
client || !IsClientInGame(client) || IsFakeClient(client) || !g_OnClientPutInServer[client] || i_cvEnabled == 0) return;
    
    
char g_ip[32];
    
char g_city[128];
    
char g_network[64];
    
    
GetClientIP(clientg_ipsizeof(g_ip));
    
checkip_93x(g_ipg_citysizeof(g_city), g_networksizeof(g_network), 1);
    
    
g_OnClientPutInServer[client] = false;
    
    
    if(
i_cvEnabled !=&& i_cvEnabled ==1)
    {
        
CPrintToChatAll("%t""Welcome message"clientg_cityg_network);
    }
    else if(
i_cvEnabled !=&& i_cvEnabled ==2)
    {
        
CPrintToChatAll("%t""Welcome message Two"clientg_ipg_cityg_network);
    }
    
    
    
}


public 
Action checkplayerip(int clientint args)
{
    if(
client == 0)
    {
        
CPrintToChat(client" \x04[SM] %t""Not use command RCON");
        return 
Plugin_Handled;
    }
    
    if(!
IsPlayerAdmin(client))
    {    
        
CPrintToChat(client" \x04[SM] %t""Only OP can use set");
        return 
Plugin_Handled;
    }
    
    if(
args 1
    {
        
DisplayIPCheckMenu(client);
        return 
Plugin_Handled;
    }
    
    
char arg2[10];
    
    
GetCmdArg(2arg2sizeof(arg2));
    
    
    
    
char strTarget[32]; GetCmdArg(1strTargetsizeof(strTarget)); 
    
    
    
char strTargetName[MAX_TARGET_LENGTH]; 
    
int TargetList[MAXPLAYERS], TargetCount
    
bool TargetTranslate
    
    if ((
TargetCount ProcessTargetString(strTargetclientTargetListMAXPLAYERSCOMMAND_FILTER_CONNECTED
    
strTargetNamesizeof(strTargetName), TargetTranslate)) <= 0
    {
        
ReplyToTargetError(clientTargetCount); 
        return 
Plugin_Handled
    } 
    
    
    for (
int i 0TargetCounti++) 
    { 
        
int iClient TargetList[i]; 
        if (
IsClientInGame(iClient)) 
        {
            
char ipaddress[32];
            
char city[128];
            
char network[64];
            
GetClientIP(iClient,ipaddress,sizeof(ipaddress));
            
checkip_93x(ipaddresscitysizeof(city), networksizeof(network), 1);
            
CPrintToChat(client"%t""Player IP network address"iClient,ipaddress,city,network);
            
CPrintToChat(client"%t""Message only visible to me");
        }
    }
    
    return 
Plugin_Handled;
}




stock void DisplayIPCheckMenu(int client)
{
    
Handle menu CreateMenu(MenuHandler_IPCheckMenu);
    
SetMenuTitle(menu"%t""Query player IP information");
    
SetMenuExitBackButton(menutrue);
    
    
AddTargetsToMenu2(menu0COMMAND_FILTER_NO_BOTS);
    
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}


public 
int MenuHandler_IPCheckMenu(Handle menuMenuAction actionint param1int param2)
{
    switch (
action)
    {
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
        case 
MenuAction_Select:
        {
            
char info[32];
            
int target;
            
            
GetMenuItem(menuparam2infosizeof(info));
            
int userid StringToInt(info);
            
            if ((
target GetClientOfUserId(userid)) == 0)
            {
                
CPrintToChat(param1" \x04[SM] %t""Player not available");
            }
            else
            {
                
char ipaddress[32];
                
char city[128];
                
char network[64];
                
GetClientIP(target,ipaddress,sizeof(ipaddress));
                
checkip_93x(ipaddresscitysizeof(city), networksizeof(network), 1);
                
CPrintToChat(param1"%t""Player IP network address"target,ipaddress,city,network);
                
CPrintToChat(param1"%t""Message only visible to me Two");
            }
        }
    }
}


stock bool IsPlayerAdmin(int client)
{
    if (
CheckCommandAccess(client"sm_ban"ADMFLAG_BANfalse))
    {
        return 
true;
    }
    return 
false;
    

PHP Code:
"Phrases"
{
    
"Welcome message"
    
{
        
"en"        "{default}Welcome{brown} {orange}%N{default} {default}Join Game => Come from {brown}{default}%s%s{brown}"
    
}

    
"Welcome message Two"
    
{
        
"en"        "{default}Welcome{brown} {orange}%N{brown} {default}IP:%s => Come from {brown}{default}%s%s{brown}"
    
}

    
"Not use command RCON"
    
{
        
"en"        "Not use command RCON"
    
}

    
"Only OP can use set"
    
{
        
"en"        "Only OP can use has been set up"
    
}

    
"Player IP network address"
    
{
        
"en"        "Player:{orange}%N{brown} {default}IP address:%s Come from:%s Network Type:%s"
    
}

    
"Message only visible to me"
    
{
        
"en"        "Tips:These messages are only visible to me"
    
}

    
"Query player IP information"
    
{
        
"en"        "Query the player's IP information."
    
}

    
"Player not available"
    
{
        
"en"        "Player no longer available."
    
}

    
"Player IP network address Two"
    
{
        
"en"        "Player:{orange}%N{brown} {default}IP address:%s Come from:%s Network Type:%s"
    
}

    
"Message only visible to me Two"
    
{
        
"en"        "Tips:These messages are only visible to me"
    
}

Attached Thumbnails
Click image for larger version

Name:	@_58_0~@_%WJTZ3`K~LY8~T.png
Views:	82
Size:	65.8 KB
ID:	169401  
__________________

Last edited by 2389736818; 04-19-2018 at 06:17.
2389736818 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 07:06.


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