CMD:unban(playerid, params[])
{
new string, gstring[128];
if(sscanf(params,"us[128]",string,gstring)) return Use(playerid, "/unban [name] [reason]");
else if(PlayerInfo[playerid][pAdmin] < 2)return SendAdmin(playerid, "You are not Admin!");
format(gstring,128,"{FCFCFC}Admin {EE0000}%s {FCFCFC}has unban {EE0000}%s {FCFCFC},Reason:{EE0000} %s",PlayerName(playerid),string,gstring);
SendClientMessageToAll(0xFF0000AA, gstring);
PlayerInfo[string][pBan] = 0;
new uFile[35];
format(uFile, 35, USER_FILE, PlayerName(string));
new INI:playerFile = INI_Open(uFile);
INI_WriteInt(playerFile,"Ban",0);
INI_Close(playerFile);
return 1;
}
CMD:ban(playerid, params[])
{
new player, string[128];
if(sscanf(params,"us[128]",player,string))return Use(playerid, "/ban [ime/ID] [razlog]");
else if(PlayerInfo[playerid][pAdmin] < 2)return SendAdmin(playerid, "You not admin!");
format(string,128,"{FCFCFC}Admin {EE0000}%s {FCFCFC}has ban {EE0000}%s {FCFCFC}Reason:{EE0000} %s",PlayerName(playerid),PlayerName(player),string);
SendClientMessageToAll(0xFF0000AA, string);
PlayerInfo[player][pBan] = 1;
new uFile[35];
format(uFile, 35, USER_FILE, PlayerName(player));
new INI:playerFile = INI_Open(uFile);
INI_WriteInt(playerFile,"Ban",1);
INI_Close(playerFile);
Kick(player);
return 1;
}
INI_WriteInt(playerFile,"Ban", PlayerInfo[playerid][pBan]);
Not saying this is a soultion because i havnt looked at it propery but why are you setting value when your just writing it and the Vlue becomes unused? |
new string, gstring[128];
if(sscanf(params,"us[128]",string,gstring))
Oh yeah. But if a player is banned, surely they're not connected to the server, no? In which case they aren't going to be found by "u" and aren't going to have a player ID.
|
if(PlayerInfo[playerid][pBan] == 1)
{
SendClientMessage(playerid, -1, "You are banned!");
Kick(playerid);
}