#1

Hello everyone there is a bug on this script wich is doesn't update the text it just keep "Opened" even when i lock the biz this is
PHP код:
ReloadBusiness(businessid)
{
    if(
BusinessInfo[businessid][bExists])
    {
        new
            
string[128];
        
DestroyDynamic3DTextLabel(BusinessInfo[businessid][bText]);
        
DestroyDynamicPickup(BusinessInfo[businessid][bPickup]);
        
DestroyDynamicMapIcon(BusinessInfo[businessid][bMapIcon]);
        if(
BusinessInfo[businessid][bOwnerID] == 0)
        {
            
format(stringsizeof(string), "[Business]\nPrice: %s\nType: %s\nEntry Fee: $%i\nStatus: %s"FormatNumber(BusinessInfo[businessid][bPrice]), bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{ffff00}Closed") : ("{00AA00}Opened"));
        }
        else
        {
            
format(stringsizeof(string), "[Business]\nOwner: %s\nType: %s\nEntry Fee: $%i\nStatus: %s"BusinessInfo[businessid][bOwner], bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{FFFF00}Closed") : ("{00AA00}Opened"));
        }
        
BusinessInfo[businessid][bText] = CreateDynamic3DTextLabel(stringCOLOR_GREY1BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ] + 0.110.0, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt]);
        
BusinessInfo[businessid][bPickup] = CreateDynamicPickup(12721BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt]);
        switch(
BusinessInfo[businessid][bType])
        {
            case 
BUSINESS_STORE:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 170, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL);
            case 
BUSINESS_GUNSHOP:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 60, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL);
            case 
BUSINESS_CLOTHES:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 450, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL);
            case 
BUSINESS_RESTAURANT:     BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 100, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL);
            case 
BUSINESS_GYM:             BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 540, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL);
            case 
BUSINESS_AGENCY:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 580, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL);
            case 
BUSINESS_BARCLUB:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 490, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL);
        }
    }

And the lock cmd
PHP код:
    else if((id GetNearbyBusinessEx(playerid)) >= && IsBusinessOwner(playeridid))
    {
        new 
businessid;
        if(!
BusinessInfo[id][bLocked])
        {
            
BusinessInfo[id][bLocked] = 1;
            
GameTextForPlayer(playerid"~r~Business locked"30006);
            
SendProximityMessage(playerid20.0COLOR_PURPLE"** %s locks their business door."GetPlayerRPName(playerid));
        }
        else
        {
            
BusinessInfo[id][bLocked] = 0;
            
GameTextForPlayer(playerid"~g~Business unlocked"30006);
            
SendProximityMessage(playerid20.0COLOR_PURPLE"** %s unlocks their business door."GetPlayerRPName(playerid));
        }
        
PlayerPlaySound(playerid11450.00.00.0);
        
ReloadBusiness(businessid);
        
mysql_format(connectionIDqueryBuffersizeof(queryBuffer), "UPDATE businesses SET locked = %i WHERE id = %i"BusinessInfo[id][bLocked], BusinessInfo[id][bID]);
        
mysql_tquery(connectionIDqueryBuffer);
        return 
1;
    } 
Reply
#2

Try this:

Try this:

PHP код:

