save object
#1

Код:
stock CreateChristmasTree(Float:X, Float:Y, Float:Z)
{
	CreateObject(3472,X+0.28564453,Y+0.23718262,Z+27.00000000,0.00000000,0.00000000,230.48021);
	CreateObject(664,X+0.20312500,Y+0.01171875,Z+-3.00000000,0.00000000,0.00000000,0.00000000);
	CreateObject(3472,X+0.45312500,Y+0.51562500,Z+4.00000000,0.00000000,0.00000000,69.7851562);
	CreateObject(3472,X+0.65136719,Y+1.84570312,Z+17.00000000,0.00000000,0.00000000,41.863403);
	CreateObject(7666,X+0.34130859,Y+0.16845703,Z+45.00000000,0.00000000,0.00000000,298.12524);
	CreateObject(7666,X+0.34082031,Y+0.16796875,Z+45.00000000,0.00000000,0.00000000,27.850342);
	CreateObject(3472,X+0.45312500,Y+0.51562500,Z+12.00000000,0.00000000,0.00000000,350.02441);
	CreateObject(3472,X+0.45312500,Y+0.51562500,Z+7.00000000,0.00000000,0.00000000,30.0805664);
	CreateObject(3472,X+0.45312500,Y+0.51562500,Z+22.00000000,0.00000000,0.00000000,230.47119);
	CreateObject(1262,X+0.15039062,Y+0.57128906,Z+29.45285416,0.00000000,0.00000000,162.90527);
}
I find this when I use search button, anyone know how to save all trees and boxes who I created ingame?I know how to make cmd to use that but don't know how to save objects'NO LOAD ONLY SAVE IN .txt IN SCRIPTFILES'
Reply
#2

This command will create an object ID: 19128 (Small dance floor) on player coordinates and will save the object in objects.text in Your scriptfiles folder (server folder/scriptfiles/objects.txt).

According to this You should know how to save anything and not just the object.

pawn Код:
CMD:object(playerid, params[])
{
        GetPlayerPos(playerid, X, Y, Z);

        object = CreateObject(19128, X, Y, Z, 0.0, 0.0, 0.0, 0.0);

        GetObjectPos(object, X, Y, Z);
        GetPlayerRot(object, rX, rY, rZ);

        new string[256];
 
        // Will open the file objects.txt (if file doesn't exist it will create it), and saves the string.
        new File:objects=fopen("objects.txt", io_append);

        format(string, sizeof(string), "CreateObject(19128, %f, %f, %f, %f, %f, %f, 0.0);", X, Y, Z, rX, rY, rZ);
        fwrite(objects, string);
        fclose(objects);
 
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)