SA-MP Forums Archive
/unbanplayer --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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /unbanplayer --Help! (/showthread.php?tid=97780)



/unbanplayer --Help! - AKA_Cross - 16.09.2009

http://pastebin.com/m64427c43

- its not geting the IP from the Users name or Sending the Message to Rcon "unbanip 0.0.0.0"...


Re: /unbanplayer --Help! - Calgon - 16.09.2009

You're trying to ENCODE the string which opens the user file?


Re: /unbanplayer --Help! - Chaprnks - 16.09.2009

You opened the file, although you didn't select the "IP" field from the account and save it to a variable.


Re: /unbanplayer --Help! - AKA_Cross - 16.09.2009

Quote:
Originally Posted by Calgon
You're trying to ENCODE the string which opens the user file?
i guess so, well ya i want it to go into the User File and get there IP.

Edit: i got it to get the IP with SendClientMessage, but it still isn't geting it in Rcon.


Re: /unbanplayer --Help! - Calgon - 16.09.2009

Quote:
Originally Posted by [VLV
Cross - (Venomous-VLV.com) ]
Quote:
Originally Posted by Calgon
You're trying to ENCODE the string which opens the user file?
i guess so, well ya i want it to go into the User File and get there IP.
You're also not defining anything for file. Use my code.

pawn Код:
dcmd_unban(playerid, params[])
{
    new name[MAX_PLAYER_NAME], string[128], string2[256];
    if (sscanf(params, "s", name))
    {
        SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - /unban [name]");
        SendClientMessage(playerid, COLOR_GREY, "Full name, this includes underscores. Also CaSe sEnSiTiVe.");
    }
    else
    {
      if(pStats[playerid][pAdmin] < 5)
      {
        SendClientMessage(playerid, COLOR_WHITE, BAD_ADMIN_MESSAGE);
        return 1;
      }
      else
      {
        format(string, sizeof(string), "CRP_Scriptfiles/Accounts/%s.ini", name);
        if(fexist(string))
        {
            string2 = dini_Get(string, "IP");
            format(string, sizeof(string), "unbanip %s", string2);
            SendRconCommand(string);
            format(string, sizeof(string), "You have successfully unbanned %s (IP: %s).", name, string2);
            SendClientMessage(playerid, COLOR_WHITE, string);
            SendRconCommand("reloadbans");
            SendClientMessage(playerid, COLOR_WHITE, "The bans list has been reloaded.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "Invalid name, the name was not recognized.");
        }
      }
   
    }
    return 1;
}
You'll want to change a few things, and fix the indentation.


Re: /unbanplayer --Help! - AKA_Cross - 17.09.2009

Quote:
Originally Posted by Calgon
Quote:
Originally Posted by [VLV
Cross - (Venomous-VLV.com) ]
Quote:
Originally Posted by Calgon
You're trying to ENCODE the string which opens the user file?
i guess so, well ya i want it to go into the User File and get there IP.
You're also not defining anything for file. Use my code.

pawn Код:
dcmd_unban(playerid, params[])
{
    new name[MAX_PLAYER_NAME], string[128], string2[256];
    if (sscanf(params, "s", name))
    {
        SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - /unban [name]");
        SendClientMessage(playerid, COLOR_GREY, "Full name, this includes underscores. Also CaSe sEnSiTiVe.");
    }
    else
    {
      if(pStats[playerid][pAdmin] < 5)
      {
        SendClientMessage(playerid, COLOR_WHITE, BAD_ADMIN_MESSAGE);
        return 1;
      }
      else
      {
        format(string, sizeof(string), "CRP_Scriptfiles/Accounts/%s.ini", name);
        if(fexist(string))
        {
            string2 = dini_Get(string, "IP");
            format(string, sizeof(string), "unbanip %s", string2);
            SendRconCommand(string);
            format(string, sizeof(string), "You have successfully unbanned %s (IP: %s).", name, string2);
            SendClientMessage(playerid, COLOR_WHITE, string);
            SendRconCommand("reloadbans");
            SendClientMessage(playerid, COLOR_WHITE, "The bans list has been reloaded.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "Invalid name, the name was not recognized.");
        }
      }
   
    }
    return 1;
}
You'll want to change a few things, and fix the indentation.
Ya, Thanks.


Re: /unbanplayer --Help! - AKA_Cross - 17.09.2009

pawn Код:
dcmd_unbanplayer(playerid, params[])
{
    new name[MAX_PLAYER_NAME], file[128], ip[256];
    if(PlayerInfo[playerid][Level] >= 5)
    {
        format(file, sizeof(file), "/vadmin/users/%s.sav", name);
        if (sscanf(params, "s", name))
        {
            return SendClientMessage(playerid, red, "USAGE: /unbanplayer [playername]");
        }
        else
        {
        if(fexist(file))
        {
            CMDMessageToAdmins(playerid,"UNBANPLAYER");
            ip = dini_Get(file, "IP");
            format(file, sizeof(file), "unbanip %s", ip);
            SendRconCommand(file);
            format(file, sizeof(file), "You have successfully unbanned %s (IP: %s).", name, ip);
            SendClientMessage(playerid, red, file);
            SendRconCommand("reloadbans");
            SendClientMessage(playerid, COLOR_WHITE, "The bans list has been reloaded.");
            dini_Set(file, "banned", "0");
        }
        else return SendClientMessage(playerid,red, "ERROR: This player doesnt have an account.");
      }
    }
    else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}
I type in the Name, and it says "ERROR: This player doesnt have an account." idk what im doing worng at this Point...


Re: /unbanplayer --Help! - Calgon - 17.09.2009

I'm not sure if this will work, but remove the "/" before "/vadmin.."


Re: /unbanplayer --Help! - AKA_Cross - 17.09.2009

Код:
if(!udb_Exists(file))

format(file,sizeof(file),"/vadmin/users/%s.sav",udb_encode(name));
Found it!