SA-MP Forums Archive
GiveNameSpace - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GiveNameSpace (/showthread.php?tid=156860)



GiveNameSpace - TouR - 24.06.2010

How do i define this?


Re: GiveNameSpace - Hiddos - 24.06.2010

What are you actually trying to do?


Re: GiveNameSpace - ReVo_ - 24.06.2010

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.


Re: GiveNameSpace - LTomi - 24.06.2010

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.


Re: GiveNameSpace - Niixie - 24.06.2010

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.


Re: GiveNameSpace - ipsBruno - 24.06.2010

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);
}
}