17.05.2010, 20:37
I've problem with my /unban command :/
Well /ban adds "pSuspended = 1" to Player.ini file.
and I don't know what's wrong with my /unban cmd. It should change pSuspended to "0" but it doesn't. It even shows for me message "Player Is Not Banned"
/ban cmd :
/Unban command.
Help
Well /ban adds "pSuspended = 1" to Player.ini file.
and I don't know what's wrong with my /unban cmd. It should change pSuspended to "0" but it doesn't. It even shows for me message "Player Is Not Banned"
/ban cmd :
pawn Код:
//-------------------------[Ban]------------------------------------------------
if(strcmp(cmd, "/ban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /ban [playerid] [reason]");
return 1;
}
new playa = strval(tmp);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /ban [playerid] [reason]");
return 1;
}
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 6 && PlayerInfo[playerid][pRealAdmin] == 1)
{
SendClientMessage(playa, COLOR_YELLOW, "You were banned from the server");
SendClientMessage(playa, COLOR_GREEN, "===========================================================================");
format(string, sizeof(string), "Admin: %s Banned you",sendername);
SendClientMessage(playa, COLOR_RED, string);
format(string, sizeof(string), "Reason: %s", result);
SendClientMessage(playa, COLOR_RED, string);
SendClientMessage(playa, COLOR_GREEN, "===========================================================================");
SendClientMessage(playa, COLOR_YELLOW, "To appeal this ban, screenshot the information and visit http://www.tomsrp.mysmf.com[url=http://]");
format(string, sizeof(string), "Admin: %s Banned %s, Reason: %s",sendername, giveplayer, result);
printf("%s",string);
format(string, sizeof(string), "Admin: %s Banned %s, Reason: %s",sendername, giveplayer, result);
PlayerInfo[playerid][pSuspended] = 1;
SendClientMessageToAll(COLOR_RED, string);
Ban(playa);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}
pawn Код:
//-------------------------[Unban]----------------------------------------------
if (strcmp(cmd, "/unban", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 6 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [playername]");
return 1;
}
if(!LoadPlayer(playerid,tmp))
{
return 1;
}
if(PlayerInfo[playerid][pSuspended] == 0)
{
SendClientMessage(playerid, COLOR_RED, "That player is not banned!");
return 1;
}
else
{
if(PlayerInfo[playerid][pSuspended] == 1)
{
PlayerInfo[playerid][pSuspended] = 0;
SavePlayer(playerid,tmp);
SendClientMessage(playerid, COLOR_DBLUE, "Player Un banned");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}
if (strcmp(cmd, "/unbanip", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 8 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [IP]");
return 1;
}
format(string, sizeof(string), "unbanip %s", tmp);
SendRconCommand(string);
SendRconCommand("reloadbans");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}