TextLable doesnt update?
#1

Hello, i have this business system, and when a player sells his business to another player
it will give they key, and remove the key from the seller. But the 3dTextLable doest update
the owner name.

pawn Код:
else if(strcmp(x_job,"business",true) == 0)
            {
                if(BizOffer[playerid] < 999)
                {
                    if(PlayerInfo[playerid][pCash] > BizPrice[playerid])
                    {
                        if(IsPlayerConnected(BizOffer[playerid]))
                        {
                            if(ProxDetectorS(3.0, playerid, BizOffer[playerid]))
                            {
                                for(new i = 0; i < sizeof(BizzInfo); i++)
                                {
                                    GetPlayerName(GuardOffer[playerid], giveplayer, sizeof(giveplayer));
                                    GetPlayerName(playerid, sendername, sizeof(sendername));
                                    format(string, sizeof(string), "* You accepted the Business for $%d from %s.",BizPrice[playerid],giveplayer);
                                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                                    format(string, sizeof(string), "* %s accepted your Business, and the $%d was added to your Bank Account.",sendername,BizPrice[playerid]);
                                    SendClientMessage(GuardOffer[playerid], COLOR_LIGHTBLUE, string);
                                    format(string, sizeof(string), "%s has accepted the business from %s for $%d", sendername,giveplayer,BizPrice[playerid]);
                                    PayLog(string);
                                    PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
                                    strmid(BizzInfo[i][bOwner], sendername, 0, strlen(sendername), 255);
                                    OnPropTextdrawUpdate(i);
                                    OnBizzPickupUpdate(i);
                                    OnPropUpdate();
                                    UpdateAccount(playerid);
                                    PlayerInfo[BizOffer[playerid]][pPbiskey] = 255;
                                    PlayerInfo[BizOffer[playerid]][pAccount] += BizPrice[playerid];
                                    PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizPrice[playerid];
                                    GivePlayerMoney(playerid, -BizPrice[playerid]);
                                    BizOffer[playerid] = 999;
                                    BizPrice[playerid] = 0;
                                    OnPropTextdrawUpdate(i);
                                    OnBizzPickupUpdate(i);
                                    OnPropUpdate();
                                    return 1;
                                }
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GRAD1, "   You're too far away !");
                                return 1;
                            }
                        }
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You can't afford that !");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Nobody offered you a business.");
                    return 1;
                }
            }
Reply
#2

Anyone?
Reply
#3

Hello!

Can you show us the code where you update the 3d text label?
Reply
#4

Of course
pawn Код:
forward OnPropTextdrawUpdate(bizzid);
public OnPropTextdrawUpdate(bizzid)
{
    if(BizzInfo[bizzid][bOwned] == 0)
    {
        Delete3DTextLabel(BizzLabel[bizzid]);
        format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Status: For Sale \nPrice: $%s",BizzInfo[bizzid][bMessage],Comma(BizzInfo[bizzid][bBuyPrice]));
        BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],25, 0, 1);
    }
    if(BizzInfo[bizzid][bOwned] == 1)
    {
        Delete3DTextLabel(BizzLabel[bizzid]);
        format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Owner: %s \nEntry Fee: $%s",BizzInfo[bizzid][bMessage],BizzInfo[bizzid][bOwner],Comma(BizzInfo[bizzid][bEntranceCost]));
        BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],25, 0, 1);
    }
    return 1;
}
Reply
#5

Use this: https://sampwiki.blast.hk/wiki/Update3DTextLabelText
Reply
#6

PHP код:
else if(strcmp(x_job,"business",true) == 0)
{
    if(
BizOffer[playerid] < 999)
     {
          if(
PlayerInfo[playerid][pCash] > BizPrice[playerid])
        {
            if(
IsPlayerConnected(BizOffer[playerid]))
            {
                  if(
ProxDetectorS(3.0playeridBizOffer[playerid]))
                {
                    for(new 
0sizeof(BizzInfo); i++)
                     {
                            
GetPlayerName(GuardOffer[playerid], giveplayersizeof(giveplayer));
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            if(!
strcmp(BizzInfo[i][bOwner],giveplayer,true))
                            {
                                
format(stringsizeof(string), "* You accepted the Business for $%d from %s.",BizPrice[playerid],giveplayer);
                                
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                                
format(stringsizeof(string), "* %s accepted your Business, and the $%d was added to your Bank Account.",sendername,BizPrice[playerid]);
                                
SendClientMessage(GuardOffer[playerid], COLOR_LIGHTBLUEstring);
                                
format(stringsizeof(string), "%s has accepted the business from %s for $%d"sendername,giveplayer,BizPrice[playerid]);
                                
PayLog(string);
                                
PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
                                
strmid(BizzInfo[i][bOwner], sendername0strlen(sendername), 255);
                                
OnPropTextdrawUpdate(i);
                                
OnBizzPickupUpdate(i);
                                
OnPropUpdate();
                                
UpdateAccount(playerid);
                                
PlayerInfo[BizOffer[playerid]][pPbiskey] = 255;
                                
PlayerInfo[BizOffer[playerid]][pAccount] += BizPrice[playerid];
                                
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizPrice[playerid];
                                
GivePlayerMoney(playerid, -BizPrice[playerid]);
                                 
BizOffer[playerid] = 999;
                                
BizPrice[playerid] = 0;
                                
OnPropTextdrawUpdate(i);
                                
OnBizzPickupUpdate(i);
                                
OnPropUpdate();
                                return 
1;
                            }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"   You're too far away !");
                    return 
1;
                }
            }
        }
        else
        {
              
SendClientMessage(playeridCOLOR_GREY"   You can't afford that !");
            return 
1;
        }
     }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"   Nobody offered you a business.");
        return 
