Allow Certain Names
#4

Quote:
Originally Posted by Bakr
Посмотреть сообщение
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:
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;
}
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.
Ok thanks I understand what you did. I just needed a little remembering on how to script. Thanks alot dude!

what if i had a
pawn Код:
#define CLAN_TAG [ABC]
Thanks all i needed was some remembering
Reply


Messages In This Thread
Allow Certain Names - by ToPhrESH - 07.05.2011, 03:13
Re: Allow Certain Names - by grand.Theft.Otto - 07.05.2011, 03:34
Re: Allow Certain Names - by Bakr - 07.05.2011, 03:44
Re: Allow Certain Names - by ToPhrESH - 07.05.2011, 05:20
Re: Allow Certain Names - by Bakr - 07.05.2011, 05:32
Re: Allow Certain Names - by ToPhrESH - 07.05.2011, 05:34
Re: Allow Certain Names - by Lorenc_ - 07.05.2011, 05:35

Forum Jump:


Users browsing this thread: 3 Guest(s)