confused with Mysql or &.
#1

Hello everybody.
just get a confusion about Mysql or maybe my code is wrong.

look:

Код:
Method A:

stock bool:GetPlayerCurrentStates(playerid, &Float:health, &Float:armour, &Float:positionX, &Float:positionY, &Float:positionZ, &interior, &world) {
    new query[MAX_PLAYER_NAME];
    mysql_format(Mysql, query, GENERAL_QUERY_LENGTH,"SELECT * FROM `current` WHERE `id` = '%i' LIMIT 1", GetPlayerID(playerid));
    mysql_query(Mysql, query, true);
    if(!cache_num_rows()) return false;
    health     = cache_get_field_content_float(0, "health");
    armour     = cache_get_field_content_float(0, "armour");
    positionX  = cache_get_field_content_float(0, "positionX");
    positionY  = cache_get_field_content_float(0, "positionY");
    positionZ  = cache_get_field_content_float(0, "positionZ");
    interior   = cache_get_field_content_int(0, "interior");
    world      = cache_get_field_content_int(0, "world");
    return true;
}

//------------------------------------------------------------------------------------

Method B:

stock bool:GetPlayerCurrentStates(playerid, &Float:health, &Float:armour, &Float:positionX, &Float:positionY, &Float:positionZ, &interior, &world) {
    new query[GENERAL_QUERY_LENGTH];
    mysql_format(Mysql, query, GENERAL_QUERY_LENGTH,"SELECT `states` FROM `player` WHERE `id` = '%i' LIMIT 1", GetPlayerID(playerid));
    mysql_query(Mysql, query, true);
    if(!cache_num_rows()) return false;
    new states[64];
    cache_get_field_content(0, "states", states);
    sscanf(states, "p<,>fffffii", health, armour, positionX, positionY, positionZ, interior, world);
    return true;
}
Код:
PUBLIC:OnPlayerLoggedIn(playerid) {
	new Float:health,
	    Float:armour,
	    Float:positionX,
	    Float:positionY,
	    Float:positionZ,
		interior,
		world;
	GetPlayerCurrentStates(playerid, health, armour, positionX, positionY, positionZ, interior, world);
	printf("%f,%f,%f,%f,%f,%i,%i", health, armour, positionX, positionY, positionZ, interior, world);
        ......
}
result:

Method A: Will NOT out put the "printf" or I mean its stop running code down this function;
Method B: run success.


I think this problem is "&"
but I use it in other function which can run normally.


So......
Anyone can point whats wrong with it?

Thank you for reply.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)