SA-MP Forums Archive
restrictions name rp - 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: restrictions name rp (/showthread.php?tid=600966)



restrictions name rp - Rabot - 15.02.2016

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


Re: restrictions name rp - SaltySandy - 15.02.2016

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


Re: restrictions name rp - MicroKyrr - 15.02.2016

Код:
#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);
		}
	}
}



Re: restrictions name rp - MicroKyrr - 15.02.2016

[Deleted]


Re: restrictions name rp - Rabot - 15.02.2016

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


Re: restrictions name rp - MicroKyrr - 15.02.2016

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


Re: restrictions name rp - Rabot - 16.02.2016

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


Re: restrictions name rp - MicroKyrr - 16.02.2016

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



Re: restrictions name rp - Rabot - 16.02.2016

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)




Re: restrictions name rp - -CaRRoT - 16.02.2016

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.