07.07.2011, 17:59
hey guys i got two problems in this two zcmd commands.
here are they:
In the kick and ban zcmd cmd.
When i type /kick 0 xxxxx
/kick (playerid/partofname) (reason)
it just sends the disconnect message.
This message:
Same as the ban command.
I dont the something wrong is there.
here are they:
pawn Code:
CMD:kick(playerid, params[])
{
new Targetplayer;
new string[168];
new Reason[288];
new Year, Month, Day;
getdate(Year, Month, Day);
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x8A4117FF, "Server: You are not an Adminstrator to use this command.");
else if (sscanf(params, "uz", Targetplayer,Reason)) return SendClientMessage(playerid, 0x8A4117FF, "Server: /Kick (PlayerID/PartOfName) (Reason).");
else if (Targetplayer == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0x8A4117FF, "Server: Player not found.");
else
{
Kick(Targetplayer);
format(string, sizeof(string),"Server: Adminstrator %s Kicked %s Reason: %s | Date: %02d/%02d/%d.",playerid,Targetplayer,Reason,Month,Day,Year);
SendClientMessageToAll(0x8A4117FF,string);
}
return 1;
}
CMD:ban(playerid, params[])
{
new Targetplayer;
new string[168];
new Reason[288];
new Year, Month, Day;
getdate(Year, Month, Day);
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x8A4117FF, "Server: You are not an Adminstrator to use this command.");
else if (sscanf(params, "uz", Targetplayer,Reason)) return SendClientMessage(playerid, 0x8A4117FF, "Server: /Ban (PlayerID/PartOfName) (Reason).");
else if (Targetplayer == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0x8A4117FF, "Server: Player not found.");
else
{
BanEx(Targetplayer,Reason);
//Msg1
format(string, sizeof(string), "Server: You been Banned from ModernWarfare 2 Server, If you feel you were banned wrongly please post a ban appeal on our forums (www.Mw2sampserver.com).");
SendClientMessage(Targetplayer, 0x8A4117FF, string);
//Msg2
format(string, sizeof(string), "Server: Adminstrator that banned you: %s.",playerid);
SendClientMessage(Targetplayer, 0x8A4117FF, string);
//Msg3
format(string, sizeof(string), "Server: Reason you were banned: %s",Reason);
SendClientMessage(Targetplayer, 0x8A4117FF, string);
//Msg4
format(string, sizeof(string), "Server: Date: %02d/%02d/%d | Time: %d/%d/%d.",Month,Day,Year,Hour,Minute,Second);
SendClientMessage(Targetplayer, 0x8A4117FF, string);
//Msg5
format(string, sizeof(string), "Server: Press F8 to screen this..");
SendClientMessage(Targetplayer, 0x8A4117FF, string);
format(string, sizeof(string),"Server: Adminstrator %s Banned %s Reason: %s | Date: %02d/%02d/%d.",playerid,Targetplayer,Reason,Month,Day,Year);
SendClientMessageToAll(0x8A4117FF,string);
}
return 1;
}
When i type /kick 0 xxxxx
/kick (playerid/partofname) (reason)
it just sends the disconnect message.
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
new string[64], dName[MAX_PLAYER_NAME];
GetPlayerName(playerid,dName,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(string,sizeof string,"Server: %s (ID %d) left the server. (Timed out)",dName,playerid);
case 1: format(string,sizeof string,"Server: %s (ID %d) left the server. (Leaving)",dName,playerid);
case 2: format(string,sizeof string,"Server: %s (ID %d) left the server. (Kicked/Banned)",dName,playerid);
}
SendClientMessageToAll(0x8A4117FF,string);
return 1;
}
pawn Code:
case 2: format(string,sizeof string,"Server: %s (ID %d) left the server. (Kicked/Banned)",dName,playerid);
Same as the ban command.
I dont the something wrong is there.