new pname[MAX_PLAYER_NAME];
new namestr = strfind(pname, "_", true);
if(namestr == -1)
{
GetPlayerName(playerid, pname, sizeof(pname));
SendClientMessage(playerid, COLOR_RED, "Your name must be like this Firstname_Lastname");
Kick(playerid);
return 1;
}
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new namestr = strfind(pname, "_", true);
if(namestr == -1)
{
SendClientMessage(playerid, COLOR_RED, "Your name must be like this Firstname_Lastname");
Kick(playerid);
return 1;
}
if(PlayerInfo[playerid][pAdmin] == 0)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(strfind(pName, "_", true) == -1)
{
SendClientMessage(playerid, COLOR_YELLOW, "You must have a name following the Firstname_Lastname format. You got kicked as a result!");
Kick(playerid);
}
}
pawn Код:
|
it works but i dont get a kick and a Message..that its my name..
|
public OnPlayerConnect(playerid)
{
// Roleplay name checker, for non-admins.
if(PlayerInfo[playerid][pAdmin] == 0)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(strfind(pName, "_", true) == -1)
{
SendClientMessage(playerid, COLOR_YELLOW, "You must have a name following the Firstname_Lastname format. You got kicked as a result!");
Kick(playerid);
}
}
return 1;
}
This forum requires that you wait 120 seconds between posts. Please try again in 17 seconds.
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
if(!IsARolePlayName(name)) {
//Kick him here.
} else {
//Your code if it's a good name. :)
}
return 1;
}