SA-MP Forums Archive
Please 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)
+--- Thread: Please Help (/showthread.php?tid=484885)



Please Help - Jivvles - 02.01.2014

Ok, So i am wondering if it is possible to make a /unban command which unban's both the player's IP and Name?


Re: Please Help - Spydah - 02.01.2014

That's of course possible use both variables in the command.


Re: Please Help - Jivvles - 02.01.2014

Yes but say if i had a command of /unban [ID] then that would unban his ip as well? if so is there any chance you could help by posting a command? that would be great if so?


Re: Please Help - Spydah - 02.01.2014

Show the /ban command, and give me the ipban vaeriable.


Re: Please Help - Jivvles - 02.01.2014

Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 3)
    {
        if(IsPlayerConnected(playerid))
        {
			new targetid,reason[105],string[128];
			if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
That is all i Have and not sure about the ip variable.


Re: Please Help - Spydah - 02.01.2014

Quote:
Originally Posted by Jivvles
Посмотреть сообщение
Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 3)
    {
        if(IsPlayerConnected(playerid))
        {
			new targetid,reason[105],string[128];
			if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
That is all i Have and not sure about the ip variable.
Could you please tell me where the variable is for the ban? I don't see anyone getting banned in there..


Re: Please Help - Jivvles - 02.01.2014

This is the whole cmd
Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 3)
    {
        if(IsPlayerConnected(playerid))
        {
			new targetid,reason[105],string[128];
			if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

            if(!IsPlayerNPC(targetid))
            {
				format(string, sizeof(string), "*"COL_RED" %s %s has banned %s"COL_WHITE" [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
				SendMessageToAllAdmins(string,-1);

				BanPlayer(targetid,reason,PlayerName(playerid));
			}
			else return SendClientMessage(playerid,-1,"*"COL_RED" You cannot ban an NPC, this has been logged and sent to the server emergency log list!");
		}
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" You do not have the right admin permissions for this command!");
	}
	return 1;
}
and I do not understand what variables you're talking about I only have stocks that have the word ban in them


Re: Please Help - Hansrutger - 02.01.2014

In your script search for "BanPlayer" and show that. Also do you use ini or mysql?


Re: Please Help - Jivvles - 02.01.2014

I use SQL as a saving system
and this is my stock
Код:
stock BanPlayer(playerid,reason[],admin[])
{
	BanEx(playerid, reason);
	new strs[1];
	format(strs,sizeof(strs), "%s", admin);
	return 1;
}



Re: Please Help - Hansrutger - 02.01.2014

Ah okay then it's not that big of a deal. You're basically Rcon banning someone and not using any kinds of saving system for it.

In your unban command you want to do the reverse "spell" of BanEx. That is /rcon unbanip [ip]*in game. To do this in the script you have to send a rcon message and that you do by doing this: https://sampwiki.blast.hk/wiki/SendRconCommand

Example of how to send it:
pawn Код:
new string[128];
format(string, sizeof(string), "unbanip %s", ipToUnban);
SendRconCommand(string);
Just make a sscanf in your command to tell the player to insert a string ipToUnban and you're more or less done, I think this is the way I did it at least. If any questions just ask.