Raised This Month: $51 Target: $400
 12% 

Add country to connect message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nocky
Member
Join Date: Oct 2013
Location: Czech Republic
Old 11-08-2019 , 12: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 12:36.
Nocky is offline
Cruze
Veteran Member
Join Date: May 2017
Old 11-08-2019 , 12: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! Contact me
Cruze 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 11:40.


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