Why does this kick EVERYONE?
#1

bad idea to test this when there's a fair amount of players in the server. But anyways this is suppose to kick the failed to login player. But it kicks everyone.

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
        new pName2[MAX_PLAYER_NAME];
    GetPlayerName(i, pName2, sizeof(pName2));

        if(!strcmp("[SU]BP13 || [BB]TouchmE",pName2,true))
        {
            continue;
        }
        else
        {
            new string [128];
            GetPlayerName(i, pName2, sizeof(pName2));
            format(string, sizeof(string), "KICKED: %s has been kicked. (Reason: Non RCON Player attempted a RCON login)", pName2);
            SendClientMessageToAll(COLOR_RED, string);
            SendClientMessage(i, COLOR_RED, "You are not allowed to log into rcon!");
            SendClientMessage(i, COLOR_RED, "REASON: YOU ARE NOT A RCON ADMIN! Bye Bye.");
            Kick(i);
        }
    }
    return 1;
}
Reply
#2

Код:
if(!strcmp("[SU]BP13 || [BB]TouchmE",pName2,true))
this script cant work...

make this:
Код:
if(!strcmp("[SU]BP13",pName2,true) || !strcmp("[BB]TouchmE",pName2,true))
i hope it will work
Reply
#3

That does not change it so it does not kick everyone.
Reply
#4

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
        new pName2[MAX_PLAYER_NAME];
        GetPlayerName(i, pName2, sizeof(pName2));
        if(!strcmp("[SU]BP13",pName2,true) || !strcmp("[BB]TouchmE",pName2,true))
        {
            continue;
        }
        new IP[56];
        GetPlayerIP(i, IP, 56);
        else if(!strcmp(IP, ip, true))
        {
            new string [128];
            GetPlayerName(i, pName2, sizeof(pName2));
            format(string, sizeof(string), "KICKED: %s has been kicked. (Reason: Non RCON Player attempted a RCON login)", pName2);
            SendClientMessageToAll(COLOR_RED, string);
            SendClientMessage(i, COLOR_RED, "You are not allowed to log into rcon!");
            SendClientMessage(i, COLOR_RED, "REASON: YOU ARE NOT A RCON ADMIN! Bye Bye.");
            Kick(i);
        }
    }
    return 1;
}
You must check if the players IP is the one that typed the rcon attempt or it's just going to kick all players regardless if they didn't do anything . I forgot if you had to strcmp IP's .
Reply
#5

Код:
C:\Documents and Settings\User\Desktop\SAMP Server\filterscripts\ladmin4v2.pwn(6984) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\SAMP Server\filterscripts\ladmin4v2.pwn(6984) : warning 215: expression has no effect
C:\Documents and Settings\User\Desktop\SAMP Server\filterscripts\ladmin4v2.pwn(6984) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
        new pName2[MAX_PLAYER_NAME];
    GetPlayerName(i, pName2, sizeof(pName2));
        if(!strcmp("[SU]BP13",pName2,true) || !strcmp("[BB]TouchmE",pName2,true))
        {
            continue;
        }
        new IP[56];
        GetPlayerIp(i, ip, sizeof(IP));
       
        else if(!strcmp(IP, ip, true)) //6984
        {
            new string [128];
            GetPlayerName(i, pName2, sizeof(pName2));
            format(string, sizeof(string), "KICKED: %s has been kicked. (Reason: Non RCON Player attempted a RCON login)", pName2);
            SendClientMessageToAll(COLOR_RED, string);
            SendClientMessage(i, COLOR_RED, "You are not allowed to log into rcon!");
            SendClientMessage(i, COLOR_RED, "REASON: YOU ARE NOT A RCON ADMIN! Bye Bye.");
            Kick(i);
        }
    }
    return 1;
}
I tried to fix it in a bunch of ways and I can't do it.
Reply
#6

Take of the else
Reply
#7

Quote:
Originally Posted by [HiC
TheKiller ]
Take of the else
lol had the same problem too.. he told me to erase the
pawn Код:
else
Thanks for this

Its not GetPlayerIP its GetPlayerIp
Reply
#8

Well this still is not working. I made this code. Will it kick everyone still? I do not want to test it again loosing about 30 players when I test it.


pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
        new pName2[MAX_PLAYER_NAME];
        GetPlayerName(i, pName2, sizeof(pName2));
        if(!strcmp("[SU]BP13",pName2,true) || !strcmp("[BB]TouchmE",pName2,true))
        {
            continue;
        }
        if(!strcmp("[SU]BP13",pName2,false) || !strcmp("[BB]TouchmE",pName2,false))
        {
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
        new pip[16];
        GetPlayerIp(i, pip, sizeof(pip));
        if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
        {
              new string [128];
                GetPlayerName(i, pName2, sizeof(pName2));
                format(string, sizeof(string), "KICKED: %s has been kicked. (Reason: Non RCON Player attempted a RCON login)", pName2);
                SendClientMessageToAll(COLOR_RED, string);
                SendClientMessage(i, COLOR_RED, "You are not allowed to log into rcon!");
                SendClientMessage(i, COLOR_RED, "REASON: YOU ARE NOT A RCON ADMIN!");
          Kick(i); //They are now kicked.
        }
      }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by [SU
BP13 ]
Well this still is not working. I made this code. Will it kick everyone still? I do not want to test it again loosing about 30 players when I test it.


pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
        new pName2[MAX_PLAYER_NAME];
        GetPlayerName(i, pName2, sizeof(pName2));
        if(!strcmp("[SU]BP13",pName2,true) || !strcmp("[BB]TouchmE",pName2,true))
        {
            continue;
        }
        if(!strcmp("[SU]BP13",pName2,false) || !strcmp("[BB]TouchmE",pName2,false))
        {
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
        new pip[16];
        GetPlayerIp(i, pip, sizeof(pip));
        if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
        {
              new string [128];
                GetPlayerName(i, pName2, sizeof(pName2));
                format(string, sizeof(string), "KICKED: %s has been kicked. (Reason: Non RCON Player attempted a RCON login)", pName2);
                SendClientMessageToAll(COLOR_RED, string);
                SendClientMessage(i, COLOR_RED, "You are not allowed to log into rcon!");
                SendClientMessage(i, COLOR_RED, "REASON: YOU ARE NOT A RCON ADMIN!");
          Kick(i); //They are now kicked.
        }
      }
    }
    return 1;
}
Well, lets just think about it, it loops through all the players and checks if the IP is the player that did the Rcon attempt. Yes, it will work.
Reply
#10

I figured you better than this lol.

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  new plip[16];
  if(success)return 1;
  for(new playerid;playerid<MAX_PLAYERS;playerid++)
  {
    if(!IsPlayerConnected(playerid))continue;
    GetPlayerIp(playerid,plip,sizeof(plip));
    if(!strcmp(plip,ip,false))
    {
      new pname[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pname,sizeof(pname));
      if(!strcmp(pname,"[SU]BP13",false)||!strcmp(pname,"[BB]TouchmE],false))return 1;
      kick(playerid);
      return 1;
    }
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)