26.01.2014, 15:09
Quote:
Sorry for late mate here's the whole command:
pawn Код:
pawn Код:
if anything dosen't work, tell me. |
pawn Код:
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
Well, Here's my version of the ban command:
pawn Код:
CMD:ban(playerid, params[]) {
new id; //'defines' the targets id.
new reason[50]; //'defines' the reason.
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] - Only admins can use command!"); //if player isn't a rcon admin, he will receive this "error" message.
if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "[USAGE] - /ban [ID] [Reason]"); //if there are missing parameters, the admin will receive the usage of this command.
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "[NOTE] - Player not found."); //If the targets id isnt found, the admin will receive this message (Player Not found).
if(PlayerInfo[id][pAdmin] == 7) return SendClientMessage(playerid, COLOR_RED, "* One does not simply ban the server owner!");
new string[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME]; //thanks to this, everyone will be able to see who was kicked, and by who.
GetPlayerName(playerid, sender, sizeof(sender)); //Gets the senders(admins) name/id.
GetPlayerName(id, receiver, sizeof(receiver)); //Gets the receivers(targets) name/id.
format(string, sizeof(string), "[BAN] - %s(%d) has been banned by %s(%d)", receiver, id, sender, playerid);
SendClientMessageToAll(COLOR_RED, string); //Sends the kick message, as seen above ^.
format(string, sizeof(string), "[BAN] - Reason: %s", reason);
SendClientMessageToAll(COLOR_RED, string); //Sends the kick reasons message, as seen above ^
SetTimerEx("BanTimer", 500, false, "i", id); //Sets KickTimer to 1 seond(will be kicked after 1 second)
PlayerInfo[id][pBanned] = 1;
SendClientMessage(id, COLOR_ORANGE, "[BAN] - You've been BANNED"); //Sends Target a message, saying that he was kicked.
SendClientMessage(id, COLOR_ORANGE, "[BAN] - For more info read the chat.");
format(string, sizeof(string), "[ADMIN] - %s[%d] has used BAN on %s[%d]", sender,playerid,receiver,id);
SendMessageToAdmins(COLOR_LIME,string);
printf("ADMIN %s HAS BANNED %s FOR: %s", sender, receiver, reason);
new INI:File = INI_Open(UserPath(id)); //added this as you told, changed to id
INI_WriteString("Banned By", sender); //added this as you told ||error line
INI_WriteString("Reason", reason); //added this as you told ||error line
INI_Close(File); //added this as you told
return 1;
}
Код:
test2.pwn(7459) : error 035: argument type mismatch (argument 1) test2.pwn(7460) : error 035: argument type mismatch (argument 1)
This fixed it:
pawn Код:
new INI:File = INI_Open(UserPath(id));
INI_WriteString(File,"Banned By", sender);
INI_WriteString(File,"Reason", reason);
INI_Close(File);