Dynamic CP not loading on GMX (MySQL)
#1

Hey,

So I've created an org system, which has a CP using Incognito's Streamer, upon creating the org dynamically, the org's CP appears in game , and is correctly saved to the DB along with all the other org information (Name, vehicle limit, skins etc).

However upon a restarting the server, all of the org details load into the server from the db, as I can check what's loaded by typing /orgs, but weirdly the Dynamic CP isn't recreated using the saved coords loaded from the DB, i've tried updating the streamer too, for all players within range of the CP, yet still no avail, the loading code is posted below. Any help would be appreciated.
Код:
	mysql_tquery(ServerMySQL, "SELECT * FROM Organisations", "LoadOrgs", "");
The above code is placed within the ongamemodeinit callback.

Код:
public LoadOrgs()
{
	new rows =cache_num_rows();
	new Float:x,Float:y,Float:z;
	if(rows)
	{
		new id,loaded;
		while(loaded < rows)
		{
			id=cache_get_field_content_int(loaded, "ID");
			cache_get_field_content(loaded, "Name", oInfo[id][Name], .max_len =40 );
			oInfo[id][Type]=cache_get_field_content_int(loaded, "Type");
			oInfo[id][Color]=cache_get_field_content_int(loaded, "Color");
			cache_get_field_content(loaded, "Leader", oInfo[id][oLeader], .max_len =40 );
			oInfo[id][Skins][0]=cache_get_field_content_int(loaded, "Skin1");
			oInfo[id][Skins][1]=cache_get_field_content_int(loaded, "Skin2");
			oInfo[id][Skins][2]=cache_get_field_content_int(loaded, "Skin3");
			oInfo[id][Members]=cache_get_field_content_int(loaded, "Members");
			oInfo[id][Vehicles]=cache_get_field_content_int(loaded, "Vehicles");
			oInfo[id][MemLimit]=cache_get_field_content_int(loaded, "MemberLimit");
			oInfo[id][VehLimit]=cache_get_field_content_int(loaded, "VehicleLimit");
			oInfo[id][CP][0]=cache_get_field_content_float(loaded, "CPX");
			oInfo[id][CP][1]=cache_get_field_content_float(loaded, "CPY");
			oInfo[id][CP][2]=cache_get_field_content_float(loaded, "CPZ");
			oInfo[id][Wep][0]=cache_get_field_content_int(loaded, "Wep1");
			oInfo[id][WepAmmo][0]=cache_get_field_content_int(loaded, "Wep1Ammo");
			oInfo[id][Wep][1]=cache_get_field_content_int(loaded, "Wep2");
			oInfo[id][WepAmmo][1]=cache_get_field_content_int(loaded, "Wep2Ammo");
			oInfo[id][Wep][2]=cache_get_field_content_int(loaded, "Wep3");
			oInfo[id][WepAmmo][2]=cache_get_field_content_int(loaded, "Wep3Ammo");
			oInfo[id][Wep][3]=cache_get_field_content_int(loaded, "Wep4");
			oInfo[id][WepAmmo][3]=cache_get_field_content_int(loaded, "Wep4Ammo");
			oInfo[id][oBalance]=cache_get_field_content_int(loaded, "OrgBalance");
			oInfo[id][oWage]=cache_get_field_content_int(loaded, "OrgWage");
			x=cache_get_field_content_float(loaded, "CPX");
			y=cache_get_field_content_float(loaded, "CPY");
			z=cache_get_field_content_float(loaded, "CPZ");
			oInfo[id][check]=CreateDynamicCP(x,y,z,1.3,-1,-1,-1,100.0);
			Iter_Add(Orgs, id);
			loaded++;
			
		}
	}
	return 1;
}
I am aware that there are duplicate values (Floats x,y,z) which were an attempt at fixing the issue, yet still nothing. The LoadOrgs function, is also forwarded.
Thanks for any support!
Reply
#2

Код:
public LoadOrgs()
{
    new rows,fields;
    cache_get_data(rows,fields);
    new id;
    for(new i = 0; i < rows; i++)
    {
        id = cache_get_field_content_int(i, "ID");
        cache_get_field_content(i, "Name", oInfo[id][Name], .max_len =40 );
        oInfo[id][Type]=cache_get_field_content_int(i, "Type");
        oInfo[id][Color]=cache_get_field_content_int(i, "Color");
        cache_get_field_content(i, "Leader", oInfo[id][oLeader], .max_len =40 );
        oInfo[id][Skins][0]=cache_get_field_content_int(i, "Skin1");
        oInfo[id][Skins][1]=cache_get_field_content_int(i, "Skin2");
        oInfo[id][Skins][2]=cache_get_field_content_int(i, "Skin3");
        oInfo[id][Members]=cache_get_field_content_int(i, "Members");
        oInfo[id][Vehicles]=cache_get_field_content_int(i, "Vehicles");
        oInfo[id][MemLimit]=cache_get_field_content_int(i, "MemberLimit");
        oInfo[id][VehLimit]=cache_get_field_content_int(i, "VehicleLimit");
        oInfo[id][CP][0]=cache_get_field_content_float(i, "CPX");
        oInfo[id][CP][1]=cache_get_field_content_float(i, "CPY");
        oInfo[id][CP][2]=cache_get_field_content_float(i, "CPZ");
        oInfo[id][Wep][0]=cache_get_field_content_int(i, "Wep1");
        oInfo[id][WepAmmo][0]=cache_get_field_content_int(i, "Wep1Ammo");
        oInfo[id][Wep][1]=cache_get_field_content_int(i, "Wep2");
        oInfo[id][WepAmmo][1]=cache_get_field_content_int(i, "Wep2Ammo");
        oInfo[id][Wep][2]=cache_get_field_content_int(i, "Wep3");
        oInfo[id][WepAmmo][2]=cache_get_field_content_int(i, "Wep3Ammo");
        oInfo[id][Wep][3]=cache_get_field_content_int(i, "Wep4");
        oInfo[id][WepAmmo][3]=cache_get_field_content_int(i, "Wep4Ammo");
        oInfo[id][oBalance]=cache_get_field_content_int(i, "OrgBalance");
        oInfo[id][oWage]=cache_get_field_content_int(i, "OrgWage");
        x=cache_get_field_content_float(i, "CPX");
        y=cache_get_field_content_float(i, "CPY");
        z=cache_get_field_content_float(i, "CPZ");
        oInfo[id][check]=CreateDynamicCP(x,y,z,1.3,-1,-1,-1,100.0);
        Iter_Add(Orgs, id);
    }
    return 1;
}
Reply
#3

Hey man,


thanks for the suggestion, but they still don't appear, it's literally only the CP that doesn't show , everything else works.
Reply
#4

Try replace CreateDynamicCP:
Код:
oInfo[id][check] = CreateDynamicCP(x, y, z, 1.3, -1, -1, -1, STREAMER_CP_SD, -1, 0);
and add:
Код:
printf("x=%.f y=%.f z=%.f"x,y,z);
after createdynamiccp
Reply
#5

Hey,


tried the print statement and got this

x=1145.219970,y=22.768999,z=22.768999


which matches the coords of the proposed cp from the db, it's just not creating/showing the cp.
Reply
#6

Bump? It still wont appear, yet the coords are correctly loaded.
Reply
#7

How you create the CP's before, i mean before restart
Reply
#8

oInfo[id][check]=CreateDynamicCP(cpx,cpy,cpz,1.3,-1,-1,-1,100.0);


which is pretty much identical from when they are reloaded from the db
Reply
#9

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)