2 problems were short.
#1

hey guys i got two problems in this two zcmd commands.

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;
}
In the kick and ban zcmd cmd.

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;
}
This message:

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.
Reply
#2

first put the messages, then set a timer to ban/kick the player on 1 second and the it will work
Reply
#3

Please you do for me, i forget half of the scripting since i stoped , please.
Reply
#4

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, "us[288]", 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;
}
Reply
#5

Quote:
Originally Posted by varthshenon
View Post
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, "us[288]", 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;
}
no change.
Reply
#6

Kick command:

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.");
    if (sscanf(params, "uz", Targetplayer,Reason)) return SendClientMessage(playerid, 0x8A4117FF, "Server: /Kick (PlayerID/PartOfName) (Reason).");
    if (Targetplayer == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0x8A4117FF, "Server: Player not found.");
    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;
}
EDIT: If it works, delete the else's and the brackets in the ban command. In your case, the else means if the player didn't use the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)