SA-MP Forums Archive
Not sending messages - 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: Not sending messages (/showthread.php?tid=634439)



Not sending messages - aoky - 19.05.2017

PHP код:
stock NameCheck(playerid)
{
    new 
str[128];
    new 
namecheck strfind(GetName(playerid), "_"true);
    if(
namecheck >= 1)
    {
        
SendClientMessage(playeridCOLOR_RED"On United County Roleplay we operate a 'Master Account' system. In order to register an account you will need to join with a nickname(without the '_'), instead of your roleplay name.");
        
format(strsizeof(str), "%s was kicked by the server for joining with a roleplay name.",GetName(playerid));
        
SendAdminsMessage(1COLOR_ORANGEREDstr);
        
KickPlayer(playerid);
    }
    return 
1;

It just kicks the player, not showing the messages sent to the client.


Re: Not sending messages - oMa37 - 19.05.2017

Make a timer before kicking the player, like this:

PHP код:
#define     DelayKick(%0)   SetTimerEx("DelayedKick", 300, 0, "d", %0)
forward DelayedKick(playerid);
public 
DelayedKick(playerid)
{
    
Kick(playerid);
    return 
1;
}
stock NameCheck(playerid

    new 
str[128]; 
    new 
namecheck strfind(GetName(playerid), "_"true); 
    if(
namecheck >= 1
    { 
        
SendClientMessage(playeridCOLOR_RED"On United County Roleplay we operate a 'Master Account' system. In order to register an account you will need to join with a nickname(without the '_'), instead of your roleplay name."); 
        
format(strsizeof(str), "%s was kicked by the server for joining with a roleplay name.",GetName(playerid)); 
        
SendAdminsMessage(1COLOR_ORANGEREDstr); 
        
DelayKick(playerid); 
    } 
    return 
1




Re: Not sending messages - Logic_ - 19.05.2017

Also, this message:
Quote:

On United County Roleplay we operate a 'Master Account' system. In order to register an account you will need to join with a nickname(without the '_'), instead of your roleplay name.

Will not be sent because the length is too long, max characters that SendClientMessage can support is 144.

__
The string you format is only of 64 characters, add 24 in it as it's the max characters for the player name and your string chars will be 88, they why use 128?
PHP код:
new str[128]; 
__
Change from this
PHP код:
new str[128];
new 
namecheck strfind(GetName(playerid), "_"true); 
to this
PHP код:
new str[88], namecheck strfind(GetName(playerid), "_"true); 
This is just an optimization technique.


Re: Not sending messages - GTLS - 19.05.2017

Use strcat to add lines into your Message, its too long as Logic__ said. Also, Delying the Kick will solve your issue.