21.01.2013, 02:08
Hi, how what can I do so that every time an rcon admin login it will say: Admin "NAME" connected.
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;
}
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 Код:
|