07.05.2011, 03:44
The above method will only check if the whole name is equal to the tag name. I'm assuming you want it to only kick the player if the tag is not in the name at all? Here is an example of how you could accomplish this:
If there is a part of the code you don't understand or need more explanation of, please ask! It's better to understand the code itself instead of simply getting someone else to hand it to you every time. That way, you'll be able to replicate it in the future, if needed.
pawn Код:
public OnPlayerConnect( playerid ) {
new name[ MAX_PLAYER_NAME ]; // Create a new variable to store the player's name
GetPlayerName( playerid, name, MAX_PLAYER_NAME ); // Store the player's name
// Check if their name has the [ABC] or [123] tag
// strfind usage - https://sampwiki.blast.hk/wiki/Strfind
if( strfind( name, "[ABC]", true ) == -1 && strfind( name, "[123]", true ) == -1 ) {
// Tell the player what's happening, and kick them
SendClientMessage( playerid, 0xFF00FFFF, "Your name must contain the [ABC] or [123] tag to play." );
Kick( playerid );
}
return 1;
}