1;
      }

Try this. I put in this row:
PHP код:
if(!strcmp(BizzInfo[i][bOwner],giveplayer,true)) 
So the script will check if the bizz is yours. So you have the correct bizz id.
Reply
#7

Still not working :/
Reply
#8

PHP код:
forward OnPropTextdrawUpdate(bizzid);
public 
OnPropTextdrawUpdate(bizzid)
{
    if(
BizzInfo[bizzid][bOwned] == 0)
    {
        
Delete3DTextLabel(BizzLabel[bizzid]);
        
format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Status: For Sale \nPrice: $%s",BizzInfo[bizzid][bMessage],Comma(BizzInfo[bizzid][bBuyPrice]));
        
BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],2501);
    }
    if(
BizzInfo[bizzid][bOwned] == 1)
    {
        
printf("Bizz-ID #2: %i - Owner: %s",bizzid,BizzInfo[bizzid][bOwner]);
        
Delete3DTextLabel(BizzLabel[bizzid]);
        
format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Owner: %s \nEntry Fee: $%s",BizzInfo[bizzid][bMessage],BizzInfo[bizzid][bOwner],Comma(BizzInfo[bizzid][bEntranceCost]));
        
BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],2501);
    }
    return 
1;
}
else if(
strcmp(x_job,"business",true) == 0)
{
    if(
BizOffer[playerid] < 999)
     {
          if(
PlayerInfo[playerid][pCash] > BizPrice[playerid])
        {
            if(
IsPlayerConnected(BizOffer[playerid]))
            {
                  if(
ProxDetectorS(3.0playeridBizOffer[playerid]))
                {
                    for(new 
0sizeof(BizzInfo); i++)
                     {
                            
GetPlayerName(GuardOffer[playerid], giveplayersizeof(giveplayer));
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            if(!
strcmp(BizzInfo[i][bOwner],giveplayer,true))
                            {
                                
format(stringsizeof(string), "* You accepted the Business for $%d from %s.",BizPrice[playerid],giveplayer);
                                
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                                
format(stringsizeof(string), "* %s accepted your Business, and the $%d was added to your Bank Account.",sendername,BizPrice[playerid]);
                                
SendClientMessage(GuardOffer[playerid], COLOR_LIGHTBLUEstring);
                                
format(stringsizeof(string), "%s has accepted the business from %s for $%d"sendername,giveplayer,BizPrice[playerid]);
                                
PayLog(string);
                                
printf("Bizz-ID: %i - New Owner: %s",i,sendername);
                                
PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
                                
strmid(BizzInfo[i][bOwner], sendername0strlen(sendername), 255);
                                
OnPropTextdrawUpdate(i);
                                
OnBizzPickupUpdate(i);
                                
OnPropUpdate();
                                
UpdateAccount(playerid);
                                
PlayerInfo[BizOffer[playerid]][pPbiskey] = 255;
                                
PlayerInfo[BizOffer[playerid]][pAccount] += BizPrice[playerid];
                                
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizPrice[playerid];
                                
GivePlayerMoney(playerid, -BizPrice[playerid]);
                                 
BizOffer[playerid] = 999;
                                
BizPrice[playerid] = 0;
                                
OnPropTextdrawUpdate(i);
                                
OnBizzPickupUpdate(i);
                                
OnPropUpdate();
                                return 
1;
                            }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"   You're too far away !");
                    return 
1;
                }
            }
        }
        else
        {
              
SendClientMessage(playeridCOLOR_GREY"   You can't afford that !");
            return 
1;
        }
     }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"   Nobody offered you a business.");
        return 
1;
      }

Take this code. What is printing in the console (server.log.txt) when you buy a bizz by an player?
Reply
#9

also it gives the business correctly, just just not update the 3DTextLable
Reply
#10

Yes, I understood you.
Take the code above your last post and answer the question please.
Reply
#11

it said this, but didnt update business lable

pawn Код:
[13:43:23] Bizz-ID: 0 - New Owner: Maya
[13:43:23]   [ function: updateaccount - Maya ]
[13:43:23]    < player file updated >
[13:43:23]   [ updateaccount complete ]
[13:43:23]   [ function: updateaccount - Maya ]
[13:43:23]    < player file updated >
[13:43:23]   [ updateaccount complete ]
[13:43:26]   [ function: updateaccount - Tom_Cowart ]
[13:43:26]    < player file updated >
[13:43:26]   [ updateaccount complete ]
Reply
#12

So. Take this code:
PHP код:
forward OnPropTextdrawUpdate(bizzid);
public 
OnPropTextdrawUpdate(bizzid)
{
    
printf("Bizz-ID #2: %i - Owner: %s - bOwned: %i",bizzid,BizzInfo[bizzid][bOwner],BizzInfo[bizzid][bOwned]);
    if(
BizzInfo[bizzid][bOwned] == 0)
    {
        
Delete3DTextLabel(BizzLabel[bizzid]);
        
format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Status: For Sale \nPrice: $%s",BizzInfo[bizzid][bMessage],Comma(BizzInfo[bizzid][bBuyPrice]));
        
BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],2501);
    }
    if(
BizzInfo[bizzid][bOwned] == 1)
    {
        
printf("Bizz-ID #2: %i - Owner: %s",bizzid,BizzInfo[bizzid][bOwner]);
        
Delete3DTextLabel(BizzLabel[bizzid]);
        
format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Owner: %s \nEntry Fee: $%s",BizzInfo[bizzid][bMessage],BizzInfo[bizzid][bOwner],Comma(BizzInfo[bizzid][bEntranceCost]));
        
BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],2501);
    }
    return 
1;

What is printing now?
Reply
#13

it says this [13:54:19] Bizz-ID #2: 0 - Owner: Maya - bOwned: 0
Reply
#14

PHP код:
else if(strcmp(x_job,"business",true) == 0)
{
    if(
BizOffer[playerid] < 999)
     {
          if(
PlayerInfo[playerid][pCash] > BizPrice[playerid])
        {
            if(
IsPlayerConnected(BizOffer[playerid]))
            {
                  if(
ProxDetectorS(3.0playeridBizOffer[playerid]))
                {
                    for(new 
0sizeof(BizzInfo); i++)
                     {
                            
GetPlayerName(GuardOffer[playerid], giveplayersizeof(giveplayer));
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            if(!
strcmp(BizzInfo[i][bOwner],giveplayer,true))
                            {
                                
format(stringsizeof(string), "* You accepted the Business for $%d from %s.",BizPrice[playerid],giveplayer);
                                
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                                
format(stringsizeof(string), "* %s accepted your Business, and the $%d was added to your Bank Account.",sendername,BizPrice[playerid]);
                                
SendClientMessage(GuardOffer[playerid], COLOR_LIGHTBLUEstring);
                                
format(stringsizeof(string), "%s has accepted the business from %s for $%d"sendername,giveplayer,BizPrice[playerid]);
                                
PayLog(string);
                                
printf("Bizz-ID: %i - New Owner: %s",i,sendername);
                                
PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
                                
strmid(BizzInfo[i][bOwner], sendername0strlen(sendername), 255);
                                
OnPropTextdrawUpdate(i);
                                
OnBizzPickupUpdate(i);
                                
OnPropUpdate();
                                
UpdateAccount(playerid);
                                
BizzInfo[i][bOwned] = 1;
                                
PlayerInfo[BizOffer[playerid]][pPbiskey] = 255;
                                
PlayerInfo[BizOffer[playerid]][pAccount] += BizPrice[playerid];
                                
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizPrice[playerid];
                                
GivePlayerMoney(playerid, -BizPrice[playerid]);
                                 
BizOffer[playerid] = 999;
                                
BizPrice[playerid] = 0;
                                
OnPropTextdrawUpdate(i);
                                
OnBizzPickupUpdate(i);
                                
OnPropUpdate();
                                return 
1;
                            }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"   You're too far away !");
                    return 
1;
                }
            }
        }
        else
        {
              
SendClientMessage(playeridCOLOR_GREY"   You can't afford that !");
            return 
1;
        }
     }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"   Nobody offered you a business.");
        return 
1;
      }

Reply
#15

It's still not working, i think it is this line that is the problem
pawn Код:
strmid(BizzInfo[i][bOwner], sendername, 0, strlen(sendername), 255);
Reply
#16

Anyone?
Reply
#17

Still not fixed :/
Reply
#18

Can anyone help me?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)