Help -
XxX(cena)XxX - 17.12.2012
help please use the command when the server restarts unban
ban
Код:
CMD:ban(playerid, params[])
{
if(Info[playerid][pstaff] >= 2)
{
new targetid, reason;
new VBName[MAX_PLAYER_NAME];
new VBName1[MAX_PLAYER_NAME];
GetPlayerName(playerid, VBName, MAX_PLAYER_NAME);
GetPlayerName(targetid, VBName1, MAX_PLAYER_NAME);
if(sscanf(params, "ri", targetid, reason)) return SendClientMessage(playerid, COLOR_RED,"Usage: /Ban [playerid] [reason]");
if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You Can't Ban Yourself!");
if(Info[targetid][pstaff] > Info[playerid][pstaff]) return SendClientMessage(playerid, COLOR_RED, "You Can't Kick Higher Administrators!");
else
{
new str[128];
format(str, sizeof(str), "Administrator %s Has Banned %s Reason: %d!", VBName, VBName1, reason);
SendClientMessageToAll(COLOR_RED,str);
Info[playerid][pBanned] = 1;
Ban(targetid);
}
}
else return SendClientMessage(playerid, COLOR_RED, "You Need To Be A Administrator!");
return 1;
}
unban
Код:
CMD:unban(playerid, params[])
{
if(Info[playerid][pstaff] >= 2)
{
new string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");
if( Info[MAX_PLAYERS][pBanned] >= 2 )
{
Info[MAX_PLAYERS][pBanned] = 0;
print("OnPlayerOfflineLogin: Variables saved properly");
format(string, 128, "[ADMIN] %s (IP:%s) was unbanned by %s.", params, Info[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
ABroadCast(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);
ABroadCast(COLOR_RED, string);
}
else
{
SendClientMessage( playerid, COLOR_WHITE, "Not a banned account or no such account was found!" );
}
}
return 1;
}
Re: Help -
goviscrap - 17.12.2012
I didn't really understand what you needed help with?
But try this?
Post your errors and warnings..
Код:
CMD:ban(playerid, params[])
{
if(Info[playerid][pstaff] >= 2)
{
new targetid, reason;
new VBName[MAX_PLAYER_NAME];
new VBName1[MAX_PLAYER_NAME];
GetPlayerName(playerid, VBName, MAX_PLAYER_NAME);
GetPlayerName(targetid, VBName1, MAX_PLAYER_NAME);
if(sscanf(params, "ri", targetid, reason)) return SendClientMessage(playerid, COLOR_RED,"Usage: /Ban [playerid] [reason]");
if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You Can't Ban Yourself!");
if(Info[targetid][pstaff] > Info[playerid][pstaff]) return SendClientMessage(playerid, COLOR_RED, "You Can't Kick Higher Administrators!");
}
else
{
new str[128];
format(str, sizeof(str), "Administrator %s Has Banned %s Reason: %d!", VBName, VBName1, reason);
SendClientMessageToAll(COLOR_RED,str);
Info[playerid][pBanned] = 1;
Ban(targetid);
}
}
else return SendClientMessage(playerid, COLOR_RED, "You Need To Be A Administrator!");
return 1;
}
}
}
CMD:unban(playerid, params[])
{
if(Info[playerid][pstaff] >= 2)
{
new string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");
if( Info[MAX_PLAYERS][pBanned] >= 2 )
{
Info[MAX_PLAYERS][pBanned] = 0;
print("OnPlayerOfflineLogin: Variables saved properly");
format(string, 128, "[ADMIN] %s (IP:%s) was unbanned by %s.", params, Info[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
ABroadCast(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);
ABroadCast(COLOR_RED, string);
}
else
{
SendClientMessage( playerid, COLOR_WHITE, "Not a banned account or no such account was found!" );
}
}
return 1;
}
HINT: Next time explain more about your problem.