19.08.2011, 13:40
Hello.
I connect to my DB.
I sab_zones in a table with columns id, minx, miny, maxx, maxy, capture_x, capture_y, capture_z.
The captures are all 0 and float.
The min and max define the contours of the zones.
I have ordered / checkpoint to add the coordinates of the checkpoints of each capture zone in my BDD.
The problem is that the checkpoint is created, I commit message, but nothing is changed in my database!
Here is my code:
I connect to my DB.
I sab_zones in a table with columns id, minx, miny, maxx, maxy, capture_x, capture_y, capture_z.
The captures are all 0 and float.
The min and max define the contours of the zones.
I have ordered / checkpoint to add the coordinates of the checkpoints of each capture zone in my BDD.
The problem is that the checkpoint is created, I commit message, but nothing is changed in my database!
Here is my code:
Код:
if(strcmp("/checkpoint", cmd, true) == 0) {
new query[400], Float:minx, Float:miny, Float:maxx, Float:maxy, req[100], Float:x, Float:y, Float:z, id;
mysql_query("SELECT * FROM `sab_zones`");
mysql_store_result();
while(mysql_retrieve_row()) {
mysql_fetch_field_row(req, "zone_minx"); minx = strval(req);
mysql_fetch_field_row(req, "zone_miny"); miny = strval(req);
mysql_fetch_field_row(req, "zone_maxx"); maxx = strval(req);
mysql_fetch_field_row(req, "zone_maxy"); maxy = strval(req);
if(IsPlayerInRectangle(playerid, minx, miny, maxx, maxy)) {
mysql_fetch_field_row(req, "id");
id = strval(req);
GetPlayerPos(playerid, x, y, z);
format(query, 400, "UPDATE `sab_zones` SET capture_x = '%f', capture_y = '%f', capture_z = '%f' WHERE id = %d", x, y, z, id);
mysql_query(query);
SendClientMessage(playerid, SUCCESS, "Le checkpoint a йtй ajoutй.");
SetPlayerCheckpoint(playerid, x, y, z, 4.0);
}
}
mysql_free_result();
return 1;
}

