Raised This Month: $63 Target: $400
 15% 

Add country to connect message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nocky
Member
Join Date: Oct 2013
Old 11-08-2019 , 13:35   Add country to connect message
Reply With Quote #1

Hello guys, pleases i need help with add Country to connect message.

Code:
public Action:ev_PlayerConnect(Handle:event, const String:name[], bool:dontBroadcast)
{
	if (GetConVarBool(cvarBlockConnectMessage))
	{
		if (!dontBroadcast)
		{
			new iUserId = GetEventInt(event, "userid");
			new iClient = GetClientOfUserId(iUserId);
        	        new String:String:IP[99], String:Country[99];   // this is line 124
			
			if(!GeoipCountry(IP, Country, sizeof Country))
			{
        		Country = "Unknown Country";
    		        }  
        
			decl String:strNetworkId[50];
			GetEventString(event, "networkid", strNetworkId, sizeof(strNetworkId));
			decl String:strAddress[50];
			GetEventString(event, "address", strAddress, sizeof(strAddress));
			
			if (iClient != 0)
			{
				if (GetConVarInt(cvarAdminShowMessages) == 1)
				{
					for (new i = 1; i <= MaxClients; i++)
					{
						if (IsClientConnected(i) && IsClientInGame(i) && GetUserAdmin(i) != INVALID_ADMIN_ID)
						{
							PrintToChat(i,"%N has connected. (%s)", iClient, Country);
						}
					}
				}
			}
			
			SetEventBroadcast(event, true);
		}
	}
	return Plugin_Continue;
}

Error:
Code:
plugin.sp(124) : warning 217: loose indentation
plugin.sp(124) : error 001: expected token: "-identifier-", but found "-label-"
plugin.sp(124) : error 017: undefined symbol "IP"
plugin.sp(124) : warning 215: expression has no effect
plugin.sp(124) : error 001: expected token: ";", but found "]"
plugin.sp(124) : fatal error 190: too many error messages on one line

Last edited by Nocky; 11-08-2019 at 13:36.
Nocky is offline
Cruze
Veteran Member
Join Date: May 2017
Old 11-08-2019 , 13:55   Re: Add country to connect message
Reply With Quote #2

Use new syntax:
PHP Code:
public Action ev_PlayerConnect(Handle event, const char[] namebool dontBroadcast)
{
    if (
GetConVarBool(cvarBlockConnectMessage))
    {
        if (!
dontBroadcast)
        {
            
int iUserId GetEventInt(event"userid");
            
int iClient GetClientOfUserId(iUserId);
                    
char IP[99], Country[99];
            
            if(!
GeoipCountry(IPCountrysizeof Country))
            {
                
Country "Unknown Country";
                    }  
        
            
char strNetworkId[50];
            
GetEventString(event"networkid"strNetworkIdsizeof(strNetworkId));
            
char strAddress[50];
            
GetEventString(event"address"strAddresssizeof(strAddress));
            
            if (
iClient != 0)
            {
                if (
GetConVarInt(cvarAdminShowMessages) == 1)
                {
                    for (
int i 1<= MaxClientsi++)
                    {
                        if (
IsClientConnected(i) && IsClientInGame(i) && GetUserAdmin(i) != INVALID_ADMIN_ID)
                        {
                            
PrintToChat(i,"%N has connected. (%s)"iClientCountry);
                        }
                    }
                }
            }
            
            
SetEventBroadcast(eventtrue);
        }
    }
    return 
Plugin_Continue;

__________________
Taking paid private requests! Add me on steam!

Discord: Cruze#4947 | AlliedModders Releases | Github | Steam | PayPal
Cruze is offline
Reply


Thread Tools
Display Modes

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 03:01.


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