30.09.2009, 17:53
I'll have problem, when i write to command line /park it says Server: Unknown command.
I am hooked alltime to catch that error, but i just simple don't just see any problem there...
Header:
Command code:
...And SaveDynamicCars() public...
... and san_andreas.txt format
This script is meaned to work on 0.3 version.
I am hooked alltime to catch that error, but i just simple don't just see any problem there...
Header:
Код:
forward SaveDynamicCars();
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { // Park your vehicle if(strcmp(cmdtext, "/park",true) == 0) { new vehicleid = GetPlayerVehicleID(playerid); new car = GetPlayerVehicleID(playerid) - 1; new Float:x,Float:y,Float:z; new Float:a; GetVehiclePos(vehicleid, x, y, z); // Gets vehicle pos GetVehicleZAngle(vehicleid, a); // Gets vehicle angle DynamicCars[car][CarX] = x; // Coords DynamicCars[car][CarY] = y; // Coords DynamicCars[car][CarZ] = z; // Coords DynamicCars[car][CarAngle] = a; // Angle DestroyVehicle(vehicleid); // Destoroy car CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1); // Creates car SaveDynamicCars(); // Save cars to file SendClientMessage(playerid,COLOR_WHITE,"SERVER: Your vehicle is now parked to here."); return 1; } return 1; }
Код:
public SaveDynamicCars() { new idx; new File: file2; while (idx < sizeof(DynamicCars)) { new coordsstring[512]; format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d %d\n", DynamicCars[idx][CarModel], DynamicCars[idx][CarX], DynamicCars[idx][CarY], DynamicCars[idx][CarZ], DynamicCars[idx][CarAngle], DynamicCars[idx][CarColor1], DynamicCars[idx][CarColor2]); if(idx == 0) { file2 = fopen("vehicles/san_andreas.txt", io_write); } else { file2 = fopen("vehicles/san_andreas.txt", io_append); } fwrite(file2, coordsstring); idx++; fclose(file2); } return 1; }
Код:
modelid, Float:spawn_x, Float:spawn_y,Float:spawn_z, Float:angle, color1, color2 ;