SA-MP Forums Archive
Name_Lastname - 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: Name_Lastname (/showthread.php?tid=409250)



Name_Lastname - Razor_Sebi - 20.01.2013

how to make roleplay names i mean that when some one log into my server to have name_lastname?


Re: Name_Lastname - Roach_ - 20.01.2013

You must find a character in the whole name:
pawn Код:
if(!strfind(playername, "_", true, 1) !=-1) return Kick(playerid);
If not, the server will kick the player..
Add this at the OnPlayerConnect Callback


Re: Name_Lastname - Razor_Sebi - 20.01.2013

Quote:
Originally Posted by Roach_
Посмотреть сообщение
You must find a character in the whole name:
pawn Код:
if(!strfind(playername, "_", true, 1) !=-1) return Kick(playerid);
If not, the server will kick the player..
Add this at the OnPlayerConnect Callback
You saved my life mate

playername or playerid? i get error on playername


Re: Name_Lastname - GWMPT - 20.01.2013

pawn Код:
new name[128];
GetPlayerName(playerid, name, sizeof(name))
if(strstr(playername, "_"))
     return Kick(playerid);
There you go.


Re: Name_Lastname - Razor_Sebi - 21.01.2013

Quote:
Originally Posted by klklt0
Посмотреть сообщение
pawn Код:
new name[128];
GetPlayerName(playerid, name, sizeof(name))
if(strstr(playername, "_"))
     return Kick(playerid);
There you go.

Where can i put that? everywhere under "onplayerconnect(playerid)" ?


Re: Name_Lastname - azzerking - 21.01.2013

Yes, put it under on player connect.


Re: Name_Lastname - Razor_Sebi - 21.01.2013

C:\Users\Sebi\Desktop\New folder (2)\gamemodes\larp.pwn(5424) : warning 217: loose indentation
C:\Users\Sebi\Desktop\New folder (2)\gamemodes\larp.pwn(5425) : error 017: undefined symbol "strstr"
C:\Users\Sebi\Desktop\New folder (2)\gamemodes\larp.pwn(542 : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Not working


Re: Name_Lastname - Sinner - 21.01.2013

Quote:
Originally Posted by Roach_
Посмотреть сообщение
You must find a character in the whole name:
pawn Код:
if(!strfind(playername, "_", true, 1) !=-1) return Kick(playerid);
If not, the server will kick the player..
Add this at the OnPlayerConnect Callback
This will allow names like "____" or "__something" or "blabla_____". There is no guarantee it's a real roleplay name. The best way to do this would be regular expressions (using the regex plugin).

Regex would be something like (untested):
pawn Код:
/^[a-zA-Z].+_[a-zA-Z].+$/
Plugin:
https://sampforum.blast.hk/showthread.php?tid=247893