Not asking player to change name?
#1

So when a player joins I want it to check if they have a _ in there name and if they do then they get asked to change it.

PHP код:
public OnPlayerConnect(playerid)
{
    new 
query[128];
    new 
pName[24];
    
GetPlayerName(playeridpName24);
    
GetPlayerName(playeridPlayerInfo[playerid][Name], 24);
    if(
strfind(pName,"_",true) == 1)  {
        new 
String[150];
        
        
format(Stringsizeof(String), "{FFFFFF}Welcome %s.\n\n{0099FF}It looks like you are using a characters name.\n\
        {0099FF}Please, input your Master Accounts name below to proceed.\n\n"
pName);
        
        
ShowPlayerDialog(playeridForumNameDIALOG_STYLE_INPUT"Master Accounts Name"String"Register""Leave");
        
        
format(Stringsizeof(String), "Server Error:Welcome %s, it seems like you are using a characters name or soon to be characters name. ",pName);
        
SendClientMessage(playeridCOLOR_REDString);
        
        
format(Stringsizeof(String), "Server Error: Please enter a Master Accounts to continue, Our forums %s.",ServerInfo[ForumLink]);
        
SendClientMessage(playeridCOLOR_REDString);
        return 
1;
    }
    
mysql_format(mysqlquerysizeof(query),"SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"PlayerInfo[playerid][Name]);
    
mysql_tquery(mysqlquery"OnForumAccountCheck""i"playerid);
    return 
1;

Reply
#2

Use this to check roleplay names! (Credits to Gammix)
Reply
#3

https://sampwiki.blast.hk/wiki/Strfind

Quote:

Return Values:
The number of characters before the sub string (the sub string's start position) or -1 if it's not found.

Код:
if(strfind(pName,"_",true) == 1)
Is this what you really want to do?
Reply
#4

Quote:
Originally Posted by AjaxM
Посмотреть сообщение
Use this to check roleplay names! (Credits to Gammix)
I'm not wanting to check roleplay names if its a roleplay name then I want them to change it to a forum name / master account name.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)