Client crashes randomly (idk if related to house pickups or t.draws)
#1

Hello!

Recently clients on my server has been crashing (a few of them at least) when they spawn at their house pickup,
for example when they join the server. I use the blue pickup for bought houses, and when someone stand on the
pickup, they will have a textdraw shown on their screen with basic information about the property.
I also face that someone crashes upon joining the races, but that happened only with one guy, so i chose to exclude it from this.

All the clients that crash, do have the opcode
http://gtag.gtagaming.com/opcode-database/opcode/06BD/
0x6BD in their dumps - which is described as "Checks if there is something in the range of the two specified points."

Here are my codes;

Pickup code;
PHP код:
public OnPlayerPickUpDynamicPickup(playeridpickupid)
{
    new 
string[250];
    for(new 
idx;idx<MAX_HOUSESidx++)
    {
        if(
IsPlayerInRangeOfPoint(playerid,1.5,HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
        {
            
mysql_format(dbstringsizeof(string), "SELECT * FROM houses WHERE PickupID = %d"idx);
            
mysql_tquery(dbstring"CheckHouseOnPickup""dd"playerididx);
        }
    }
    return 
1;
}
function 
CheckHouseOnPickup(playerididx)
{
    new 
howner[25];
    new 
string[145];
    if(
cache_get_field_content_int(0"HouseUsed") == 1//houseused
    
{
        
cache_get_field_content(0"Owner"howner);
        if(
cache_get_field_content_int(0"HouseLock") == 1//houselock
        
{
      
            if(
idx == AccInfo[playerid][pHouse])
            {
                
format(string,sizeof(string),"House owner: %s~n~House level: %d~n~This house is locked!~n~This house is yours!",howner,cache_get_field_content_int(0"HouseLvl"));
                
TextDrawSetString(HouseText[playerid],string);
                
// HouseLocked[playerid] = 0;
                
HouseOwner[playerid] = true;
            }
            else
            {
                
format(string,sizeof(string),"House owner: %s~n~House level: %d~n~This house is locked!",howner,cache_get_field_content_int(0"HouseLvl"));
                
TextDrawSetString(HouseText[playerid],string);
                
// HouseLocked[playerid] = 1;
                
HouseOwner[playerid] = false;
            }
        }
        else
        {
            if(
idx == AccInfo[playerid][pHouse])
            {
                
HouseOwner[playerid] = true;
                
// HouseLocked[playerid] = 0;
                
format(string,sizeof(string),"House owner: %s~n~House level: %d~n~This house is unlocked!~n~Type /enter to enter house~n~This house is yours!",howner,cache_get_field_content_int(0"HouseLvl"));
                
TextDrawSetString(HouseText[playerid],string);
            }
            else
            {
                
format(string,sizeof(string),"House owner: %s~n~House level: %d~n~This house is unlocked!~n~Type /enter to enter house",howner,cache_get_field_content_int(0"HouseLvl"));
                
TextDrawSetString(HouseText[playerid],string);
                
// HouseLocked[playerid] = 0;
                
HouseOwner[playerid] = false;
            }
        }
    }
    else
    {
        if(
cache_get_field_content_int(0"Buyable") == 0//buyable?
        
{
            
TextDrawSetString(HouseText[playerid],"~r~This house is not for sale!");
            
HouseOwner[playerid] = false;
            
// HouseLocked[playerid] = 2;
        
}
        else
        {
            
format(string,sizeof(string),"This house is for sale!~n~Price: %d$~n~Max level: %d~n~Type /buy to buy house!",cache_get_field_content_int(0"Price"), cache_get_field_content_int(0"MaxLvl"));
            
TextDrawSetString(HouseText[playerid],string);
            
HouseOwner[playerid] = false;
            
// HouseLocked[playerid] = 2;
        
}
    }
    
TextDrawShowForPlayer(playeridHouseText[playerid]);
    
// GetPlayerPos(playerid,HouseX[playerid],HouseY[playerid],HouseZ[playerid]);
    //HouseLevel[playerid] = strval(felter[3]);
    // HousePrice[playerid] = strval(felter[7]);
    // HouseMaxLevel[playerid] = strval(felter[8]);
    
InHouse[playerid] = false;
    
// HouseID[playerid] = pickupid;
    
TempHouseZ[playerid] = HouseInfo[idx][hZ];
    
TempHouseX[playerid] = HouseInfo[idx][hX];
    
TempHouseY[playerid] = HouseInfo[idx][hY];
    
SetTimerEx("HouseCheck"1000false"i"playerid);
    
    return 
1;

This is how the icon,3d text and pickups are created
PHP код:
new string[128];
format(stringsizeof(string), "House For Sale!\nPrice: %d$\nMax level: %d\nhID: %d",hprice,maxlvlhID);
HouseInfo[hID][hPickup] = CreateDynamicPickup(12731HausX,HausY,HausZ,-1,-1,-1,100.0);
    
HouseInfo[hID][hText] = CreateDynamic3DTextLabel(string,orange,HausX,HausY,HausZ20INVALID_PLAYER_IDINVALID_PLAYER_ID0, -1, -1, -1100.0);
    
HouseInfo[hID][hMap] = CreateDynamicMapIcon(HausX,HausY,HausZ31000, -1100.0); 

When server starts, all data is loaded from the database:
PHP код:
stock LoadHouses()
{
    new 
string[256];
    
mysql_format(dbstringsizeof(string), "SELECT * FROM houses ORDER by PickupID ASC");
    
mysql_tquery(dbstring"OnHousesLoad");
        
    return 
1;
}
function 
OnHousesLoad()
{
    for(new 
ii<cache_get_row_count(); i++) // loop through rows 
    
{
        new 
coordinates[36];
        new 
string[150];
        
cache_get_field_content(i"HousePos"coordinates);
        new 
Float:arrCoords[3];
        
sscanf(coordinates,"p<,>a<f>[49]",arrCoords);
        new 
houseindex cache_get_field_content_int(i"PickupID");
        new 
housetext[50];
        new 
howner[25];
        
cache_get_field_content(i"Owner"howner);
        
cache_get_field_content(i"HouseText"housetext);
        
HouseInfo[houseindex][hLevel] = cache_get_field_content_int(i"HouseLvl");
        
HouseInfo[houseindex][hPrice] = cache_get_field_content_int(i"Price");
        
HouseInfo[houseindex][hStatus] = cache_get_field_content_int(i"HouseLock"); //0 open 1 locked
        
format(HouseInfo[houseindex][hOwner], 25"%s"howner);
        
HouseInfo[houseindex][hX] = arrCoords[0];
        
HouseInfo[houseindex][hY] = arrCoords[1];
        
HouseInfo[houseindex][hZ] = arrCoords[2];
        
HouseInfo[houseindex][MaxLevel] = cache_get_field_content_int(i"MaxLvl");
        
HouseInfo[houseindex][hBuyable] = cache_get_field_content_int(i"Buyable");
        
HouseInfo[houseindex][HouseUsed] = cache_get_field_content_int(i"HouseUsed");
        
//create pickups and texts:
        
if(HouseInfo[houseindex][HouseUsed] == 0//if houseused == 0, not owned
        
{
            
HouseInfo[houseindex][hPickup] = CreateDynamicPickup(12731arrCoords[0], arrCoords[1], arrCoords[2],-1,-1,-1,100.0);
            
format(stringsizeof(string), "House For Sale!\nPrice: %d$\nMax level: %d\nhID: %d"HouseInfo[houseindex][hPrice],HouseInfo[houseindex][MaxLevel], houseindex);
            
HouseInfo[houseindex][hMap] = CreateDynamicMapIcon(arrCoords[0], arrCoords[1], arrCoords[2], 31000, -1100.0);
        }
        else
        {
            
HouseInfo[houseindex][hPickup] = CreateDynamicPickup(12721arrCoords[0], arrCoords[1], arrCoords[2],-1,-1,-1,100.0);
            
format(stringsizeof(string), "%s\nHouse owner: %s\nHouse level: %d\nhID: %d"housetext,howner,HouseInfo[houseindex][hLevel], houseindex);
            
// format(HouseInfo[x],50,string);
            
format(hInformation[houseindex], 50"House owner: %s\nHouse level: %d\nhID: %d"howner,HouseInfo[houseindex][hLevel], houseindex);
            
HouseInfo[houseindex][hMap] =  CreateDynamicMapIcon(arrCoords[0], arrCoords[1], arrCoords[2], 32000, -1100.0);
        }
        
HouseInfo[houseindex][hText] =  CreateDynamic3DTextLabel(stringorangearrCoords[0], arrCoords[1], arrCoords[2], 20INVALID_PLAYER_IDINVALID_PLAYER_ID0, -1, -1, -1100.0);
    }
    return 
1;

Let me know if any other code is needed.

I am a bit stuck finding out what the cause is for my clients to crash - It's not happening all the time, it's not happening to everyone, but it happens - which makes it hard to backtrace.

I didn't find anything unusual in my codes, that's why I'm asking for someone else to look with a fresh mind and new eyes.
Thanks for helping out
Reply
#2

too many code
sql....

delete all code and left only crash code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)