Need Seriously Help
#1

Hello. I Need Help. My /unban CMD is not working. Need Help +REP.

Here's the Command:
Код:
CMD:unban(playerid,params[])
{
	if(sscanf(params,"s[128]",params)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /unabn [player_name]");
	new file[40];
	format(file, sizeof(file), USER_FILE);
	if(fexist(file))
	{
		INI_ParseFile(file, "Banned" .bExtra = true, .extra = b);
		if(b == 1)
		{
			b = 0;

		}
	}
	return 1;
}
and the ban CMD:
Код:
CMD:ban(playerid, params[])
{
    new targetid, reason[24];
    if(sscanf(params, "us[24]", targetid, reason)) return SendClientMessage(playerid, RED, "[USAGE]: /ban [name/id] [reason]");
    if(strlen(reason) < 1 || strlen(reason) > 24) return SendClientMessage(playerid, RED, "Your reason can only contain 1-24 characters.");
    if(PlayerInfo[playerid][aLevel] < 2) return SendClientMessage(playerid, RED, "Only admin level 2+ can use this command.");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not found.");
    if(PlayerInfo[targetid][aLevel] >= 8) return SendClientMessage(playerid, RED, "You cant ban admins.");
    if(IsPlayerNPC(targetid)) return SendClientMessage(playerid, RED, "You cant ban Elvis.");
    {
        PlayerInfo[targetid][Banned] = 1;
        format(fstr, sizeof(fstr), "Admin %s [%d] has banned %s [%d] from NVCNR - Reason: %s", GetName(playerid), playerid, GetName(targetid), targetid, reason);
        SendClientMessageToAll(RED, fstr);
        GameTextForPlayer(targetid, "~r~Banned", 5000, 5);
        format(fstr2, sizeof(fstr2), "You have been banned from NVCNR. You were banned by admin %s.", GetName(playerid));
        SendClientMessage(targetid, RED, fstr2);
        SendClientMessage(targetid, ORANGE, "If you think this ban is unfair post an appeal at www.nvcnr.net");

        for(new h = 0; h < MAX_HOUSES; h++)
        {
            if(!strcmp(GetHouseOwner(h), GetName(targetid), false))
            {
                SellHouse(h);
            }
        }
        for(new b = 0; b < MAX_BUSINESSES; b++)
        {
            if(!strcmp(BizInfo[b][bOwner], GetName(targetid), false))
            {
                SellBiz(b);
            }
        }

        UnloadPlayerVehicles(targetid);
        RemoveOwnedVehs(targetid);

        BanEx(targetid, fstr);
    }
    return true;
ERRORS:
}
Код:
C:\Documents and Settings\Haseeb\Desktop\NVCNRS\gamemodes\NVCNR.pwn(23637) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\Haseeb\Desktop\NVCNRS\gamemodes\NVCNR.pwn(23642) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Documents and Settings\Haseeb\Desktop\NVCNRS\gamemodes\NVCNR.pwn(23642) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Haseeb\Desktop\NVCNRS\gamemodes\NVCNR.pwn(23642) : error 017: undefined symbol "bExtra"
C:\Documents and Settings\Haseeb\Desktop\NVCNRS\gamemodes\NVCNR.pwn(23642) : fatal error 107: too many error messages on one line
Reply
#2

Hi,

You must define white color like this : #define COLOR_WHITE
Also define bExtra like this: #define bExtra
and show me line 23642.
Reply
#3

Add that at the begging of the script:
#define COLOR_ADMIN 0xFF0066FF
#define COLOR_RED 0xFF0000AA

Working Command:

Код:
CMD:unban(playerid,params[])
{
        if(pInfo[playerid][Adminlevel] < 4)return SendClientMessage(playerid,COLOR_RED,"[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command.");
        new targetid, string[128];//R = Reason
  new Query[500];

        if(sscanf(params, "u", targetid))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "Usage:{FFFFFF} /unban [ID] [Reason]");
            return 1;
        }
  if(pInfo[playerid][Adminlevel] ==3 )
  {
      SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command.");
      return 1;
  }
        if(pInfo[playerid][Adminlevel] >= 4 || IsPlayerAdmin(playerid))
  {
                pInfo[targetid][Banned] = 0;

                format(Query, sizeof(Query), "UPDATE users SET banned = %d WHERE username = '%s'",
            pInfo[targetid][Banned],
            targetid);
          db_query(DatabaseAcc, Query);

  format(string, sizeof(string), "[UN-BANNED] You have unbanned %s", targetid);
  SendClientMessage(playerid, COLOR_ADMIN, string);

     }
  return 1;
}
Reply
#4

Thanks Bro.its fixed now.
Reply
#5

GOOD
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)