Name_Lastname
#1

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

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
Reply
#3

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
Reply
#4

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

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)" ?
Reply
#6

Yes, put it under on player connect.
Reply
#7

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
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)