How to check a players name -
[g00n]Citizen - 04.05.2009
Well, I was wondering how can I make a script check a players name and allow them to do something.
Ex:
A player wants to get into a certain car but there name has to start with an "a" to get into this particular car.
What I want to do is something like this but I has to do with a gang area, I got the door to it working for admins only at the moment but I want it to work with people that have [g00n] for the tag of their name. How can I set it up to do this.
~Thanks
Re: How to check a players name -
MenaceX^ - 04.05.2009
GetPlayerName.
Re: How to check a players name -
[g00n]Citizen - 04.05.2009
Thank you. I couldn't figure it out before. I must have over-looked it before.
EDIT: Alright, How can I make it check to see if a player has [g00n] in their name?
Re: How to check a players name -
MenaceX^ - 04.05.2009
strfind.
Re: How to check a players name -
[g00n]Citizen - 04.05.2009
ooookkkk...Alittle better explanation would be appreciated.
Like how do I set it up:
strfind(GetPlayerName(playerid), "[g00n]", true, 1);
Is that right?
Re: How to check a players name -
MenaceX^ - 04.05.2009
pawn Код:
if(strfind(namevariable,"[g00n]",true)==-1)
{
//code
}
else SendClientMessage(playerid,color,"You are not a g00n member.");
Re: How to check a players name -
[g00n]Citizen - 04.05.2009
Could I do it like this?
Код:
if(strfind(GetPlayerName(i, name, sizeof(name)), "[g00n]", true)==-1))
{
//code
}
Re: How to check a players name -
Joe Staff - 04.05.2009
no.
Re: How to check a players name -
Weirdosport - 04.05.2009
Quote:
Originally Posted by SilentHuntR
no.
|
There's a very unhelpful theme to your spam posts...
GetPlayerName does not directly return the players name, you have to save it to a string.
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
That saves the players name to the array "name". Now you have to do the strfind business:
pawn Код:
if(strfind(name, "[g00n]", true) == -1)
{
//Code if g00n is in name
}
Note you may wish to change the true depending on whether you want it to be case sensitive, eg: G00n or g00n or G00N.
True = not case sensitive
False = Case Sensitive
(I Think)
Re: How to check a players name -
[g00n]Citizen - 04.05.2009
Thanks Weirdosport! I got it working now!