MySQL problem
#1

okay i've made dynamic gate system, the problem is it doesn't fill up full information.... here's my codes, p/s i've made dynamic mapicon/3dtextlabel and it works so confusing..

here's my codes

Код:
stock SaveMap(mapid)
{
	new
	    query[200];

 	format(query, sizeof(query), "UPDATE `maps` SET `MapObjectID` = '%d', `ObjectX` = '%.4f', `ObjectY` = '%.4f', `ObjectZ` = '%.4f', `ObjectRotX` = '%.4f', `ObjectRotY` = '%.4f' `ObjectRotZ` = '%.4f', `ObjectVW` = '%d', `ObjectINT` = '%d' WHERE `MapID` = '%d'",
		Maps[mapid][MapObjectID],
		Maps[mapid][ObjectX],
		Maps[mapid][ObjectY],
		Maps[mapid][ObjectZ],
		Maps[mapid][ObjectRotX],
		Maps[mapid][ObjectRotY],
		Maps[mapid][ObjectRotZ],
		Maps[mapid][ObjectVW],
		Maps[mapid][ObjectINT],
		Maps[mapid][MapID]
	);
	return mysql_tquery(g_iHandle, query);
}

Function LoadMaps()
{
    static
	    rows,
	    fields;

	cache_get_data(rows, fields, g_iHandle);

	for (new i = 0; i < rows; i ++) if (i < MAX_MAPS)
	{
	    Maps[i][MapExists] = true;
	    
	    Maps[i][MapID] = cache_get_field_int(i, "MapID");
		Maps[i][MapObjectID] = cache_get_field_int(i, "MapObjectID");
		Maps[i][ObjectX] = cache_get_field_float(i, "ObjectX");
		Maps[i][ObjectY] = cache_get_field_float(i, "ObjectY");
		Maps[i][ObjectZ] = cache_get_field_float(i, "ObjectZ");
		Maps[i][ObjectRotX] = cache_get_field_float(i, "ObjectRotX");
		Maps[i][ObjectRotY] = cache_get_field_float(i, "ObjectRotY");
		Maps[i][ObjectRotZ] = cache_get_field_float(i, "ObjectRotZ");
		Maps[i][ObjectVW] = cache_get_field_int(i, "ObjectVW");
		Maps[i][ObjectINT] =  cache_get_field_int(i, "ObjectINT");

		MAP_Refresh(i);
	}
	return 1;
}
Код:
stock MAP_Create(playerid)
{
    new
	    Float:x,
	    Float:y,
	    Float:z,
	    Float:angle;

	if (GetPlayerPos(playerid, x, y, z) && GetPlayerFacingAngle(playerid, angle))
	{
		for (new i = 0; i < MAX_MAPS; i ++) if (!Maps[i][MapExists])
		{
		    Maps[i][MapExists] = true;
         	Maps[i][MapObjectID] = 980;

          	Maps[i][ObjectX] = x + (3.0 * floatcos(-angle, degrees));
           	Maps[i][ObjectY] = y + (3.0 * floatcos(-angle, degrees));
            Maps[i][ObjectZ] = z;

            Maps[i][ObjectRotX] = 0;
            Maps[i][ObjectRotY] = 0;
            Maps[i][ObjectRotZ] = angle;

            Maps[i][ObjectVW] = GetPlayerVirtualWorld(playerid);
            Maps[i][ObjectINT] = GetPlayerInterior(playerid);

			MAP_Refresh(i);
			mysql_tquery(g_iHandle, "INSERT INTO `maps` (`MapObjectID`) VALUES(980)", "OnMapCreated", "d", i);

			return i;
		}
	}
	return -1;
}
Код:
stock MAP_Refresh(mid)
{
	if (mid != -1 && Maps[mid][MapExists])
	{
 		if (IsValidDynamicObject(Maps[mid][MapObject]))
	        DestroyDynamicObject(Maps[mid][MapObject]);

		Maps[mid][MapObject] = CreateDynamicObject(Maps[mid][MapObjectID], Maps[mid][ObjectX], Maps[mid][ObjectY], Maps[mid][ObjectZ], Maps[mid][ObjectRotX], Maps[mid][ObjectRotY], Maps[mid][ObjectRotZ], Maps[mid][ObjectVW], Maps[mid][ObjectINT]);
		return 1;
	}
	return 1;
}
and here's n sql save
http://prntscr.com/7xd24k

and doesn't show any error or something... please help.
Reply
#2

Quote:

forward OnMAPCreated(mid);
public OnMAPCreated(mid)
{
if (mid == -1 || !Maps[mid][MapExists])
return 0;

Maps[mid][MapID] = cache_insert_id(g_iHandle);
SaveMap(mid);

return 1;
}

BUMP
Reply
#3

Hello!
PHP код:
stock SaveMap(mapid)
{
    new
        
query[200];
     
format(querysizeof(query), "UPDATE `maps` SET `MapObjectID` = '%d', `ObjectX` = '%.4f', `ObjectY` = '%.4f', `ObjectZ` = '%.4f', `ObjectRotX` = '%.4f', `ObjectRotY` = '%.4f' `ObjectRotZ` = '%.4f', `ObjectVW` = '%d', `ObjectINT` = '%d' WHERE `MapID` = '%d'",
        
Maps[mapid][MapObjectID],
        
Maps[mapid][ObjectX],
        
Maps[mapid][ObjectY],
        
Maps[mapid][ObjectZ],
        
Maps[mapid][ObjectRotX],
        
Maps[mapid][ObjectRotY],
        
Maps[mapid][ObjectRotZ],
        
Maps[mapid][ObjectVW],
        
Maps[mapid][ObjectINT],
        
Maps[mapid][MapID]
    );
    return 
mysql_tquery(g_iHandlequery);

to
PHP код:
stock SaveMap(mapid)
{
    new 
query[400];
     
format(querysizeof(query), "UPDATE `maps` SET `MapObjectID` = '%d', `ObjectX` = '%.4f', `ObjectY` = '%.4f', `ObjectZ` = '%.4f', `ObjectRotX` = '%.4f', `ObjectRotY` = '%.4f' `ObjectRotZ` = '%.4f', `ObjectVW` = '%d', `ObjectINT` = '%d' WHERE `MapID` = '%d'",
        
Maps[mapid][MapObjectID],
        
Maps[mapid][ObjectX],
        
Maps[mapid][ObjectY],
        
Maps[mapid][ObjectZ],
        
Maps[mapid][ObjectRotX],
        
Maps[mapid][ObjectRotY],
        
Maps[mapid][ObjectRotZ],
        
Maps[mapid][ObjectVW],
        
Maps[mapid][ObjectINT],
        
Maps[mapid][MapID]
    );
    return 
mysql_tquery(g_iHandlequery);

Your string length was too small.
Reply
#4

it does save the same information.

EDIT: i've found an error second lemme see it
Reply
#5

Is the problem solved? ^^
Reply
#6

Nope... there was a problem here.
`ObjectRotY` = '%.4f' `ObjectRotZ` = '%.4f'
and i fixed it with ',' but still.. it doesn't save everything
Reply
#7

What is printing in the mysql-log? (mysql.log)
Reply
#8

Nothing... there's no errors
Reply
#9

ask the creator of this script

and d0nt c0py it n3xt tim3 m8
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)