Advertising
#1

// Fixed, thanks.
Reply
#2

You are kicking the player before getting their name, making the playerid invalid by the time you reach the GetPlayerName line.

pawn Код:
static szText[128], numerosNochat, pontosNochat, j;
    numerosNochat = -1, pontosNochat = -1, j = 0, szText[0] = EOS;
    for(new i; text[i]; i++) {
        if(text[i] >= '0' && '9' >= text[i] || (text[i] == '.' || text[i] == ':')) {
            if(text[i] == '.' || text[i] == ':') pontosNochat++;
            else numerosNochat++;
            if(numerosNochat >= 8 && pontosNochat >= 3) {
                new Name[MAX_PLAYER_NAME], Msg[130];
                APlayerData[playerid][BanTime] = 2147483640;
                SendClientMessage(playerid, 0x808080FF, "You have been banned! - Reason: Attempted to advertise!");
                GetPlayerName(playerid, Name, sizeof(Name));
                format(Msg, 128, "{FF0000}%s has been banned - Reason: Attempted to advertise", Name);
                SendClientMessageToAll(0xFF0000FF, Msg);
                Kick(playerid);
                #if defined INVALID_CHAT_BLOCK
                return false;
                #else
                break;
                #endif
            }
        }
Reply
#3

Are you trying it to yourself? If so, watch your code here:
pawn Код:
Kick(playerid);
GetPlayerName(playerid, Name, sizeof(Name));
format(Msg, 128, "{FF0000}%s has been banned - Reason: Attempted to advertise", Name);
SendClientMessageToAll(0xFF0000FF, Msg);
You are first kicking, then sending the message. It won't show up for you, if you do it on yourself.
Reply
#4

Oh, you're both right I forgot that ...-.- thanks.
Reply
#5

^
After testing it with a friend, it's still the same.
Reply
#6

Try to set a timer of 1 second delay between the above script and kicking:
pawn Код:
SetTimerEx("KickDelay", 1000, 0, "i", playerid); // At the end of your script above.

// And this at the end of your whole script.
forward KickDelay(playerid);
public KickDelay(playerid)
{
    Kick(playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)