SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/05/2017, 11:28 AM   #1
aoky
Huge Clucker
 
aoky's Avatar
 
Join Date: Oct 2016
Location: Kildare, Ireland
Posts: 421
Reputation: 43
Default Not sending messages

PHP Code:
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.
__________________
ybn
aoky is offline   Reply With Quote
Old 19/05/2017, 11:32 AM   #2
oMa37
High-roller
 
oMa37's Avatar
 
Join Date: Feb 2016
Posts: 1,034
Reputation: 152
Default Re: Not sending messages

Make a timer before kicking the player, like this:

PHP Code:
#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

oMa37 is offline   Reply With Quote
Old 19/05/2017, 11:55 AM   #3
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Next to Oblivion (Kalcor's place)
Posts: 1,218
Reputation: 171
Default Re: Not sending messages

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 Code:
new str[128]; 
__
Change from this
PHP Code:
new str[128];
new 
namecheck strfind(GetName(playerid), "_"true); 
to this
PHP Code:
new str[88], namecheck strfind(GetName(playerid), "_"true); 
This is just an optimization technique.
__________________
Chaos Cops and Robbers [Website]
Call of Duty: Black Ops 3 [Website] - Former developer

SA-MP, G-MOD and Web hosting @ https://www.prestigesteve.com.
Logic_ is offline   Reply With Quote
Old 19/05/2017, 05:39 PM   #4
GTLS
Huge Clucker
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: GetPlayerPos(GTLS, Float:x, Float:y, Float:Z);
Posts: 356
Reputation: 38
Default Re: Not sending messages

Use strcat to add lines into your Message, its too long as Logic__ said. Also, Delying the Kick will solve your issue.
__________________
I Dont make Rules..
Quote:
Originally Posted by God
You scare me sometimes, GTLS.
GTLS is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending wrong messages danielpalade Scripting Help 4 18/04/2017 10:41 PM
[+REP]Sending messages to admins. Sunehildeep Scripting Help 15 26/08/2016 06:00 PM
sending messages to admins thefatshizms Scripting Help 2 09/07/2012 02:52 PM
Sending two messages for one problem. Shockey HD Help Archive 8 16/08/2011 05:33 AM
Sending Messages[Sovled] Steven82 Help Archive 6 14/04/2010 11:19 PM


All times are GMT. The time now is 01:32 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.