View Single Post
GBLTeam
Senior Member
Join Date: Mar 2012
Location: Republic of Macedonia
Old 11-10-2019 , 06:50   Re: How to make this autoshow without cmd?
Reply With Quote #3

EDIT: FIXED
Thanks!


Like this?

PHP Code:
#include <sourcemod>
#include <multicolors>

#define PLUGIN_VERSION "1.1.0"

public Plugin myinfo =
{
    
name "Server Info",
    
author "EmreBulut",
    
description "Shows info about server.",
    
version PLUGIN_VERSION,
    
url "http://steamcommunity.com/id/emrebulut"
}
public 
OnClientPutInServer(client)
{
    
CreateTimer(5.0WelcomeMsgclient);
    
}

public 
Action:WelcomeMsg(Handle:timerany:client)
{
CMD_Info(clienttimer);

public 
Action:CMD_Info(clientargs)
{
    
char sBuffer[256];
    
GetConVarString(FindConVar("hostname"), sBuffer,sizeof(sBuffer));
    
CPrintToChat(client"{darkred}Server name :{default} %s"sBuffer)

    
int pieces[4];
    
int longip GetConVarInt(FindConVar("hostip"));
    
int port GetConVarInt(FindConVar("hostport"));
    
pieces[0] = (longip >> 24) & 0x000000FF;
    
pieces[1] = (longip >> 16) & 0x000000FF;
    
pieces[2] = (longip >> 8) & 0x000000FF;
    
pieces[3] = longip 0x000000FF;

    
char NetIP[32];
    
Format(NetIPsizeof(NetIP), "%d.%d.%d.%d:%d"pieces[0], pieces[1], pieces[2], pieces[3], port);  
    
CPrintToChat(client"{darkred}==============================================");
    
CPrintToChat(client"{darkred}Server IP: {default}%d.%d.%d.%d:%d"pieces[0], pieces[1], pieces[2], pieces[3], port)
    
    
decl String:AdminNames[MAXPLAYERS+1][MAX_NAME_LENGTH+1];
    new 
count 0;
    for(new 
<= GetMaxClients();i++)
    {
        if(
IsClientInGame(i))
        {
            new 
AdminId:AdminID GetUserAdmin(i);
            if(
AdminID != INVALID_ADMIN_ID)
            {
                
GetClientName(iAdminNames[count], sizeof(AdminNames[]));
                
count++;
            }
        } 
    }
    
decl String:buffer[1024];
    
ImplodeStrings(AdminNamescount","buffersizeof(buffer));
    
CPrintToChat(client"{darkred}Online admins:{default} %s"buffer);

    
GetNextMap(sBuffersizeof(sBuffer));
    
CPrintToChat(client"{darkred}Next map:{default} %s"sBuffer)

    
GetCurrentMap(sBuffersizeof(sBuffer));
    
CPrintToChat(client"{darkred}Current map:{default} %s"sBuffer)

    
int i_Minutes;
    
int i_Seconds;
    
int i_Time;
    if(
GetMapTimeLeft(i_Time) && i_Time 0)
    {
        
i_Minutes i_Time 60;
        
i_Seconds i_Time 60;
    }
    
Format(sBuffersizeof(sBuffer), "%d:%02d"i_Minutesi_Seconds);
    
CPrintToChat(client"{DarkRed}Timeleft:{default} %s"sBuffer)
}

stock bool IsValidPlayer(int clientbool alive false)
{
    if(
client >= && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))
    {
        return 
true;
    }
    return 
false;
}
stock bool IsPlayerAdmin(client)
{
    if (
GetAdminFlag(GetUserAdmin(client), Admin_Generic))
    {
        return 
true;
    }
    return 
false;

Show:

welcome.sp(22) : warning 213: tag mismatch
welcome.sp(45) : warning 234: symbol "GetMaxClients" is marked as deprecated: Use MaxClients variable instead.

Well 22 tag is the CMD_Info from your line.

Last edited by GBLTeam; 11-10-2019 at 08:30. Reason: Fixed it!
GBLTeam is offline
Send a message via MSN to GBLTeam Send a message via Skype™ to GBLTeam