Admin login script
#1

Hey,

I wanna make a script which gives the player who logged in into rcon full armour and full health.

so ia made this:
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        new pip[16];
       
        GetPlayerIp(i, pip, sizeof(pip));
   
        if (!success)
        {
            if (!strcmp(ip, pip, true))
            {
                SendClientMessage(i, RED, "SERVER: Falsches Passwort");
                Kick(i);
            }
        }
        else
        {
                SendClientMessage(i, YELLOW, "*** Dir stehen jetzt neue Adminbefehle zur Verfьgung.");
               
                SetPlayerHealth(i, 100);
                SetPlayerArmour(i, 100);
        }
    }
    return 1;
}
but if an admin loggs in, then a message gets sent to every player and not only to the admin.

whats wrong?
Reply
#2

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
for (new i=0; i<MAX_PLAYERS; i++)
{
new pip[16];

GetPlayerIp(i, pip, sizeof(pip));

if (!success)
{
if (!strcmp(ip, pip, true))
{
SendClientMessage(playerid, RED, "SERVER: Falsches Passwort");
Kick(i);
}
}
else
{
SendClientMessage(playerid, YELLOW, "*** Dir stehen jetzt neue Adminbefehle zur Verfьgung.");

SetPlayerHealth(i, 100);
SetPlayerArmour(i, 100);
}
}
return 1;
}
Reply
#3

okay.
I'll try that.


//EDIT:
i tried and got an error:

Quote:

error 017: undefined symbol "playerid"

Reply
#4

Change playerid to: i
Reply
#5

use this: public OnRconLoginAttempt(ip[], password[], success,playerid) *not sure if it works but i think it would*
Reply
#6

Quote:
Originally Posted by WackoX
Change playerid to: i
That was my old script... i used i and everyone got the message.

Quote:
Originally Posted by FuTuRe`
use this: public OnRconLoginAttempt(ip[], password[], success,playerid) *not sure if it works but i think it would*
new error with that:
Quote:

error 025: function heading differs from prototype

Reply
#7

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        new pip[16];
        GetPlayerIp(i, pip, sizeof(pip));
        if (!strcmp(ip, pip, true))
        {
            if (!success)
            {
                SendClientMessage(i, RED, "SERVER: Falsches Passwort");
                Kick(i);
            }
            else
            {
                SendClientMessage(i, YELLOW, "*** Dir stehen jetzt neue Adminbefehle zur Verfьgung.");

                SetPlayerHealth(i, 100);
                SetPlayerArmour(i, 100);
            }
        }
    }
    return 1;
}
Reply
#8

It works

thank ya man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)