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;
This is how the icon,3d text and pickups are created
When server starts, all data is loaded from the database:
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 :)
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 Code:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new string[250];
for(new idx;idx<MAX_HOUSES; idx++)
{
if(IsPlayerInRangeOfPoint(playerid,1.5,HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
{
mysql_format(db, string, sizeof(string), "SELECT * FROM houses WHERE PickupID = %d", idx);
mysql_tquery(db, string, "CheckHouseOnPickup", "dd", playerid, idx);
}
}
return 1;
}
function CheckHouseOnPickup(playerid, idx)
{
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(playerid, HouseText[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", 1000, false, "i", playerid);
return 1;
}
This is how the icon,3d text and pickups are created
PHP Code:
new string[128];
format(string, sizeof(string), "House For Sale!\nPrice: %d$\nMax level: %d\nhID: %d",hprice,maxlvl, hID);
HouseInfo[hID][hPickup] = CreateDynamicPickup(1273, 1, HausX,HausY,HausZ,-1,-1,-1,100.0);
HouseInfo[hID][hText] = CreateDynamic3DTextLabel(string,orange,HausX,HausY,HausZ, 20, INVALID_PLAYER_ID, INVALID_PLAYER_ID, 0, -1, -1, -1, 100.0);
HouseInfo[hID][hMap] = CreateDynamicMapIcon(HausX,HausY,HausZ, 31, 0, 0, 0, -1, 100.0);
When server starts, all data is loaded from the database:
PHP Code:
stock LoadHouses()
{
new string[256];
mysql_format(db, string, sizeof(string), "SELECT * FROM houses ORDER by PickupID ASC");
mysql_tquery(db, string, "OnHousesLoad");
return 1;
}
function OnHousesLoad()
{
for(new i; i<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(1273, 1, arrCoords[0], arrCoords[1], arrCoords[2],-1,-1,-1,100.0);
format(string, sizeof(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], 31, 0, 0, 0, -1, 100.0);
}
else
{
HouseInfo[houseindex][hPickup] = CreateDynamicPickup(1272, 1, arrCoords[0], arrCoords[1], arrCoords[2],-1,-1,-1,100.0);
format(string, sizeof(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], 32, 0, 0, 0, -1, 100.0);
}
HouseInfo[houseindex][hText] = CreateDynamic3DTextLabel(string, orange, arrCoords[0], arrCoords[1], arrCoords[2], 20, INVALID_PLAYER_ID, INVALID_PLAYER_ID, 0, -1, -1, -1, 100.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 :)