Not sending messages
#1

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.
Reply
#2

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

Reply
#3

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.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)