/ban not working text
#1

hi i have this code:
pawn Код:
CMD:ban( playerid, params[ ] )
    {
        if( playerDB[ playerid ][ admin ] < 3 ) return K( playerid, BLUE, "Jus ne administratorius." );
        new
            id,
            prz[ 128 ],
            laikas,
            name[ MAX_PLAYER_NAME ],
            msg[ 300 ],
            adminname[ MAX_PLAYER_NAME ],
            msgs[ 400 ]
        ;
        if( sscanf( params, "uis[128]", id, laikas, prz ) ) return N( playerid, COLOR_TEAL, "Baninti ћaideją: /ban <dalis vardo arba ID> <laikas valandom> <prieћastis>" );
        if( GetPVarInt( playerid, "KitasBan" ) != 0 ) return K( playerid, COLOR_TEAL, "Prieљ kitą ban jūs turite љiek tiek palaukti" );

        if( laikas > 48 ) return K( playerid, COLOR_RED, "Negalima uћblokuoti daugiau negu 48 valandom." );
        if( id == INVALID_PLAYER_ID ) return K( playerid, COLOR_RED, "Tokio vardo nėra." );

        GetPlayerName( id, name, MAX_PLAYER_NAME );

        new kickinamoadmin = playerDB[ id ][ admin ] + playerDB[ id ][ superadmin ];
        new adminas = playerDB[ playerid ][ admin ] + playerDB[ playerid ][ superadmin ];
        if( kickinamoadmin > adminas ) return K( playerid, BLUE, "Љio administratoriaus lygis yra didesnis." );

        GetPlayerName( playerid, adminname, MAX_PLAYER_NAME );
           
        format( msg, sizeof( msg ), "{FFCC00}[ {CCA300}Admin praneљimas ]: {CCA300}%s {FFCC00}jus uћblokavo {CCA300}%i valandom uћ: {CCA300}%s", adminname, laikas, prz );
        SendClientMessage( id, COLOR_TEAL, msg );

        format( msgs, sizeof( msgs ), "{FFCC00}[ {CCA300}Admin praneљimas ]: {CCA300}%s {FFCC00}uћblokavo {CCA300}%s {FFCC00}serveryje {CCA300}%i {FFCC00}valandom ({CCA300}%s{FFCC00}).", adminname, name, laikas, prz );
        SendClientMessageToAll( -1, msgs );
           
        new
            Hour,
            Minute,
            Second,
            Year,
            Month,
            Day
        ;
       
        gettime( Hour, Minute, Second );
        getdate( Year, Month, Day );
        new valandos = Hour + laikas;
        new banlaikas = mktime( valandos, Minute, Second, Day, Month, Year );
        format( query, 128, "UPDATE `"TABLENAME"` SET `BanLaikas` = '%i' WHERE (`vardas` = '%s')", banlaikas, name );
        mysql_function_query( SQL, query, false, "", "" );
        Kick( id );
        if( playerDB[ playerid ][ superadmin ] == 0 && playerDB[ playerid ][ admin ] < 4 ) SetPVarInt( playerid, "KitasBan", 5 );
        return true;
    }
and it's not working propably
it's baning players okay but it's not showing text for everybody

pawn Код:
format( msgs, sizeof( msgs ), "{FFCC00}[ {CCA300}Admin praneљimas ]: {CCA300}%s {FFCC00}uћblokavo {CCA300}%s {FFCC00}serveryje {CCA300}%i {FFCC00}valandom ({CCA300}%s{FFCC00}).", adminname, name, laikas, prz );
        SendClientMessageToAll( -1, msgs );
this line isint apearing to anyone after player get ban
Reply
#2

Is the string too long? You can't display messages that are longer than 144 characters.
Reply
#3

The person who get's banned atleast won't get it probably. It's a common bug that someone who gets kicked (using Kick()) don't get messages that are sent right before the Kick(), so for that you'll have to use a timer (also described on the wiki; https://sampwiki.blast.hk/wiki/Kick)

And why are you using an array with size 300/400.. that's really a waste of memory, since client messages can only send max. 144 characters.
Reply
#4

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
The person who get's banned atleast won't get it probably. It's a common bug that someone who gets kicked (using Kick()) don't get messages that are sent right before the Kick(), so for that you'll have to use a timer (also described on the wiki; https://sampwiki.blast.hk/wiki/Kick)
That's not a bug, it's meant to perform faster for more security.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)