Print Trailer to txt
#1

How can i print it thru text note pad?
Should i use ffile?
Код:
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;
}
Reply
#2

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.
Reply
#3

Quote:
Originally Posted by Florin48
Посмотреть сообщение
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.
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?
Reply
#4

Try something like this

PHP код:
stock SaveTrailers(trailerID) {
    new
        
sz_Entry[128],
        
FilefileHandle fopen("trailers.txt"io_append),
        
Float:tmpCoords[3];
    new 
trailerModel GetVehicleModel(trailerID);
    
GetVehiclePos(trailerIDtmpCoords[0], tmpCoords[1], tmpCoords[2]);
    
format(sz_Entrysizeof(sz_Entry), "CreateVehicle(%d, %f, %f, %f, 0, -1, -1, 6000000);"trailerModeltmpCoords[0], tmpCoords[1], tmpCoords[2]);
    
fwrite(fileHandlesz_Entry);
    return 
fclose(fileHandle);

PHP код:
CMD:printtrailer(playeridparams[])
{
    
SaveTrailers(GetPlayerVehicleID(playerid));
    
SendClientMessageToAll(-1"Saved this Trailer");
    return 
1;

Not tested it, but it should work.
Reply
#5

Quote:
Originally Posted by ItsRobinson
Посмотреть сообщение
Try something like this

PHP код:
stock SaveTrailers(trailerID) {
    new
        
sz_Entry[128],
        
FilefileHandle fopen("trailers.txt"io_append),
        
Float:tmpCoords[3];
    new 
trailerModel GetVehicleModel(trailerID);
    
GetVehiclePos(trailerIDtmpCoords[0], tmpCoords[1], tmpCoords[2]);
    
format(sz_Entrysizeof(sz_Entry), "CreateVehicle(%d, %f, %f, %f, 0, -1, -1, 6000000);"trailerModeltmpCoords[0], tmpCoords[1], tmpCoords[2]);
    
fwrite(fileHandlesz_Entry);
    return 
fclose(fileHandle);

PHP код:
CMD:printtrailer(playeridparams[])
{
    
SaveTrailers(GetPlayerVehicleID(playerid));
    
SendClientMessageToAll(-1"Saved this Trailer");
    return 
1;

Not tested it, but it should work.
Thank you it worked.
Reply
#6

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
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?
I have used mysql because I have several rescue systems that are all in mysql and I wanted to be everything that resembles mysql, I did not want to have separate rescue files (ex: files, dines ...).
Now I have a single database containing several rescues.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)