SA-MP Forums Archive
Ban/Unban thing - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Ban/Unban thing (/showthread.php?tid=276386)



Ban/Unban thing - tarez - 13.08.2011

Aight well I'm a starter at scripting.. so ye

I need to make it so that it saves the person's IP inside the ini folder, and when I use the ban command on that person's name, it bans the IP. And when I use the unban command, it unbans the IP (without being online, of course).

It'll probably be easy for most of you out there.. so be patient with me <3

/Ban command
Код:
COMMAND:ban(playerid,params[])
{
	new id,reason[80];
	if(PlayerInfo[playerid][pAdminLevel] <1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command");
	if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE:/ban [playerid] [reason]");
	format(String,sizeof(String) ,"%s has been banned by admin %s. Reason: %s", Name[id], Name[playerid], reason);
	SendClientMessageToAll(COLOR_ORANGE, String);
	SendClientMessage(id, COLOR_RED, "You've been banned from the server.");
	Ban(id);
	return 1;
}
/Unban command
Код:
Wtf I do here <3
And finally the thingies from player files.
Код:
    PlayerInfo[playerid][pLevel]
    PlayerInfo[playerid][pAdminLevel]
    PlayerInfo[playerid][pScore]
    PlayerInfo[playerid][pCash]
    PlayerInfo[playerid][pWarns]
And no, it's not made by me.. I used an admin system already made a bit.


Re: Ban/Unban thing - Riddick94 - 13.08.2011

-cut- wait.


Re: Ban/Unban thing - tarez - 13.08.2011

Bump, still need help.. Tried doing it myself but without success.


Re: Ban/Unban thing - Kitten - 13.08.2011

pawn Код:
CMD:unbanip(playerid,params[])
{
    new pIp[32],str[64];
// Do your admin || saving stuff here
    format(str,sizeof(str),"unbanip %s",pIp);
    SendRconCommand(str);
    SendRconCommand("reloadbans");
    return 1;
}



Re: Ban/Unban thing - Raimis_R - 13.08.2011

pawn Код:
COMMAND:unbanip(playerid, params[])
{
    new
        str[30];
    format(str, 30, "unbanip %s", params);
    SendRconCommand(str);
    SendRconCommand("reloadbans");
    return true;
}



Re: Ban/Unban thing - tarez - 13.08.2011

@Kitten
Aight aight I get most of it, but how do I get the players IP (If it doesn't get it already..)? If I find out how to do that, I'll be able to do teh rest of the simple shit..


Re: Ban/Unban thing - Kitten - 13.08.2011

Quote:
Originally Posted by tarez
Посмотреть сообщение
@Kitten
Aight aight I get most of it, but how do I get the players IP (If it doesn't get it already..)? If I find out how to do that, I'll be able to do teh rest of the simple shit..
https://sampwiki.blast.hk/wiki/GetPlayerIp


Re: Ban/Unban thing - tarez - 13.08.2011

Quote:
Originally Posted by Kitten
Посмотреть сообщение
I love you <3

So quick question.. This should work?

Код:
COMMAND:unbanip(playerid,param[])
{
	new pIp[32], str[64];
	GetPlayerIp(playerid, pIp, sizeof(pIp));
	format(str, sizeof(str), "unbanip %s", pIp);
	SendRconCommand(str);
	SendRconCommand("ReloadBans");
}



Re: Ban/Unban thing - Raimis_R - 13.08.2011

Quote:
Originally Posted by tarez
Посмотреть сообщение
I love you <3

So quick question.. This should work?

Код:
COMMAND:unbanip(playerid,param[])
{
	new pIp[32], str[64];
	GetPlayerIp(playerid, pIp, sizeof(pIp));
	format(str, sizeof(str), "unbanip %s", pIp);
	SendRconCommand(str);
	SendRconCommand("ReloadBans");
}
If you are banned from the server how you can type this command I.G and unban yourself? Its Not logic!


Re: Ban/Unban thing - tarez - 13.08.2011

Ahh fuck I didn't look at what I was doing.. Won't work lol D: