House labels for '/newname' command
#1

Hello there friends.
I need some help with labels from houses when a player change his(her) name.
So, i use house system by rootcause, and that system allows the player to buy more than 1 house and
this means there are 2, 3 or more houses with player name in their label. (Ex: FaLLenGirL's House) etc.
I want that when i use '/newname' command and i change my name that labels (from all houses that i own) to update
with the new name that i changed. I will paste my '/newname' command bellow:

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 )
    {
        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;

When i buy or sell a house, the labels will be updated with this stock:
PHP код:
stock UpdateHouseLabelid )
{
    if( !
Iter_ContainsHousesid ) )
        return 
0;
     
eString] = EOS;
    if( !
strcmpHouseDataid ][ Owner ], "-" ) )
    {
        
formateStringsizeofeString ), "{41C63F}House For Sale {FFFFFF}(ID: {D6D6D6}%d{FFFFFF})\n{FFFFFF}%s\n{FFFFFF}Price: {41C63F}${D6D6D6}%s"idHouseInteriorsHouseDataid ][ Interior ] ][ IntName ], convertNumberHouseDataid ][ Price ] ) );
    }
    else
    {
        if( 
HouseDataid ][ SalePrice ] > )
        {
            
formateStringsizeofeString ), "{D6D6D6}%s's House\n{FFFFFF}is now {41C63F}For Sale {FFFFFF}(ID: {D6D6D6}%d{FFFFFF})\n%s\n{FFFFFF}%s\n{FFFFFF}Price: {41C63F}${D6D6D6}%s"HouseDataid ][ Owner ], idHouseDataid ][ Name ], HouseInteriorsHouseDataid ][ Interior ] ][ IntName ], convertNumberHouseDataid ][ SalePrice ] ) );
        }
        else
        {
            
formateStringsizeofeString ), "{D6D6D6}%s's House {FFFFFF}(ID: {D6D6D6}%d{FFFFFF})\n%s\n{FFFFFF}%s\n%s\n{D6D6D6}%s"HouseDataid ][ Owner ], idHouseDataid ][ Name ], HouseInteriorsHouseDataid ][ Interior ] ][ IntName ], LockNamesHouseDataid ][ LockMode ] ], HouseDataid ][ Address ] );
        }
    }
    
UpdateDynamic3DTextLabelTextHouseDataid ][ HouseLabel ], ~1eString );
    return 
1;

And in the "LoadHouses" public, where the houses loaded on server, the labels etc are here:
PHP код:
forward LoadHouses( );
public 
LoadHouses( )
{
    new 
rows cache_num_rows( );
     if( 
rows )
      {
           new 
idloadedfor_salelabel5000 ];
        while( 
loaded rows )
        {
              
id cache_get_field_content_intloaded"ID" );
            
cache_get_field_contentloaded"HouseName"HouseDataid ][ Name ], .max_len MAX_HOUSE_NAME );
            
cache_get_field_contentloaded"HouseOwner"HouseDataid ][ Owner ], .max_len MAX_PLAYER_NAME );
            
cache_get_field_contentloaded"HousePassword"HouseDataid ][ Password ], .max_len MAX_HOUSE_PASSWORD );
            
HouseDataid ][ houseX ] = cache_get_field_content_floatloaded"HouseX" );
            
HouseDataid ][ houseY ] = cache_get_field_content_floatloaded"HouseY" );
            
HouseDataid ][ houseZ ] = cache_get_field_content_floatloaded"HouseZ" );
            
HouseDataid ][ Price ] = cache_get_field_content_intloaded"HousePrice" );
            
HouseDataid ][ SalePrice ] = cache_get_field_content_intloaded"HouseSalePrice" );
            
HouseDataid ][ Interior ] = cache_get_field_content_intloaded"HouseInterior" );
            
HouseDataid ][ LockMode ] = cache_get_field_content_intloaded"HouseLock" );
            
//printf( "On Lock Mode %i", HouseData[ id ][ LockMode ] );
            
HouseDataid ][ SafeMoney ] = cache_get_field_content_intloaded"HouseMoney" );
            
HouseDataid ][ LastEntered ] = cache_get_field_content_intloaded"LastEntered" );
            
formatHouseDataid ][ Address ], MAX_HOUSE_ADDRESS"%d, %s, %s"idGetZoneNameHouseDataid ][ houseX ], HouseDataid ][ houseY ], HouseDataid ][ houseZ ] ), GetCityNameHouseDataid ][ houseX ], HouseDataid ][ houseY ], HouseDataid ][ houseZ ] ) );
            if( 
strcmpHouseDataid ][ Owner ], "-"))
            {
                if( 
HouseDataid ][ SalePrice ] > )
                {
                    
for_sale 1;
                    
formatlabelsizeoflabel ), "{D6D6D6}%s's House\n{FFFFFF}is now {41C63F}For Sale {FFFFFF}(ID: {D6D6D6}%d{FFFFFF})\n%s\n{FFFFFF}%s\n{FFFFFF}Price: {41C63F}${D6D6D6}%s"HouseDataid ][ Owner ], idHouseDataid ][ Name ], HouseInteriorsHouseDataid ][ Interior ] ][ IntName ], convertNumberHouseDataid ][ SalePrice ] ) );
                }
                else
                {
                    
for_sale 0;
                    
formatlabelsizeoflabel ), "{D6D6D6}%s's House {FFFFFF}(ID: {D6D6D6}%d{FFFFFF})\n{FFFFFF}%s\n{FFFFFF}%s\n%s\n{D6D6D6}%s"HouseDataid ][ Owner ], idHouseDataid ][ Name ], HouseInteriorsHouseDataid ][ Interior ] ][ IntName ], LockNamesHouseDataid ][ LockMode ] ], HouseDataid ][ Address ] );
                }
            }
            else
            {
                
for_sale 1;
                 
formatlabelsizeoflabel ), "{41C63F}House For Sale {FFFFFF}(ID: {D6D6D6}%d{FFFFFF})\n{FFFFFF}%s\n{FFFFFF}Price: {41C63F}${D6D6D6}%s"idHouseInteriorsHouseDataid ][ Interior ] ][ IntName ], convertNumber(HouseDataid ][ Price ] ) );
            }
            
HouseDataid ][ HousePickup ] = CreateDynamicPickup((!for_sale) ? 19522 12731HouseDataid ][ houseX ], HouseDataid ][ houseY ], HouseDataid ][ houseZ ], );
            
HouseDataid ][ HouseIcon ] = CreateDynamicMapIconHouseDataid ][ houseX ], HouseDataid ][ houseY ], HouseDataid ][ houseZ ], (!for_sale) ? 32 310, .worldid 0, .streamdistance 300.0 );
            
HouseDataid ][ HouseLabel ] = CreateDynamic3DTextLabellabel, ~1HouseDataid ][ houseX ], HouseDataid ][ houseY ], HouseDataid ][ houseZ ] + 0.3530.0, .worldid 0, .testlos );
            
Iter_Add(Housesid);
            
loaded ++;
        }
        
printf"Loaded %d Houses."loaded );
    }
    return 
1;

So, in the end i just want that the player that is online, when he(she) use the command '/newname' and change
his(her) name, their house labels to update with his(her) newname. If you can help me i would be very grateful.
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)