ReloadBusiness
(businessid

    if(
BusinessInfo[businessid][bExists]) 
    { 
        new 
            
string[128]; 

        
DestroyDynamic3DTextLabel(BusinessInfo[businessid][bText]); 
        
DestroyDynamicPickup(BusinessInfo[businessid][bPickup]); 
        
DestroyDynamicMapIcon(BusinessInfo[businessid][bMapIcon]); 

        if(
BusinessInfo[businessid][bOwnerID] == 0
        { 
            
format(stringsizeof(string), "[Business]\nPrice: %s\nType: %s\nEntry Fee: $%i\nStatus: %s"FormatNumber(BusinessInfo[businessid][bPrice]), bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{ffff00}Closed") : ("{00AA00}Opened")); 
        } 
        else 
        { 
            
format(stringsizeof(string), "[Business]\nOwner: %s\nType: %s\nEntry Fee: $%i\nStatus: %s"BusinessInfo[businessid][bOwner], bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{FFFF00}Closed") : ("{00AA00}Opened")); 
        } 
    
        if(
BusinessInfo[businessid][bText] != -1)
        {
            
Update3DTextLabelText(BusinessInfo[businessid][bText], COLOR_GREY1string)
        }
        else
        {
            
BusinessInfo[businessid][bText] = CreateDynamic3DTextLabel(stringCOLOR_GREY1BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ] + 0.110.0, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt]); 
        }
        
BusinessInfo[businessid][bPickup] = CreateDynamicPickup(12721BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt]); 

        switch(
BusinessInfo[businessid][bType]) 
        { 
            case 
BUSINESS_STORE:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 170, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_GUNSHOP:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 60, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_CLOTHES:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 450, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_RESTAURANT:     BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 100, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_GYM:             BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 540, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_AGENCY:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 580, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_BARCLUB:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 490, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
        } 
    } 

It will check if the 3d text already exist, and if so it will update the text rather than try and re-create it.
Reply
#3

Quote:
Originally Posted by Robin96
Посмотреть сообщение
Try this:

Try this:

PHP код:

ReloadBusiness
(businessid

    if(
BusinessInfo[businessid][bExists]) 
    { 
        new 
            
string[128]; 
        
DestroyDynamic3DTextLabel(BusinessInfo[businessid][bText]); 
        
DestroyDynamicPickup(BusinessInfo[businessid][bPickup]); 
        
DestroyDynamicMapIcon(BusinessInfo[businessid][bMapIcon]); 
        if(
BusinessInfo[businessid][bOwnerID] == 0
        { 
            
format(stringsizeof(string), "[Business]\nPrice: %s\nType: %s\nEntry Fee: $%i\nStatus: %s"FormatNumber(BusinessInfo[businessid][bPrice]), bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{ffff00}Closed") : ("{00AA00}Opened")); 
        } 
        else 
        { 
            
format(stringsizeof(string), "[Business]\nOwner: %s\nType: %s\nEntry Fee: $%i\nStatus: %s"BusinessInfo[businessid][bOwner], bizInteriors[BusinessInfo[businessid][bType]][intType], BusinessInfo[businessid][bEntryFee], (BusinessInfo[businessid][bLocked]) ? ("{FFFF00}Closed") : ("{00AA00}Opened")); 
        } 
    
        if(
BusinessInfo[businessid][bText] != -1)
        {
            
Update3DTextLabelText(BusinessInfo[businessid][bText], COLOR_GREY1string)
        }
        else
        {
            
BusinessInfo[businessid][bText] = CreateDynamic3DTextLabel(stringCOLOR_GREY1BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ] + 0.110.0, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt]); 
        }
        
BusinessInfo[businessid][bPickup] = CreateDynamicPickup(12721BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt]); 
        switch(
BusinessInfo[businessid][bType]) 
        { 
            case 
BUSINESS_STORE:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 170, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_GUNSHOP:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 60, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_CLOTHES:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 450, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_RESTAURANT:     BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 100, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_GYM:             BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 540, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_AGENCY:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 580, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
            case 
BUSINESS_BARCLUB:         BusinessInfo[businessid][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[businessid][bPosX], BusinessInfo[businessid][bPosY], BusinessInfo[businessid][bPosZ], 490, .worldid BusinessInfo[businessid][bOutsideVW], .interiorid BusinessInfo[businessid][bOutsideInt], .style MAPICON_GLOBAL); 
        } 
    } 

It will check if the 3d text already exist, and if so it will update the text rather than try and re-create it.
Thanks for that, i will check it out if works
Reply
#4

pawn Код:
ReloadBusiness(businessid);
In the lock command, "businessid" variable is always 0. You should use "id" retrieved from GetNearbyBusinessEx:
pawn Код:
ReloadBusiness(id);
Reply
#5

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
pawn Код:
ReloadBusiness(businessid);
In the lock command, "businessid" variable is always 0. You should use "id" retrieved from GetNearbyBusinessEx:
pawn Код:
ReloadBusiness(id);
You could be onto something in the lock command with that...
Reply
#6

Why not just update the 3D Text when locked/Unlocked. Why do you have to do all those Destroy and recreate everything when just a lock status is changed.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)