House labels for '/newname' command
#4

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

Does it work like this?
PHP код:
CMD:newnameplayeridparams[ ] )
{
    
LoginCheckplayerid );
    new 
newname24 ], RowsFields,  query1256 ], escapename24 ],
    
pnameMAX_PLAYER_NAME ], Cache:newnames;
    if( 
PlayerInfoplayerid ][ PremiumLevel ] != 10 )
        return 
SendErrorplayerid"You must be Premium Level {FF0000}10 {FFFFFF}to change your name !" );
    if( 
PlayerInfoplayerid ][ NewNameAgain ] == )
        return 
SendErrorplayerid"You can change your name at every 10 minutes !" );
    if( 
sscanfparams"s[24]"newname ) )
        return 
SendUsageplayerid"/newname [New Name]" );
    if( 
strlennewname ) < || strlennewname ) > 24 )
        return 
SendErrorplayerid"Unacceptable nick lenght. Between 4 and 24 characters !" );
    
GetPlayerNameplayeridpname24 );
    
cache_get_dataRowsFieldsdatabase );
    
mysql_real_escape_stringnewnameescapename );
    
formatquery1sizeofquery1 ), "SELECT `Name` FROM `Accounts` WHERE `Name` = '%s'"escapename );
    
newnames mysql_querydatabasequery1 );
    if( !
Rows )
    {
        for(new 
i,j=sizeof(HouseData);i<j;i++)
        {
            if(!
strcmp(HouseData[i][Owner],pname,true))
            {
                
strcat(HouseData[i][Owner],params,sizeof(Housedata[]));
                
UpdateHouseLabel(i);
                continue;
            }
        }
        new 
query3000 ];
        
formatquerysizeofquery ), "UPDATE `Accounts` SET `Name`= '%s' WHERE `Name` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
formatquerysizeofquery ), "UPDATE `Achievements` SET `AchName` = '%s' WHERE `AchName` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
formatquerysizeofquery ), "UPDATE `housekeys` SET `Player` = '%s' WHERE `Player` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
formatquerysizeofquery ), "UPDATE `houses` SET `HouseOwner` = '%s' WHERE `HouseOwner` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
formatquerysizeofquery ), "UPDATE `housesales` SET `OldOwner` = '%s' WHERE `OldOwner` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
formatquerysizeofquery ), "UPDATE `housesales` SET `NewOwner` = '%s' WHERE `NewOwner` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
formatquerysizeofquery ), "UPDATE `housevisitors` SET `Visitor` = '%s' WHERE `Visitor` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
formatquerysizeofquery ), "UPDATE `Properties` SET `PropOwner` = '%s' WHERE `PropOwner` ='%s'"escapenamepname );
        
mysql_tquerydatabasequery );
        
SetPlayerNameplayeridparams );
        
eBigString] = EOS;
        
formateBigStringsizeofeBigString ), "[Server Info]: {%06x}%s(%d) {FFFFFF}has changed his name into '{D6D6D6}%s{FFFFFF}'."GetPlayerColorplayerid ) >>> 8pnameplayeridparams );
        
SendClientMessageToAll0xD6D6D6FFeBigString );
        
eString] = EOS;
        
formateStringsizeofeString ), "{FFFFFF}You have changed your name sucesfully.\nPlease reconnect to save your dates in {FF0000}database{FFFFFF}." );
        
ShowPlayerDialogplayeridEMPTY_DIALOGDIALOG_STYLE_MSGBOX"{FFFFFF}New Name:"eString"Ok","" );
        
PlayerInfoplayerid ][ NewNameAgain ] = 1;
        
SetTimerEx"NewNameAgain2"10 60 10000"i"playerid );
    }
    else if( 
Rows == )
    {
       
SendErrorplayerid"This name already exists in the database !" );
    }
       
cache_deletenewnames );
       return 
1;

I added this:
PHP код:
for(new i,j=sizeof(HouseData);i<j;i++)
        {
            if(!
strcmp(HouseData[i][Owner],pname,true))
            {
                
strcat(HouseData[i][Owner],params,sizeof(Housedata[]));
                
UpdateHouseLabel(i);
                continue;
            }
        } 
It is working but there are some little problems in the labels when they are updating. Look here in this photos:

1. My houses (initial):


2. Then i will change my name to: "FaLLenGirL2" from "FaLLenGirL":


3. After i changed my name, the house labels (that i own) were updated but... there appears the current name and the previous name:
Reply


Messages In This Thread
House labels for '/newname' command - by FaLLenGirL - 19.03.2017, 21:38
Re: House labels for '/newname' command - by FaLLenGirL - 20.03.2017, 09:49
Re: House labels for '/newname' command - by Mencent - 20.03.2017, 12:47
Re: House labels for '/newname' command - by FaLLenGirL - 20.03.2017, 13:48
Re: House labels for '/newname' command - by Mencent - 20.03.2017, 13:54
Re: House labels for '/newname' command - by FaLLenGirL - 20.03.2017, 14:00

Forum Jump:


Users browsing this thread: 1 Guest(s)