How do i detect a name when they connect?
#1

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

basicly..If someone could tell me how i kick someone without a '_' in there name (for RP servers) i can fix my problem
Reply
#3

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)