Admin %s connected. (Help) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Admin %s connected. (Help) (
/showthread.php?tid=409293)
Admin %s connected. (Help) -
RiChArD_A - 21.01.2013
Hi, how what can I do so that every time an rcon admin login it will say: Admin "NAME" connected.
Re: Admin %s connected. (Help) -
LarzI - 21.01.2013
- ignore; misread -
Re: Admin %s connected. (Help) -
Threshold - 21.01.2013
When he refers to 'login', I think he is speaking about logging into RCON. Besides, it's not likely that someone is going to already be logged into RCON, before they even connect. So OnPlayerConnect wouldn't be the best option, but your code is correct.
https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success == 1) //If the password was correct
{
new pip[16];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) //foreach is the better option
{
GetPlayerIp(i, pip, 16);
if(strcmp(ip, pip, false) == 0)
{
//Use code given above
new szName[ MAX_PLAYER_NAME ], szStr[ 41 ];
GetPlayerName(i, szName, MAX_PLAYER_NAME );
format( szStr, sizeof( szStr ), "Admin %s connected", szName );
SendClientMessageToAll( 0xFFFF00FF, szStr );
break;
}
}
}
}
return 1;
}
Take note, this may not always work correctly if there is more than one player with the same IP.
Re: Admin %s connected. (Help) -
LarzI - 21.01.2013
Quote:
Originally Posted by Lauder
Hi, how what can I do so that every time an rcon admin login it will say: Admin "NAME" connected.
|
Quote:
Originally Posted by BenzoAMG
When he refers to 'login', I think he is speaking about logging into RCON.
|
I totally misread his question, my bad!
Respuesta: Re: Admin %s connected. (Help) -
RiChArD_A - 21.01.2013
Quote:
Originally Posted by BenzoAMG
When he refers to 'login', I think he is speaking about logging into RCON. Besides, it's not likely that someone is going to already be logged into RCON, before they even connect. So OnPlayerConnect wouldn't be the best option, but your code is correct.
https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
pawn Код:
public OnRconLoginAttempt(ip[], password[], success) { if(success == 1) //If the password was correct { new pip[16]; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) //foreach is the better option { GetPlayerIp(i, pip, 16); if(strcmp(ip, pip, false) == 0) { //Use code given above new szName[ MAX_PLAYER_NAME ], szStr[ 41 ]; GetPlayerName(i, szName, MAX_PLAYER_NAME ); format( szStr, sizeof( szStr ), "Admin %s connected", szName ); SendClientMessageToAll( 0xFFFF00FF, szStr ); break; } } } } return 1; }
Take note, this may not always work correctly if there is more than one player with the same IP.
|
Working perfect. Thanks a lot +REP XD