[Include] OPRL.inc - OnPlayerRconLogin : Calls out when a player logs in as RCON, not an IP.
#3

It can be done without the need of a continuing timer and an array. I wrote this:
pawn Код:
#include <a_samp>
#include <foreach>

main() {}

public OnRconLoginAttempt(ip[], password[], success)
{
    if (success) SetTimerEx("RetrieveRconPlayer", 1000, false, "s", ip);
    return 1;
}

forward OnPlayerRconLogin(playerid);
public OnPlayerRconLogin(playerid)
{
    printf("OnPlayerRconLogin -> playerid (%i) has been RCON logged in!", playerid);
    return 1;
}

forward RetrieveRconPlayer(ip[]);
public RetrieveRconPlayer(ip[])
{
    new
        ip2[16];

    foreach(new i : Player)
    {
        GetPlayerIp(i, ip2, 16);
        if (!strcmp(ip, ip2) && IsPlayerAdmin(i))
        {
            CallRemoteFunction("OnPlayerRconLogin", "i", i);
        }
    }
    return 1;
}
and it works very well.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)