Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function LoadSVehicles() {
- new Cache: db = mysql_query (SQL, "SELECT * FROM `svehicles` ORDER BY `svehicles`.`vID` ASC");
- new x, servervehs = 0, result[256];
- for (new i, j = cache_get_row_count (); i != j; ++i) {
- servervehs ++;
- cache_get_field_content(i, "vID", result); x = strval(result);
- ServerVehicles[x][vID] = x;
- cache_get_field_content(i, "vModel", result); ServerVehicles[x][vModel] = strval(result);
- cache_get_field_content(i, "LocationX", result); ServerVehicles[x][vLocation][0] = floatstr(result);
- cache_get_field_content(i, "LocationY", result); ServerVehicles[x][vLocation][1] = floatstr(result);
- cache_get_field_content(i, "LocationZ", result); ServerVehicles[x][vLocation][2] = floatstr(result);
- cache_get_field_content(i, "Angle", result); ServerVehicles[x][vAngle] = floatstr(result);
- cache_get_field_content(i, "Color1", result); ServerVehicles[x][vColor][0] = strval(result);
- cache_get_field_content(i, "Color2", result); ServerVehicles[x][vColor][1] = strval(result);
- cache_get_field_content(i, "Faction", result); ServerVehicles[x][vFaction] = strval(result);
- cache_get_field_content(i, "Rank", result); ServerVehicles[x][vRank] = strval(result);
- cache_get_field_content(i, "Virtual", result); ServerVehicles[x][vVirtual] = strval(result);
- if(ServerVehicles[x][vModel] >= 400 && ServerVehicles[x][vModel] <= 611) {
- ServerVehicles[x][vSpawned] = CreateVehicleEx(ServerVehicles[x][vModel], ServerVehicles[x][vLocation][0], ServerVehicles[x][vLocation][1], ServerVehicles[x][vLocation][2], ServerVehicles[x][vAngle], ServerVehicles[x][vColor][0], ServerVehicles[x][vColor][1], -1);
- new idd = ServerVehicles[x][vSpawned];
- SetVehicleVirtualWorld(idd, ServerVehicles[idd][vVirtual]);
- if(ServerVehicles[idd][vFaction] != 0) {
- if(ServerVehicles[idd][vModel] == 411) {
- new policecar = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
- SetObjectMaterialText(policecar, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
- new lspdcar = CreateObject(19419,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
- AttachObjectToVehicle(policecar, idd, 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);
- AttachObjectToVehicle(lspdcar, idd, 0.0646, 0.1661, 0.6957, 0.0000, 0.0000, 0.0000);
- printf("[debug] attached custom object to vehicle: %d", idd);
- }
- if(ServerVehicles[idd][vModel] == 560) {
- if(ServerVehicles[idd][vFaction] == 12 || ServerVehicles[idd][vFaction] == 13) {
- new taiddiobj = CreateObject(19308, 0.00000, 0.00000, 0.00000,0.00000, 0.00000, 0.00000);
- AttachObjectToVehicle(taiddiobj, idd, -0.00930, -0.23880, 0.92300,0.00000, 0.00000, 0.00000);
- }
- }
- if(ServerVehicles[idd][vModel] == 541) {
- if(ServerVehicles[idd][vFaction] == 2) {
- new object1 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- new object2 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- AttachObjectToVehicle(object1, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
- AttachObjectToVehicle(object2, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
- }
- }
- if(ServerVehicles[idd][vModel] == 525) {
- new object1 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- new object2 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- AttachObjectToVehicle(object1, idd, -0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
- AttachObjectToVehicle(object2, idd, 0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
- }
- }
- new str[64];
- if(ServerVehicles[idd][vFaction] != 0) format(str, 64, "F%d %d", ServerVehicles[idd][vFaction], idd);
- else format(str, sizeof(str), "RO-0%d", ServerVehicles[x][vSpawned]);
- SetVehicleNumberPlate(idd, str);
- }
- }
- printf("Server vehicles: %d", servervehs);
- print("Nu merge.");
- print("Merge.");
- cache_delete(db);
- return 1;
- }
- function GetVehicleID(vehicleid) {
- for(new i = 0; i < MAX_SVEHICLES; i++) {
- if(ServerVehicles[i][vSpawned] == vehicleid) return i;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement