SA-MP Forums Archive
[HELP] Unban CMD - 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)
+--- Thread: [HELP] Unban CMD (/showthread.php?tid=522429)



[HELP] Unban CMD - cleanboy - 27.06.2014

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


Re: [HELP] Unban CMD - cleanboy - 27.06.2014

any help please?


Re: [HELP] Unban CMD - ScripteRNaBEEL - 27.06.2014

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;
}



Re: [HELP] Unban CMD - cleanboy - 27.06.2014

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.



Re: [HELP] Unban CMD - ScripteRNaBEEL - 27.06.2014

show me the line no. (5002)


Re: [HELP] Unban CMD - ScripteRNaBEEL - 27.06.2014

at top or gamemode do this

pawn Код:
new PlayerInfo



Re: [HELP] Unban CMD - Beckett - 27.06.2014

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.


Re: [HELP] Unban CMD - BroZeus - 27.06.2014

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


Respuesta: [HELP] Unban CMD - Shura - 27.06.2014

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



Re: [HELP] Unban CMD - miguelangel988 - 27.06.2014

// 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;

}