SA-MP Forums Archive
String duplicating inside of dialog. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: String duplicating inside of dialog. (/showthread.php?tid=636429)



String duplicating inside of dialog. - Kane - 27.06.2017

Edited: Irrelevant and no use to anyone. Current problem is on second page.


Re: String duplicating inside of dialog. - KingSenpai - 27.06.2017

I have the same problem in my land system, When I edit an object it becomes duplicate. and i still can`t finding the problem seems yours.


Re: String duplicating inside of dialog. - Dayrion - 27.06.2017

Why don't you format a string and use strcat after formatting it? Like this example:
PHP Code:
CMD:interiorlist(playerid)
{
    if(!
IsPlayerAdmin(playerid))
        return 
0;
    new 
sub_str[100],
        
principal_str[250];
    foreach(new 
It_Interior)
    {
        
format(sub_strsizeof(sub_str), "ID: %i » %s\n"iBizInterior[i][i_Name]);
        
strcat(principal_strsub_str);
    }
    
Dialog_Show(playeridNOTHINGDIALOG_STYLE_MSGBOX"All custom interiors"principal_str"Ok""");
    return 
1;




Re: String duplicating inside of dialog. - Kane - 28.06.2017

Didn't work Dayrion. Still doesn't explain why CountPropertyFurniture is returning a 28.

(How this post get 14,000 views?)


Re: String duplicating inside of dialog. - Sew_Sumi - 28.06.2017

Quote:
Originally Posted by Arthur Kane
View Post
(How this post get 14,000 views?)
All the rep hunters coming in thinking this is an easy duplication of tags in the string formulation.


Re: String duplicating inside of dialog. - Kane - 28.06.2017

Fixed the issue. Was actually an unrelated problem that caused objects to duplicate...


Re: String duplicating inside of dialog. - Kane - 28.06.2017

Might as well post it here. I'm having a problem with objects with this furniture system not being created.

It creates like 2 restarts later then doesn't.

PHP Code:
Server:SQL_LoadFurniture()
{
    new 
rowsfieldscount 0
    
    
cache_get_data(rowsfieldsm_Handle);
    
    if(
rows){
        for(new 
0rows && MAX_FURNITUREi++){
        
            
FurnitureData[i+1][furnitureSQLID] = cache_get_field_content_int(i"id"m_Handle);
                       
                        ...        
     
            
FurnitureData[i+1][furnitureObject] = CreateDynamicObject(FurnitureData[i+1][furnituresModel], FurnitureData[i+1][furniturePos][0], FurnitureData[i+1][furniturePos][1], FurnitureData[i+1][furniturePos][2], FurnitureData[i+1][furnitureRot][0], 
                
FurnitureData[i+1][furnitureRot][1], FurnitureData[i+1][furnitureRot][2], PropertyData[FurnitureData[i+1][furniturePropertyID]][propertyInteriorWorld], PropertyData[FurnitureData[i+1][furniturePropertyID]][propertyInteriorID]);            
            
        }
    }
    return 
true;




Re: String duplicating inside of dialog. - Kane - 28.06.2017

Bump.


Re: String duplicating inside of dialog. - Dayrion - 29.06.2017

If it creates 2-3 times and doesn't create it later (rip english, apologize), the problem should come from your save system.
Also, this is bad practice, I guess, to make addition in array.
PHP Code:
Server:SQL_LoadFurniture() 

    new 
rowsfieldscount 0;  
     
    
cache_get_data(rowsfieldsm_Handle); 
     
    if(
rows){ 
        for(new 
i1rows && MAX_FURNITUREi++, j++){ 
         
            
FurnitureData[j][furnitureSQLID] = cache_get_field_content_int(i"id"m_Handle); 
                        
                        ...         
      
            
FurnitureData[j][furnitureObject] = CreateDynamicObject(FurnitureData[j][furnituresModel], FurnitureData[j][furniturePos][0], FurnitureData[j][furniturePos][1], FurnitureData[j][furniturePos][2], FurnitureData[j][furnitureRot][0],  
                
FurnitureData[j][furnitureRot][1], FurnitureData[j][furnitureRot][2], PropertyData[FurnitureData[j][furniturePropertyID]][propertyInteriorWorld], PropertyData[FurnitureData[j][furniturePropertyID]][propertyInteriorID]);             
             
        } 
    } 
    return 
true




Re: String duplicating inside of dialog. - Kane - 01.07.2017

Thanks for the help but the problem still continues to exist.

The objects are created by:
PHP Code:
FurnitureData[j][furnitureObject] = CreateDynamicObject(FurnitureData[j][furnituresModel], FurnitureData[j][furniturePos][0], FurnitureData[j][furniturePos][1], FurnitureData[j][furniturePos][2], FurnitureData[j][furnitureRot][0], 
                
FurnitureData[j][furnitureRot][1], FurnitureData[j][furnitureRot][2], PropertyData[FurnitureData[j][furniturePropertyID]][propertyInteriorWorld], PropertyData[FurnitureData[j][furniturePropertyID]][propertyInteriorID]); 
Let me be clearer.

I GMX the server, it creates. I GMX it the second time. It creates. Third time, it doesn't create. And so on, and so on. It happens randomly and I don't know why.

EVERYTHING loads but the object does NOT create.


Re: String duplicating inside of dialog. - nG Inverse - 03.07.2017

Which version from this thread of the Server:SQL_LoadFurniture()*function are you using?


Re: String duplicating inside of dialog. - Kane - 03.07.2017

This is the full code:
PHP Code:
-- 



Re: String duplicating inside of dialog. - nG Inverse - 04.07.2017

Not familiar with the sql plugin, but it would make sense the row ids would start at 0. So try settingn i and j equal to zero first. This will also effect your array as you're currently not using the 0 slot.

You also use cache_get_field content with j as reference near the bottom. That could be the issue?


Re: String duplicating inside of dialog. - Kane - 04.07.2017

That's mySQL and I'll try that.

And yeah, that probably is the issue for the name being NULL. Like I said, everything loads BUT the object sometimes. The data is read and loaded but the object doesn't get created. No clue why.


Re: String duplicating inside of dialog. - Kane - 05.07.2017

Results are same.

Like I said, the DATA loads but the object wants to be random. Loads this time, doesn't load the other time. And on and on and on.

What could even be causing this? No clue on how it's happening.

EDIT:

The only possible thing I could think of is,

since it fetches the world and interior to be made in from the property and it's possible the property doesn't load in time somehow and the object is created in void?

PHP Code:
PropertyData[FurnitureData[j][furniturePropertyID]][propertyInteriorWorld], 
PropertyData[FurnitureData[j][furniturePropertyID]][propertyInteriorID



Re: String duplicating inside of dialog. - Kane - 05.07.2017

Yep, that's the issue...

Would it be a bad idea to set a timer on loading furnitures?

I have roughly 500 + properties and it takes each at least 20 ms to load.