04.07.2014, 16:36
I have made this park command so I can save vehicles positions. but It doesnt work
. I think it saves correctly, but Its not loading the vehicles when I restart the server...
Please help.
Code:

Please help.
Code:
Код:
CMD:park(playerid, params[]) { if(pInfo[playerid][pModerator] > 2 || pInfo[playerid][pAdminLevel] >= 1) { new vehid; if(sscanf(params, "i", vehid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /park [vehid]"); if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) { SendClientMessage(playerid, COLOR_GREY, "You are not driving the vehicle!"); return 1; } new id = GetVehicleID(GetPlayerVehicleID(playerid)); new Query[500]; new Float: X, Float: Y, Float: Z, Float: R; GetVehiclePos(vehid, X, Y, Z); GetVehicleZAngle(vehid, R); mysql_format(dbHandle,Query, sizeof(Query), "UPDATE `vehicles` SET `PosX` = '%f', `PosY` = '%f', `PosZ` = '%f', `PosA` = '%f' WHERE `ID` = '%d'", X, Y, Z, R, vehid); mysql_query(dbHandle,Query,false); mysql_format(dbHandle,Query, sizeof(Query), "UPDATE `vehicles` SET `Color1` = '%d', `Color2` = '%d' WHERE `ID` = '%d'", vInfo[id][vColor1], vInfo[id][vColor2], vehid); new str[128]; format(str, sizeof(str), "The vehicles position is X:%f Y:%f Z:%f", X, Y, Z); SendClientMessage(playerid, -1, str); DestroyVehicle(vehid); VehicleID[vehid] = AddStaticVehicle(vInfo[id][vModel], X, Y, Z, R, vInfo[id][vColor1], vInfo[id][vColor2]); } else return SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use that command."); return 1; }