KickWithMessage
#1

Can some one remake these cmds? Because when player get ban or kick, he doesn't get reason, I don't know how to remake this with KickWithMessage function.

Код:
CMD:ban( playerid, params[ ] )
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage( playerid, -1, "Tu ne administratorius!" );
    new
        id,
        reason[ 64 ]
    ;
    if(sscanf( params, "us[64]", id, reason ) ) return SendClientMessage( playerid, -1, "Naudojimas: /ban [Nickas] [Prieћastis]" );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Tokio ћaidėjo nėra." );
    if(PlayerInfo[id][pPadmin] == 1) return SendClientMessage(playerid, -1, "Ką čia darai?");
    new
        str[ 128 ],
        pName[ MAX_PLAYER_NAME ],
        aName[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
    GetPlayerName( id, pName, MAX_PLAYER_NAME );
    format( str, sizeof( str ), "%s Uћblokavo ћaidėją %s. (Prieћastis: %s)", aName, pName, reason );
    SendClientMessageToAll( -1, str );
    BanEx( id,str);
    return 1;
}
Код:
CMD:kick( playerid, params[ ] )
{
    new
        id,
        reason[ 64 ]
    ;
    if( PlayerInfo[ playerid ][ pAdmin ] < 1 ) return SendClientMessage( playerid, 0xFF0000AA, "Tu ne administratorius!" );
    if(sscanf( params, "us[64]", id, reason ) ) return SendClientMessage( playerid, 0xDEEE20FF, "Naudojimas: /kick [Nick] [Prieћastis]" );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, 0xDEEE20FF, "Tokio ћaidėjo nėra" );
    new
        str[ 128 ],
        pName[ MAX_PLAYER_NAME ],
        aName[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
    GetPlayerName( id, pName, MAX_PLAYER_NAME );
    format( str, sizeof( str ), "Administratorius %s iљmetė ћaidėją %s. Prieћastis: %s ", aName, pName, reason );
    SendClientMessageToAll( 0xDEEE20FF, str );
    Kick( id );
    return 1;
}
Reply
#2

use this
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }

stock KickWithMessage(playerid, message[])
{
    SendClientMessage(playerid, 0xFF4444FF, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);  
}
Reply
#3

For some sort of KickWithMessage function, use my include "SDMessages". I can't help with the rest atm because I'm not home and I'm on my phone
Reply
#4

Does the message display to other people?

There's also a known "issue" (keep in mind the quotes) that Kick/Ban packets have priority over any other, making the person disconnect without letting the client message packet through.
Reply
#5

Quote:
Originally Posted by Mmartin
Посмотреть сообщение
Does the message display to other people?

There's also a known "issue" (keep in mind the quotes) that Kick/Ban packets have priority over any other, making the person disconnect without letting the client message packet through.
Yes, another players can see reason, but player which banned or kicked just see Server Closed The Connection.

Quote:
Originally Posted by BlackRaven
Посмотреть сообщение
use this
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }

stock KickWithMessage(playerid, message[])
{
    SendClientMessage(playerid, 0xFF4444FF, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);  
}
This doesn't works.
Reply
#6

Please define "doesn't work", the code seems to be okay therefore there must be a problem on your side, how did you implement it?
Reply
#7

I have to write on ban and kick cmds this?

KickWithMessage(playerid, "You have been kicked.");
Reply
#8

pawn Код:
forward publicKick(playerid);
public publicKick(playerid) return Kick(playerid);

stock fix_Kick(playerid) return SetTimerEx("publicKick",50,false,"i",playerid), 1;
#define Kick    fix_Kick
Put this on top of your gamemode (bellow includes) and you don't need to do any more changes.
Reply
#9

Quote:
Originally Posted by Sergei
Посмотреть сообщение
pawn Код:
forward publicKick(playerid);
public publicKick(playerid) return Kick(playerid);

stock fix_Kick(playerid) return SetTimerEx("publicKick",50,false,"i",playerid), 1;
#define Kick    fix_Kick
Put this on top of your gamemode (bellow includes) and you don't need to do any more changes.
With this code, when I kick player, he doesn't get kick, just get reason.. When I ban player, he gets ban, but doesn't receive reason.
Reply
#10

Please help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)