Junior Member
|
01-15-2021
, 02:36
MOTD Problem
|
#1
|
Hello ! I have this plugin for playedtime (it just select the playername and opens a motd with gametracker search), but I get an error in motd, it shous me only: -107. What would be the problem ?
PHP Code:
#include < amxmodx >
#include < amxmisc >
#define PLUGIN "GT Played Time"
#define VERSION "1.1.5"
new const g_szGameTracker[ ] = "http://www.gametracker.com/player";
new g_szServerIp[ 32 ];
new g_szCustomUrl[ 128 ];
public plugin_init( )
{
//--|Credits to Laurr for his idea. ( https://forums.alliedmods.net/showthread.php?t=220727 ).
register_plugin( PLUGIN, VERSION, "Askhanar" );
register_clcmd( "say", "HookClCmdSayOrSayTeam" );
register_clcmd( "say_team", "HookClCmdSayOrSayTeam" );
register_clcmd( "gt_playedtime", "ClCmdPlayedTime" );
//register_clcmd( "say /playedtime", "ClCmdSayPlayedTime" );
get_user_ip( 0, g_szServerIp, sizeof ( g_szServerIp ) -1, 0 ); //--| Ii luam ip la sv cu tot cu port!
// Add your code here...
}
public HookClCmdSayOrSayTeam( id )
{
static szArgs[ 192 ], szCommand[ 192 ];
read_args( szArgs, sizeof ( szArgs ) -1 );
if( !szArgs[ 0 ] )
return PLUGIN_CONTINUE;
remove_quotes( szArgs );
if( equal( szArgs, "/playedtime", strlen( "playetime" ) ) )
{
replace( szArgs, sizeof ( szArgs ) -1, "/", "" );
formatex( szCommand, sizeof ( szCommand ) -1, "gt_%s", szArgs );
client_cmd( id, szCommand );
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public ClCmdPlayedTime( id )
{
new szFirstArg[ 32 ];
read_argv( 1, szFirstArg, sizeof ( szFirstArg ) -1 );
if( equali( szFirstArg, "" ) )
DisplayPlayedTime( id, id );
else
{
new iPlayer = cmd_target( id, szFirstArg, 8 );
if(!iPlayer || iPlayer == id )
return PLUGIN_CONTINUE;
DisplayPlayedTime( id, iPlayer );
}
return PLUGIN_CONTINUE;
}
public DisplayPlayedTime( id, iPlayer )
{
new szName[ 32 ];
get_user_name( iPlayer, szName, sizeof ( szName ) -1 );
MakeNameSafe( szName, sizeof( szName ) -1 );
formatex( g_szCustomUrl, sizeof ( g_szCustomUrl ) -1, "%s/%s/%s/",
g_szGameTracker, szName, g_szServerIp );
show_motd( id, g_szCustomUrl );
}
MakeNameSafe( szName[ ], iLen )
{
replace_all( szName, iLen, "#", "%23" );
replace_all( szName, iLen, "?", "%3F" );
replace_all( szName, iLen, ":", "%3A" );
replace_all( szName, iLen, ";", "%3B" );
replace_all( szName, iLen, "/", "%2F" );
replace_all( szName, iLen, ",", "%2C" );
replace_all( szName, iLen, "$", "%24" );
replace_all( szName, iLen, "@", "%40" );
replace_all( szName, iLen, "+", "%2B" );
replace_all( szName, iLen, "=", "%3D" );
replace_all( szName, iLen, "®", "®" );
}
|
|