Some SQL error.. I can't fix.
#1

Код:
enum gInfo
{
	gGATE,
	gSpeed,
	gRange,
	gModel,
	gVW,
	gInt,
	Float:gPosX,
	Float:gPosY,
	Float:gPosZ,
	Float:gRotX,
	Float:gRotY,
	Float:gRotZ,
	Float:gPosXM,
	Float:gPosYM,
	Float:gPosZM,
	Float:gRotXM,
	Float:gRotYM,
	Float:gRotZM,
	gStatus,
	gPass[24],
};
new GateInfo[MAX_GATES][gInfo];

stock LoadGates()
{
    for(new i = 0; i < MAX_GATES; i++)
    {
        if(Gate_DB_isValid(i))
		{
			new string[512], DBResult:dbr;
            format(string,sizeof(string),"SELECT speed, range, model, vw, int, pass,\
			posx, posy, posz, rotx, roty, rotz, posxm, posym, poszm, rotxm, rotym, rotzm,\
   		    FROM gate WHERE id = %d",i);
		    dbr = db_query(db_gate,string);
            db_get_field(dbr,0,GateInfo[i][gSpeed], 24);//Assignment
            db_get_field(dbr,1,GateInfo[i][gRange], 24);
            db_get_field(dbr,2,GateInfo[i][gModel], 11);
            db_get_field(dbr,3,GateInfo[i][gVW], 11);
            db_get_field(dbr,4,GateInfo[i][gInt], 11);
            db_get_field(dbr,5,GateInfo[i][gPass], 36);
            db_get_field(dbr,6,GateInfo[i][gPosX], 24);//tag mismatch
            db_get_field(dbr,7,GateInfo[i][gPosY], 24);//tag mismatch
            db_get_field(dbr,8,GateInfo[i][gPosZ], 24);//tag mismatch
            db_get_field(dbr,9,GateInfo[i][gRotX], 24);//tag mismatch
            db_get_field(dbr,10,GateInfo[i][gRotY], 24);//tag mismatch
            db_get_field(dbr,11,GateInfo[i][gRotZ], 24);//tag mismatch
            db_get_field(dbr,12,GateInfo[i][gPosXM], 24);//tag mismatch
            db_get_field(dbr,13,GateInfo[i][gPosYM], 24);//tag mismatch
            db_get_field(dbr,14,GateInfo[i][gPosZM], 24);//tag mismatch
            db_get_field(dbr,15,GateInfo[i][gRotXM], 24);//tag mismatch
            db_get_field(dbr,16,GateInfo[i][gRotYM], 24);//tag mismatch
            db_get_field(dbr,17,GateInfo[i][gRotZM], 24);//tag mismatch
		    //------------Create Dynamic Object(Create Gate)-------------------------------
            GateInfo[i][gGATE] = CreateDynamicObject(GateInfo[i][gModel], GateInfo[i][gPosX],
            GateInfo[i][gPosY], GateInfo[i][gPosZ], GateInfo[i][gRotX], GateInfo[i][gRotY],
            GateInfo[i][gRotZ], GateInfo[i][gVW], GateInfo[i][gInt], -1, 75.0);
			SpawnedGates++;
			db_free_result(dbr);
		}
	}
	return 1;
}
When I compile, those sentence will cause: tag mismatch. Why?..
Код:
            db_get_field(dbr,6,GateInfo[i][gPosX], 24);//tag mismatch
            db_get_field(dbr,7,GateInfo[i][gPosY], 24);//tag mismatch
            db_get_field(dbr,8,GateInfo[i][gPosZ], 24);//tag mismatch
            db_get_field(dbr,9,GateInfo[i][gRotX], 24);//tag mismatch
            db_get_field(dbr,10,GateInfo[i][gRotY], 24);//tag mismatch
            db_get_field(dbr,11,GateInfo[i][gRotZ], 24);//tag mismatch
            db_get_field(dbr,12,GateInfo[i][gPosXM], 24);//tag mismatch
            db_get_field(dbr,13,GateInfo[i][gPosYM], 24);//tag mismatch
            db_get_field(dbr,14,GateInfo[i][gPosZM], 24);//tag mismatch
            db_get_field(dbr,15,GateInfo[i][gRotXM], 24);//tag mismatch
            db_get_field(dbr,16,GateInfo[i][gRotYM], 24);//tag mismatch
            db_get_field(dbr,17,GateInfo[i][gRotZM], 24);//tag mismatch
When I remove them, there will be no warnings...
Reply
#2

db_get_field expects a string. You are passing ints and floats. I'd suggest reusing "string" variable as a temporary storage. Lines without tag mismatch will only store first character of result (so, "12345" will return ascii representation of "1")

pawn Код:
db_get_field(dbr,2,GateInfo[i][gModel], 11);
db_get_field(dbr,6,GateInfo[i][gPosX], 24);

//changes to
db_get_field(dbr,2,string, 11);
GateInfo[i][gModel] = strval(string);

db_get_field(dbr,6,string, 24);
GateInfo[i][gPosX] = floatstr(string);
#e: Oh, there seems to be db_get_field_int and db_get_field_float. Use those instead
Reply
#3

Thanks. I'll try..
Reply
#4

lol yep I succeed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)