/unbanplayer --Help!
#1

http://pastebin.com/m64427c43

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

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

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

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.
Reply
#5

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.
Reply
#6

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.
Reply
#7

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...
Reply
#8

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)