GiveNameSpace
#1

How do i define this?
Reply
#2

What are you actually trying to do?
Reply
#3

pawn Код:
GiveNameSpace(name[])
{
    for(new i = 0; i < sizeof(name); i++)
    {
      if(name[i] == ' ')
      {
        return 1;
        }
    }
    return 0;
}
If in the name exist space return 1 or 0.
Reply
#4

So, do you want to check if there is a space in the player's name?

If yes, then you can use strfind:

pawn Код:
GiveNameSpace(name[])
{
   if(strfind(name, ' ') == -1)
   {
     return 0;
   }
   return 1;
}
That should do the trick.
Reply
#5

Why do you want to do that? When / If you connect with a name e.g. "Oliver Wood", Your name on the server will just be "Oliver", thats why you use "_" in roleplay servers.
Reply
#6

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
new
startpos = strfind(name, " ", true),// or tag [
endpos = strfind(name, " ", true);//or Tag ]
if(startpos != -1 && endpos != -1)
{
strdel(name, startpos, endpos + 1);
if(name[0])
{
SetPlayerName(playerid, name);
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)