SendClientMessage
#1

When I enter the server I do not see the message, but I am immediately kicked
PHP код:
if(!dini_Exists(player))
    {
    
SendClientMessage(playerid,COLOR_OOC,"You are not whitelisted.");
    
Kick(playerid);
    } 
Reply
#2

https://sampwiki.blast.hk/wiki/Kick

Quote:
Important Note: As of SA-MP 0.3x, any action taken directly before Kick() (such as sending a message with SendClientMessage) will not reach the player. A timer must be used to delay the kick.

An example can be found in SA-MP Wiki (check the link above).
Reply
#3

You client is lagging, and the server is closing the connection on the client before the message is able to be sent to the client.

Either get a better host or put the kick(playerid) on a timer that kicks in 1000ms.
Reply
#4

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
You client is lagging, and the server is closing the connection on the client before the message is able to be sent to the client.

Either get a better host or put the kick(playerid) on a timer that kicks in 1000ms.
You are completely wrong about kick.Since 0.3x Kick function is called immediately which is resulting not sending anything above it not like previous version where he was waiting above code to execute before kicking a player.
Reply
#5

Код:
if(!dini_Exists(player)) 
    { 
    SendClientMessage(playerid,-1,COLOR_OOC,"You are not whitelisted.");
    Kick(playerid); 
    }
Reply
#6

Quote:
Originally Posted by samp_boy
Посмотреть сообщение
Код:
if(!dini_Exists(player)) 
    { 
    SendClientMessageToAll(-1,COLOR_OOC,"You are not whitelisted.");
    Kick(playerid); 
    }
The reason of why that happens has been mentioned twice already above.

- SendClientMessageToAll has 2 parameters so a warning for arguments do not match on compiling.
- He wants to send a message to that specific player and not everyone.
- Any message/dialog won't be sent before kicking a player unless you use a timer.
Reply
#7

i edited.
Reply
#8

It's still wrong. SendClientMessage uses 3 parameters, not 4 and again - without a timer, none of the messages will be sent to the chat before kicking a player.
Reply
#9

anyways he didn't gave us all the code
Reply
#10

You'll want to send the message when they connect. After the message start a timer of 1 second. When the timer is called, kick the player.

When they connect:

pawn Код:
{
    SetTimerEx("KickTimer", 1000, false, "i", playerid);
   
}
When the timer is called after 1 second:
pawn Код:
forward KickTimer(playerid);
public KickTimer(playerid)
{
    Kick(playerid);
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)