SA-MP Forums Archive
i need help to change player name format - 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)
+--- Thread: i need help to change player name format (/showthread.php?tid=486776)



i need help to change player name format - IbeatS - 10.01.2014

Hello, I am working in my RP server and need help ,how to change the name format to let the player register with format Firstname_Lastname
,thanks


Re: i need help to change player name format - amirab - 10.01.2014

This can help you put these codes in OnPlayerConnect or after register or any thing you want :

PHP код:
            new sendername[MAX_PLAYER_NAME];
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
namestring strfind(sendername"_"true);
            if(
namestring == -1)
            {
                
SendClientMessage(playeridCOLOR_YELLOW"Your name must be in the Firstname_Lastname format - Please re-log with a name such as Amir_AB");
                
Kick(playerid);
                return 
1;
            } 



Re: i need help to change player name format - IbeatS - 11.01.2014

It work well but when I login with wrong format it didn't say ""login with right format Firstname_Lastname " it kick the player without telling him anything


Re: i need help to change player name format - SyntaxQ - 11.01.2014

You have to set a timer.
pawn Код:
new sendername[MAX_PLAYER_NAME];
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new namestring = strfind(sendername, "_", true);
            if(namestring == -1)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Your name must be in the Firstname_Lastname format - Please re-log with a name such as Amir_AB");
                SetTimerEx("KickPlayer", 500, false "i", playerid);
                return 1;
            }
            forward KickPlayer (playerid)
            public KickPlayer (playerid)
            {
                  Kick(playerid);
            }



Re: i need help to change player name format - IbeatS - 11.01.2014

I should put the timer before Amir's code ? Or just replace it with amir's code ?


Re: i need help to change player name format - SyntaxQ - 11.01.2014

I have used amirab's code. Just replace the old one with this.


Re: i need help to change player name format - IbeatS - 11.01.2014

it make errors
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 001: expected token: ",", but found "-string-"
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : warning 215: expression has no effect
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : warning 215: expression has no effect
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 001: expected token: ";", but found ")"
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 029: invalid expression, assumed zero
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : fatal error 107: too many error messages on one line


Re: i need help to change player name format - IbeatS - 11.01.2014

it make errors when i put the timer
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 001: expected token: ",", but found "-string-"
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : warning 215: expression has no effect
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : warning 215: expression has no effect
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 001: expected token: ";", but found ")"
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 029: invalid expression, assumed zero
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : fatal error 107: too many error messages on one line


Re: i need help to change player name format - newbie scripter - 11.01.2014

pawn Код:
forward KickPlayer (playerid);



Re: i need help to change player name format - 1FreeHost - 11.01.2014

Quote:
Originally Posted by IbeatS
Посмотреть сообщение
it make errors when i put the timer
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 001: expected token: ",", but found "-string-"
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : warning 215: expression has no effect
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : warning 215: expression has no effect
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 001: expected token: ";", but found ")"
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : error 029: invalid expression, assumed zero
C:\Users\Hossam\Downloads\Compressed\Italy Mafia Vers6\pawno\mafia02.pwn(5342) : fatal error 107: too many error messages on one line
No double posts.