SaveObjectToFile(playerid, objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { new File:file, line[100]; GetPlayerName(playerid, pnam, sizeof(pnam)); if(!fexist(ANIM_SAVE_FILE))file = fopen(ANIM_SAVE_FILE, io_write); else file = fopen(ANIM_SAVE_FILE, io_append); format(line, 100, "CreateObject(%s, %f, %f, %f, %f, %f, %f);\r\n",objectid, fX, fY, fZ, fRotX, fRotY, fRotZ); fwrite(file, line); fclose(file); } CMD:createobject(playerid, params[]) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Objects", "Enter the object id you want to add", "OK", "Cancel"); CreateObject(4206, -1683.190917, 704.806335, 30.829187, -55.900032, -0.300000, 0.000000); } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(response) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); object = strval(inputtext); cobj = CreateObject(object, x, y, z, 0.0, 0.0, 0.0); EditObject(playerid, cobj); } } return 1; } public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { if(response == EDIT_RESPONSE_FINAL) { SaveObjectToFile(playerid, cobj, fX, fY, fZ, fRotX, fRotY, fRotZ); } }
CreateObject(й›-ўљ, -1683.190917, 704.806335, 30.829187, -55.900032, -0.300000, 0.000000);
SaveObjectToFile(playerid, objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { new File:file, line[100]; GetPlayerName(playerid, pnam, sizeof(pnam)); if(!fexist(ANIM_SAVE_FILE))file = fopen(ANIM_SAVE_FILE, io_write); else file = fopen(ANIM_SAVE_FILE, io_append); format(line, 100, "CreateObject(%s, %f, %f, %f, %f, %f, %f);\r\n",objectid, fX, fY, fZ, fRotX, fRotY, fRotZ); fwrite(file, line); fclose(file); }
Код:
SaveObjectToFile(playerid, objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { new File:file, line[100]; GetPlayerName(playerid, pnam, sizeof(pnam)); if(!fexist(ANIM_SAVE_FILE))file = fopen(ANIM_SAVE_FILE, io_write); else file = fopen(ANIM_SAVE_FILE, io_append); format(line, 100, "CreateObject(%s, %f, %f, %f, %f, %f, %f);\r\n",objectid, fX, fY, fZ, fRotX, fRotY, fRotZ); fwrite(file, line); fclose(file); } |
CreateObject(2, 2033.176879, 1343.862915, 10.454423, -33.100009, 0.000000, 0.000000);
Dident worked,now it showed:
Код:
CreateObject(2, 2033.176879, 1343.862915, 10.454423, -33.100009, 0.000000, 0.000000); |
SaveObjectToFile(playerid, objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) {
new File:file, line[100];
GetPlayerName(playerid, pnam, sizeof(pnam));
if(!fexist(ANIM_SAVE_FILE)) {
file = fopen(ANIM_SAVE_FILE, io_write);
} else {
file = fopen(ANIM_SAVE_FILE, io_append);
format(line, 100, "CreateObject(%d, %f, %f, %f, %f, %f, %f);\r\n",objectid, fX, fY, fZ, fRotX, fRotY, fRotZ);
fwrite(file, line);
fclose(file);
}
}
Because it's %d .. Not %i
Try this: PHP код:
|
CreateObject(4, 2032.036010, 1342.500000, 9.852117, -88.600013, 0.000000, 0.000000);
#include <a_samp> #include <zcmd> #define FILTERSCRIPT #define COL_WHITE "{FFFFFF}" #define COL_GREEN "{00FF00}" #define ANIM_SAVE_FILE "Objects.txt" new object; new cobj; new pnam[MAX_PLAYER_NAME]; public OnFilterScriptInit() { print("Map Editor Loaded"); return 1; } public OnFilterScriptExit() { return 1; } SaveObjectToFile(playerid, objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { new File:file, line[100]; GetPlayerName(playerid, pnam, sizeof(pnam)); if(!fexist(ANIM_SAVE_FILE))file = fopen(ANIM_SAVE_FILE, io_write); else file = fopen(ANIM_SAVE_FILE, io_append); format(line, 100, "CreateObject(%d, %f, %f, %f, %f, %f, %f);\r\n", objectid, fX, fY, fZ, fRotX, fRotY, fRotZ); fwrite(file, line); fclose(file); } CMD:createobject(playerid, params[]) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Objects", "Enter the object id you want to add", "OK", "Cancel"); CreateObject(4206, -1683.190917, 704.806335, 30.829187, -55.900032, -0.300000, 0.000000); } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(response) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); object = strval(inputtext); cobj = CreateObject(object, x, y, z, 0.0, 0.0, 0.0); EditObject(playerid, cobj); } } return 1; } public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { if(response == EDIT_RESPONSE_FINAL) { SaveObjectToFile(playerid, cobj, fX, fY, fZ, fRotX, fRotY, fRotZ); } }
SaveObjectToFile(playerid, object, fX, fY, fZ, fRotX, fRotY, fRotZ);
Dident worked,now it showed:
Код:
CreateObject(2, 2033.176879, 1343.862915, 10.454423, -33.100009, 0.000000, 0.000000); |
Because it's %d .. Not %i
Try this: PHP код:
|
Doesn't matter if it's %d or %i, cobj stores the object id not object model id! you have to save the input in another variable and save that to the file instead of cobj!
(sorry for the %s mistake with the file thing) All you have to do is to change cobj to "object", like this Код:
SaveObjectToFile(playerid, object, fX, fY, fZ, fRotX, fRotY, fRotZ); |
#include <a_samp> #include <zcmd> #define FILTERSCRIPT #define COL_WHITE "{FFFFFF}" #define COL_GREEN "{00FF00}" #define ANIM_SAVE_FILE "Objects.txt" new object; new cobj; new pnam[MAX_PLAYER_NAME]; public OnFilterScriptInit() { print("Map Editor Loaded"); return 1; } public OnFilterScriptExit() { return 1; } SaveObjectToFile(playerid, objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { new File:file, line[100]; GetPlayerName(playerid, pnam, sizeof(pnam)); if(!fexist(ANIM_SAVE_FILE))file = fopen(ANIM_SAVE_FILE, io_write); else file = fopen(ANIM_SAVE_FILE, io_append); format(line, 100, "CreateObject(%d, %f, %f, %f, %f, %f, %f);\r\n", object, fX, fY, fZ, fRotX, fRotY, fRotZ); fwrite(file, line); fclose(file); } CMD:createobject(playerid, params[]) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Objects", "Enter the object id you want to add", "OK", "Cancel"); CreateObject(4206, -1683.190917, 704.806335, 30.829187, -55.900032, -0.300000, 0.000000); } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(response) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); object = strval(inputtext); cobj = CreateObject(object, x, y, z, 0.0, 0.0, 0.0); EditObject(playerid, cobj); } } return 1; } public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { if(response == EDIT_RESPONSE_FINAL) { SaveObjectToFile(playerid, object, fX, fY, fZ, fRotX, fRotY, fRotZ); } }
CreateObject(8, 2029.585083, 1343.103027, 9.823666, -88.799987, 0.000000, 0.000000);
Код:
#include <a_samp> #include <zcmd> #define FILTERSCRIPT #define COL_WHITE "{FFFFFF}" #define COL_GREEN "{00FF00}" #define ANIM_SAVE_FILE "Objects.txt" new object; new cobj; new pnam[MAX_PLAYER_NAME]; public OnFilterScriptInit() { print("Map Editor Loaded"); return 1; } public OnFilterScriptExit() { return 1; } SaveObjectToFile(playerid, objectid, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { new File:file, line[100]; GetPlayerName(playerid, pnam, sizeof(pnam)); if(!fexist(ANIM_SAVE_FILE))file = fopen(ANIM_SAVE_FILE, io_write); else file = fopen(ANIM_SAVE_FILE, io_append); format(line, 100, "CreateObject(%d, %f, %f, %f, %f, %f, %f);\r\n", object, fX, fY, fZ, fRotX, fRotY, fRotZ); fwrite(file, line); fclose(file); } CMD:createobject(playerid, params[]) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Objects", "Enter the object id you want to add", "OK", "Cancel"); CreateObject(4206, -1683.190917, 704.806335, 30.829187, -55.900032, -0.300000, 0.000000); } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(response) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); object = strval(inputtext); cobj = CreateObject(object, x, y, z, 0.0, 0.0, 0.0); EditObject(playerid, cobj); } } return 1; } public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { if(response == EDIT_RESPONSE_FINAL) { SaveObjectToFile(playerid, object, fX, fY, fZ, fRotX, fRotY, fRotZ); } } Код:
CreateObject(8, 2029.585083, 1343.103027, 9.823666, -88.799987, 0.000000, 0.000000); |