How do i detect a name when they connect? - 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: How do i detect a name when they connect? (
/showthread.php?tid=80851)
How do i detect a name when they connect? -
Mowgli - 06.06.2009
how do i detect if someone has [number] in there name on login? i want make it so like if there name is 'Mowgli[5]' they get kicked or if there name is '[3]Mowgli' or anything with a [Nubmer] in, they get kicked..how do i do this?
-----
also, how do i make it so that u can change ur name to Mowgli[1] or w/e, without makeing a new account in scriptfiles
Re: How do i detect a name when they connect? -
Mowgli - 06.06.2009
basicly..If someone could tell me how i kick someone without a '_' in there name (for RP servers) i can fix my problem
Re: How do i detect a name when they connect? -
OmeRinG - 06.06.2009
pawn Код:
public OnPlayerConnect(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
if(strfind(pName,"_",true) == -1) { Kick(playerid); }
return 1;
}
what is basiclly does:
Creates a string variable to store the name in
stores the player who just connected name in the variable we created
if the char "_" is found in the string variable that we create then kick the player
strfind returns -1 if the string is not found...
Re: How do i detect a name when they connect? -
Remba - 06.06.2009
Quote:
Originally Posted by Mowgli
basicly..If someone could tell me how i kick someone without a '_' in there name (for RP servers) i can fix my problem
|
[b]
Why dont you try [/kick <id>].Its a lot faster than typing a name.