Ban/Unban thing
#1

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.
Reply
#2

-cut- wait.
Reply
#3

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

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;
}
Reply
#5

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

@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..
Reply
#7

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
Reply
#8

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");
}
Reply
#9

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!
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)