06.05.2011, 21:20
You shouldn't be using strtok in zcmd.
Untested.
pawn Код:
CMD:ban(playerid, params[]) {
new
giveplayerid,
szReason[32];
if(sscanf(params, "us[32]", giveplayerid, szReason))
return SendClientMessage(playerid, -1, "Syntax: /ban [playerid] [reason]");
if(IsPlayerNPC(giveplayerid))
return 1;
if(PlayerInfo[playerid][pAdmin] >= 2) {
if(giveplayerid != INVALID_PLAYER_ID) {
new
sendername[MAX_PLAYER_NAME],
string[128],
giveplayer[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 128, "[LOST:RP] [ADMIN]: %s has banned %s! Reason: %s", sendername, giveplayer, szReason);
SendClientMessageToAll(RED, string);
Ban(giveplayerid);
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
format(string,sizeof(string),"[%02d:%02d:%02d]%s has banned %s! Reason:%s",Hour,Minute,Second,sendername,giveplayer, szReason);
SaveIn("BanLog.txt",string);
}
}
return 1;
}