restrictions name rp
#1

Hello,
I would like to make a name RolePlay system.
If I understand , you have to make several tables with restrictions , but after how I do in onplayerconnect ?

Sorry my english limit

Thanx
Reply
#2

Check name in OnPlayerConnect --> strip the name and look for _ in the name.
Reply
#3

Код:
#include <a_samp>

#define COLOR_RED 0xAA3333AA

new RestrictionNames[][] =
{
	"MicroKyrr", "God", "Deagle", "Lord",
	"Admin", "Gates", "LoL", "NONRPNAME", "SA:MP",
        */You can also add more/*
};


public OnPlayerConnect(playerid)
{
	NameCheck(playerid);
        return 1;
}

NameCheck(playerid)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));

	for(new i = 0; i < sizeof(RestrictionNames); i++)
	{
		if(!strcmp(RestrictionNames[i], name, true))
		{
			SetPlayerName(playerid, "NONRPNAME");
			SendClientMessageEx(playerid, COLOR_RED, "You have been kicked & logged for using a Restriction Name! Come Back with a Non-restriction name!");
			Kick(playerid);
		}
	}
}
Reply
#4

[Deleted]
Reply
#5

Thank you I adapted the script.

As against the SendClientMessageEx ig does not work , because the player does not have time to really connect , I add a timer ?

thanks again
Reply
#6

OnplayerDisconnect

Код:
public OnPlayerDisconnect(playerid, reason)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	if(!strcmp(name, "InvalidNick", true)) 
        return 1;
}
P.S: It does not work? hmmm
Reply
#7

The system works well , but no message for the kick .
Reply
#8

Hmm it's pretty simple , Only those who kick will receive the message!

To received the message to everyone , try this.
Код:
#include <a_samp>

#define COLOR_RED 0xAA3333AA

new RestrictionNames[][] =
{
	"MicroKyrr", "God", "Deagle", "Lord",
	"Admin", "Gates", "LoL", "NONRPNAME", "SA:MP",
        */You can also add more/*
};


public OnPlayerConnect(playerid)
{
	NameCheck(playerid);
        return 1;
}

NameCheck(playerid)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));

	for(new i = 0; i < sizeof(RestrictionNames); i++)
	{
		if(!strcmp(RestrictionNames[i], name, true))
		{
			SetPlayerName(playerid, "NONRPNAME");
			SendClientMessageEx(playerid, COLOR_RED, "You have been kicked & logged for using a Restriction Name! Come Back with a Non-restriction name!");
                        format(name, sizeof(name), "%s has been kicked for using Restriction names!", name);
                        SendClientMessageToAll(0xFF0000FF, name);
			Kick(playerid);
		}
	}
}

public OnPlayerDisconnect(playerid, reason)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	if(!strcmp(name, "InvalidNick", true)) 
        return 1;
}
Reply
#9

I think that I badly expressed

For it SendClientMessageToAll , I know how to make

I speak for SendClientMessage, which does not display IG (look screen)

Reply
#10

Quote:
Originally Posted by Rabot
Посмотреть сообщение
I think that I badly expressed

For it SendClientMessageToAll , I know how to make

I speak for SendClientMessage, which does not display IG (look screen)

It's an issue with SA:MP where messages dont appear if you kick the player directly, you're gonna have to create a 5 seconds timer after you send the message & then kick the player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)