CMD:printtrailer(playerid, params[]) { new string[100], Float:tmpCoords[3], trailerID, vehicleid = GetPlayerVehicleID(playerid); // get the id of the vehicle the player is driving trailerID = GetVehicleTrailer(vehicleid); // get the ID of the trailer attached to the current vehicle new trailerModel = GetVehicleModel(trailerID); // get the model of the trailer GetVehiclePos(trailerID, tmpCoords[0], tmpCoords[1], tmpCoords[2]); // get the position of the trailer format(string, sizeof string, "CreateVehicle(%d, %f, %f, %f, 0, -1, -1, 6000000);", trailerModel, tmpCoords[0], tmpCoords[1], tmpCoords[2]); SendClientMessageToAll(-1, string); return 1; }
yes, you can use ffile, mysql, y_ini, dini...
you can use all of these plus many more, but most importantly, it's the function you'll be doing to extract the vehicle's coordinates, here sscanf helps you a lot. I had such a function done on the files but I moved it to mysql. |
stock SaveTrailers(trailerID) {
new
sz_Entry[128],
File: fileHandle = fopen("trailers.txt", io_append),
Float:tmpCoords[3];
new trailerModel = GetVehicleModel(trailerID);
GetVehiclePos(trailerID, tmpCoords[0], tmpCoords[1], tmpCoords[2]);
format(sz_Entry, sizeof(sz_Entry), "CreateVehicle(%d, %f, %f, %f, 0, -1, -1, 6000000);", trailerModel, tmpCoords[0], tmpCoords[1], tmpCoords[2]);
fwrite(fileHandle, sz_Entry);
return fclose(fileHandle);
}
CMD:printtrailer(playerid, params[])
{
SaveTrailers(GetPlayerVehicleID(playerid));
SendClientMessageToAll(-1, "Saved this Trailer");
return 1;
}
Try something like this
PHP код:
PHP код:
|
But tho i do i send it thru text? i want to copy and paste it into my gamemode.
and it will be serverside vehicles. But tho what is better server sides vehicles or saving in mysql vehicles? and why? |