23.12.2012, 19:21
(
Последний раз редактировалось GoldZoroGrab; 09.06.2013 в 20:59.
)
Hey Guys....
I Will Show You How To Create A Simple Ban System By Rcon Admins
Add This In The Top Of The Script if you don't have one like it
Step One:
Step Two:
Step Three:
Step 4:
We Added
Before the if(SInfo[playerid][banned]) because first it loads the stats then check if player is banned
Step 5:
If You Found Any Bug. Inform Me
To UnBan A Playeer goto the scriptfile - playeruser then PlayerBanned = 0
SSCANF = https://sampforum.blast.hk/showthread.php?tid=120356
ZCMD = https://sampforum.blast.hk/showthread.php?tid=91354
YINI = https://sampforum.blast.hk/showthread.php?tid=175565
I Will Show You How To Create A Simple Ban System By Rcon Admins
Add This In The Top Of The Script if you don't have one like it
pawn Код:
#define PATH "/Users/%s.ini"
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <YSI\y_ini>
//Note: Gonna Give You Includes Link In The End Of The Post [Don't Copy This Note BTW lol]
pawn Код:
enum PlayerInfo
{
Banned
};
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Banned",SInfo[playerid][Banned]);
return 1;
}
//Note: Here So We Can Make The Banned To Save The Stats ;)
//Note: Put This Above The Command That I'll Show Below[Don't Copy This Note BTW lol]
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}//Thats Also To Read And Load The Player Stats (we Added only ban) so it will load only ban
pawn Код:
command(ban, playerid, params[])
{
if(IsPlayerAdmin(playerid))//RCON
{
new ID, R[25], string[100];//R = Reason
new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
if(sscanf(params, "is", ID, R)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /ban [ID] [Reason]");
{
if(ID != INVALID_PLAYER_ID)
{
SInfo[ID][Banned]=1;//To Make Player Banned When He Connect It Kick Him
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(ID, name2, sizeof(name2));
format(string, sizeof(string), "%s[%d] has been banned By The Admin %s[%d] - %s", ID,name2, playerid, name, R);
SendClientMessageToAll(0xFF1493FF, string);
Kick(ID);
}
else SendClientMessage(playerid, 0xFF0000AA, "ID Not Connected.");
}
}
else SendClientMessage(playerid, 0xFF0000AA, "Only Admins Can Use This COmmand.");
We Added
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
pawn Код:
public OnPlayerConnect(playerid)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);//Thats Hard To Explain, Just To Load The Data
if(SInfo[playerid][Banned]==1)
{
SendClientMessage(playerid, 0xFF1493FF, "You Are Banned From The Server, Kicked!!!.");
Kick(playerid);
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
INI_WriteInt(File,"Banned",SInfo[playerid][Banned]);
return 1;
}
To UnBan A Playeer goto the scriptfile - playeruser then PlayerBanned = 0
SSCANF = https://sampforum.blast.hk/showthread.php?tid=120356
ZCMD = https://sampforum.blast.hk/showthread.php?tid=91354
YINI = https://sampforum.blast.hk/showthread.php?tid=175565