[HELP] Unban CMD
#1

hello there, i got problem, i have the gm revolution survival and im intersted on that.. it has ban command but doesnt have unban, anyone can make unban cmd for it?

here is the code of ban cmd

Код:
CMD:ban(playerid, params[])
	{
	    new
	        giveplayerid,
	        szReason[32];

		if(sscanf(params, "us[32]", giveplayerid, szReason))
  		return SendClientMessage(playerid, RED, "[Database:]{FFFFFF} /ban [ID] [REASON]");

	    if(IsPlayerNPC(giveplayerid))
	        return SendClientMessage(playerid, RED, "[Database:]{FFFFFF} You cant kick npcs");

	    if(AccountInfo[playerid][pAdmin] >= 2) {
	        if(giveplayerid != INVALID_PLAYER_ID) {
	            new
	                sendername[MAX_PLAYER_NAME],
	                string[128],
	                giveplayer[MAX_PLAYER_NAME];

	            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
	            GetPlayerName(playerid, sendername, sizeof(sendername));

	            format(string, 128, "[Database:]{FFFFFF} [ADMIN] %s has banned %s! Reason: %s", sendername, giveplayer, szReason);
	            SendClientMessageToAll(RED, string);
	            Ban(giveplayerid);

	            new Hour, Minute, Second;
	            gettime(Hour, Minute, Second);
	            format(string,sizeof(string),"[%02d:%02d:%02d]%s has banned %s! Reason:%s",Hour,Minute,Second,sendername,giveplayer, szReason);
	            SaveIn("BanLog.txt",string);
	        }
	    }
	    return 1;
	}
+rep
Reply
#2

any help please?
Reply
#3

try this
pawn Код:
CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128];
        if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

        if( PlayerInfo[playerid][pBan] >= 1 )
        {
            PlayerInfo[playerid][pBan] = 0;
            print("OnPlayerOfflineLogin: Variables saved properly");
            format(string, 128, "[ADMIN] %s (IP:%s) was unbanned by %s.", params, PlayerInfo[playerid][pIP], GetPlayerNameEx(playerid));
            SendStaffMessage(COLOR_RED,string);
            new year, month,day;
            getdate(year, month, day);
            new playa[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
            format(string, sizeof(string), "[ADMIN] %s : was unbanned by %s.", params, playa);
            SendStaffMessage(COLOR_RED, string);
        }
        else
        {
            SendClientMessage( playerid, COLOR_WHITE, "Not a banned account or no such account was found!" );
        }
    }
    return 1;
}
Reply
#4

i try ur code..
i try to distinguish what is wrong but i cant find it..
error

Код:
C:\Users\Louis Alcosaba\Desktop\Revolution Survival\gamemodes\rs.pwn(5002) : error 017: undefined symbol "PlayerInfo"
C:\Users\Louis Alcosaba\Desktop\Revolution Survival\gamemodes\rs.pwn(5002) : warning 215: expression has no effect
C:\Users\Louis Alcosaba\Desktop\Revolution Survival\gamemodes\rs.pwn(5002) : error 001: expected token: ";", but found "]"
C:\Users\Louis Alcosaba\Desktop\Revolution Survival\gamemodes\rs.pwn(5002) : error 029: invalid expression, assumed zero
C:\Users\Louis Alcosaba\Desktop\Revolution Survival\gamemodes\rs.pwn(5002) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

show me the line no. (5002)
Reply
#6

at top or gamemode do this

pawn Код:
new PlayerInfo
Reply
#7

Quote:
Originally Posted by ScripteRNaBEEL
Посмотреть сообщение
at top or gamemode do this

pawn Код:
new PlayerInfo
What the hell are you saying, it will remove the error but it wont work, stop giving false information.
Reply
#8

in the command its banning the player using Ban() function
to remove it use UnBanip() function wiht SendRconCommand public
****** it to see how it works
Reply
#9

Locate the variable in your gamemode player, only they have shown an example

Код:
playerinfo
If unknown control + f search for the following and if so replace the PlayerInfo by Info

Код:
Info
Reply
#10

// Unbans a player (cleares the ban-time)

COMMAND:unban(playerid, params[])

{

// Setup local variables

new PlayerToUnban[24], Msg[128], Name[24];

new file[100], File:PFile, LineForFile[100];



// Send the command to all admins so they can see it

SendAdminText(playerid, "/unban", params);



// Check if the player has logged in

if (APlayerData[playerid][LoggedIn] == true)

{

// Check if the player's admin-level is at least 3

if (APlayerData[playerid][PlayerLevel] >= 5)

{

if (sscanf(params, "s[128]", PlayerToUnban))

SendClientMessage(playerid, 0xFF0000AA, "Usa: \"/unban <nombre del jugador>\"");

else

{

// Get the name of the admin

GetPlayerName(playerid, Name, sizeof(Name));



// Construct the complete filename for this player's account

format(file, sizeof(file), PlayerFile, PlayerToUnban);



// Check if the file exists

if (fexist(file))

{

PFile = fopen(file, io_append); // Open the playerfile for appending (this command only appends a new line to overwrite the bantime)



format(LineForFile, 100, "BanTime 0\r\n"); // Construct the line: "BanTime <0>"

fwrite(PFile, LineForFile); // And save it to the file



fclose(PFile); // Close the file



// Inform everybody else which player was unbanned

format(Msg, 128, "%s %s desbaneo al jugador %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name, PlayerToUnban);

SendClientMessageToAll(0x808080FF, Msg);

}

else

SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}No hay ningun nombre");

}

}

else

return 0;

}

else

return 0;



return 1;

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)