SA-MP Forums Archive
[HELP] server connect messages - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: [HELP] server connect messages (/showthread.php?tid=588662)



[HELP] server connect messages - XYZero - 11.09.2015

Code:
if(ServerInfo[ConnectMessages] == 1)
    {
        new mess[128], IP[128], ircMsg[128];
        GetPlayerIp(playerid,IP,sizeof(IP));
        if(PlayerInfo[playerid][Level] == 0)
        {
        format(string, sizeof(string), "*** %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerName, playerid, GetPlayerCountryName(playerid), IP);
        }
        else if(PlayerInfo[ playerid ][Level] == 1)
        {
        format(string, sizeof(string), "***[Level1] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerName, playerid, GetPlayerCountryName(playerid), IP);
        }
        else if(PlayerInfo[ playerid ][Level] == 2)
        {
        format(string,sizeof(string), "***[Level2] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerName, playerid, GetPlayerCountryName(playerid), IP);
        }
	else if(PlayerInfo[ playerid ][Level] == 3)
        {
        format(string,sizeof(string), "***[Level3] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerName, playerid, GetPlayerCountryName(playerid), IP);
        }
	else if(PlayerInfo[ playerid ][Level] == 4)
        {
        format(string,sizeof(string), "***[Level4] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerName, playerid, GetPlayerCountryName(playerid), IP);
        }
	else if(PlayerInfo[ playerid ][Level] == 5)
	{
	format(string,sizeof(string), "***[Level5] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerName, playerid, GetPlayerCountryName(playerid), IP);
	SendClientMessageToAll(green, string);
        printf(mess);
        }
        format(ircMsg, sizeof(ircMsg), "9*** %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]", PlayerName, playerid, GetPlayerCountryName(playerid), IP);
	IRC_GroupSay(gGroupID, IRC_CHANNEL, ircMsg);
    	TeleTime[playerid] = 0;
	Heal[playerid] = 0;
	}
hi, i'm still noob at script :'P well, the problems are: the messages not showing in server_log and not showing on the screen when someone join the server. (sorry for my bad english)


Re: [HELP] server connect messages - Michael B - 11.09.2015

You have to add these..
PHP Code:
SendClientMessageToAll(greenstring);
printf(mess); 
...at each particular case.


Re: [HELP] server connect messages - jlalt - 11.09.2015

try:
PHP Code:
if(ServerInfo[ConnectMessages] == 1)
    {
        new 
mess[128], IP[128], ircMsg[128];
        
GetPlayerIp(playerid,IP,sizeof(IP));
        if(
PlayerInfo[playerid][Level] == 0)
        {
        
format(stringsizeof(string), "*** %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        }
        else if(
PlayerInfoplayerid ][Level] == 1)
        {
        
format(stringsizeof(string), "***[Level1] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        }
        else if(
PlayerInfoplayerid ][Level] == 2)
        {
        
format(string,sizeof(string), "***[Level2] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        }
        else if(
PlayerInfoplayerid ][Level] == 3)
        {
        
format(string,sizeof(string), "***[Level3] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        }
        else if(
PlayerInfoplayerid ][Level] == 4)
        {
        
format(string,sizeof(string), "***[Level4] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        }
        else if(
PlayerInfoplayerid ][Level] == 5)
        {
        
format(string,sizeof(string), "***[Level5] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        }
        
SendClientMessageToAll(greenstring);
        
printf(mess);
        }
        
format(ircMsgsizeof(ircMsg), "9*** %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]"PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
IRC_GroupSay(gGroupIDIRC_CHANNELircMsg);
        
TeleTime[playerid] = 0;
        
Heal[playerid] = 0;
    } 



Re: [HELP] server connect messages - XYZero - 11.09.2015

@michaelb: i did but, still not showing in the server logs and screen
@jlalt: i got an errors


Re: [HELP] server connect messages - Bolex_ - 11.09.2015

try this
Quote:

public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has joined the server", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}

Quote:

public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
}
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}




Re: [HELP] server connect messages - Evocator - 11.09.2015

Seriously? Showing someone's IP for public isn't a great idea!


Re: [HELP] server connect messages - jlalt - 11.09.2015

PHP Code:
if(ServerInfo[ConnectMessages] == 1)
    {
        new 
mess[128], IP[128], ircMsg[128];
        
GetPlayerIp(playerid,IP,sizeof(IP));
        if(
PlayerInfo[playerid][Level] == 0) {
        
format(stringsizeof(string), "*** %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
SendClientMessageToAll(greenstring);
        
printf(mess);
        } else if(
PlayerInfoplayerid ][Level] == 1) {
        
format(stringsizeof(string), "***[Level1] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
SendClientMessageToAll(greenstring);
        
printf(mess);
        } else if(
PlayerInfoplayerid ][Level] == 2) {
        
format(string,sizeof(string), "***[Level2] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
SendClientMessageToAll(greenstring);
        
printf(mess);
        } else if(
PlayerInfoplayerid ][Level] == 3) {
        
format(string,sizeof(string), "***[Level3] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
SendClientMessageToAll(greenstring);
        
printf(mess);
        } else if(
PlayerInfoplayerid ][Level] == 4) {
        
format(string,sizeof(string), "***[Level4] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
SendClientMessageToAll(greenstring);
        
printf(mess);
        } else if(
PlayerInfoplayerid ][Level] == 5) {
        
format(string,sizeof(string), "***[Level5] %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]",PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
SendClientMessageToAll(greenstring);
        
printf(mess);
        }
        
format(ircMsgsizeof(ircMsg), "9*** %s [ID:%d] has joined the server. [ Country: %s | IP Address: %s ]"PlayerNameplayeridGetPlayerCountryName(playerid), IP);
        
IRC_GroupSay(gGroupIDIRC_CHANNELircMsg);
        
TeleTime[playerid] = 0;
        
Heal[playerid] = 0;
        } 
and be sure that ServerInfo[ConnectMessages] are 1 if you not sure try to remove it


Re: [HELP] server connect messages - XYZero - 11.09.2015

@scripter18: it all already exist in my gamemode, i just wanted to make different of connect messages for player and admin
@ralfie: to make player easy to catch ip of hacker when no admin online then give the ip to rcon to banned the hacker
@jlalt: i did and still not showing in the server log and screen
(sorry for my bad english)


Re: [HELP] server connect messages - Evocator - 11.09.2015

Quote:
Originally Posted by XYZero
View Post
@ralfie: to make player easy to catch ip of hacker when no admin online then give the ip to rcon to banned the hacker
Get the name and review the server log for the IP. Again there is no excuse to show someones IP for everyone.
If i knew a server that would show my IP for everyone, id never join it. More like 90% of the players wont.


Re: [HELP] server connect messages - Bolex_ - 11.09.2015

Than Try this

If you want put in on GM

Quote:

#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

//Defines
#define COLOR_JOIN 0x99FF9900

//News
new Params[4][8];
new FileData[7][128];

//FilterScript
public OnFilterScriptInit()
{
print("\n--------------------------------------------");
print("\n---------------------------------------------");
print("\n-----------------------------------------------");
print("\n-------------------------------------------------");
return 1;
}

public OnFilterScriptExit()
{
print("\n--------------------------------------------");
print("\n---------------------------------------------");
print("\n-----------------------------------------------");
print("\n-------------------------------------------------");
return 1;
}

public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_JOIN, "Loading Data Please Wait ...");
new Country[256];
GetPlayerCountry(playerid,Country);
new mess[256],IP[256];
GetPlayerIp(playerid,IP,sizeof(IP));
format(mess,sizeof(mess),"|-| Server |-| Player {FFFFFF} %s {4165FF} Join To Server {D64343} [ Country: %s | IP: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(play erid));
printf(mess);
SendClientMessageToAll(COLOR_JOIN,mess);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new Country[256];
GetPlayerCountry(playerid,Country);
new mess[256],IP[256];
GetPlayerIp(playerid,IP,sizeof(IP));
format(mess,sizeof(mess),"|-| Server |-| Player {FFFFFF} %s {4165FF} Exit To Server {D64343} [ Country: %s | IP: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(play erid));
printf(mess);
SendClientMessageToAll(COLOR_JOIN,mess);
return 1;
}
//Funtions
GetParams(Source[]){
new Destination[256];
new SLen=strlen(Source);
new at,pos=0,tp=0;
new tempo[256];

format(Params[0],sizeof(Params),"");
format(Params[1],sizeof(Params),"");
format(Params[2],sizeof(Params),"");
format(Params[3],sizeof(Params),"");


for(at=pos;at<=SLen;at++){
strmid(tempo,Source,at,at+1,sizeof(tempo));
if(!strcmp(tempo,".",true)){
if(tp<=10){
strmid(Destination,Source,pos,at,sizeof(Destinatio n));
format(Params[tp][0],256,"%s",Destination);
tp=tp+1;
}
pos=at+1;
}
}
return 1;
}
GetFileData(Source[]){
new Destination[256];
new SLen=strlen(Source);
new at,pos=0,tp=0;
new tempo[256];

format(FileData[0],sizeof(FileData),"");
format(FileData[1],sizeof(FileData),"");
format(FileData[2],sizeof(FileData),"");
format(FileData[3],sizeof(FileData),"");
format(FileData[4],sizeof(FileData),"");
format(FileData[5],sizeof(FileData),"");
format(FileData[6],sizeof(FileData),"");

for(at=pos;at<=SLen;at++){
strmid(tempo,Source,at,at+1,sizeof(tempo));
if(!strcmp(tempo,",",true)){
if(tp<=10){
strmid(Destination,Source,pos,at,sizeof(Destinatio n));
format(FileData[tp][0],256,"%s",Destination);
tp=tp+1;
}
pos=at+1;
}
}
return 1;
}

GetPlayerCountry(playerid,Country[256]){
new IPAddress[256];
new a,b,c,d,ipf;
new File:IPFile;
new Text[256],start,end;
GetPlayerIp(playerid,IPAddress,sizeof(IPAddress));
GetParams(IPAddress);
a=strval(Params[0]);
b=strval(Params[1]);
c=strval(Params[2]);
d=strval(Params[3]);
if(a==127 && b==0 && c==0 && d==1){
format(Country,sizeof(Country),"Localhost");
return 1;
}
ipf = (16777216*a) + (65536*b) + (256*c) + d;
if(!fexist("CountriesIPs/IPLIST.csv")) return SendClientMessage(playerid,0xFF0000FF,"Country file not found.");
IPFile=fopen("CountriesIPs/IPLIST.csv",io_read);
fread(IPFile,Text,sizeof(Text),false);
while(strlen(Text)>0){
GetFileData(Text);
start=strval(FileData[0]);
end=strval(FileData[1]);
if(ipf>=start && ipf<=end){
format(Country,sizeof(Country),"%s(%s)",FileData[6],FileData[5]);
fclose(IPFile);
return 1;
}
fread(IPFile,Text,sizeof(Text),false);
}
fclose(IPFile);
return 1;
}

GetPName(playerid){
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
#endif




Re: [HELP] server connect messages - jlalt - 11.09.2015

Quote:
Originally Posted by Ralfie
View Post
Get the name and review the server log for the IP. Again there is no excuse to show someones IP for everyone.
If i knew a server that would show my IP for everyone, id never join it. More like 90% of the players wont.
what do you think about to share the ip just for admins ? who are +1 and above?