SA-MP Forums Archive
SendClientMessage - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SendClientMessage (/showthread.php?tid=503702)



SendClientMessage - Carxi - 30.03.2014

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);
    } 



Re: SendClientMessage - Konstantinos - 30.03.2014

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).


Re: SendClientMessage - jakejohnsonusa - 30.03.2014

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.


Re: SendClientMessage - doreto - 30.03.2014

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.


Re : SendClientMessage - samp_boy - 30.03.2014

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



Re: Re : SendClientMessage - Konstantinos - 30.03.2014

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.


Re : SendClientMessage - samp_boy - 30.03.2014

i edited.


Re: SendClientMessage - Konstantinos - 30.03.2014

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.


Re : SendClientMessage - samp_boy - 30.03.2014

anyways he didn't gave us all the code


Re: SendClientMessage - rangerxxll - 30.03.2014

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);
}