Код:
for(i = 0; i < MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
GetPlayerPos(i, Xc, Yc, Zc);
positions[i][0] = Xc;
positions[i][1] = Yc;
}
else{
positions[i][0] = 3000;
}
new Query[1024];
format(Query, sizeof(Query), "DELETE FROM `samp`.`locations` WHERE `locations`.`playerid` = %d;", i);
mysql_query(Query);
format(Query, sizeof(Query), "INSERT INTO `samp`.`locations` ( `playerid` , `X` , `Y` ) VALUES ( '%d', '%f', '%f' )", i, positions[i][0], positions[i][1]);
mysql_query(Query);
}
The way it works now takes a lot of cpu, I guess there should be an easy way. But I don't exactly know how.