Hello when i create a object i want to save the position of the object in.Scriptfiles/object.txt
PHP код:
CMD:object(playerid,params[])
{
if(pInfo[playerid][pLevel] >= 4)
{
new id, objectid, Float:X, Float:Y, Float:Z, Float:A;
if(sscanf(params, "i",id)) return SendClientMessage(playerid,yellow,"Usage: /Object <Object Model>");
CommandToAdmins(playerid,"object");
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
X += (2 * floatsin(-A, degrees)); //Thanks to ******
Y += (2 * floatcos(-A, degrees));
objectid = CreateObject(id, X, Y, Z, 0.0, 0.0, A);
format(Jstring, sizeof(Jstring), "Object Created | ID: %d | Object model: %d | Object Position - X: %0.3f, Y: %0.3f, Z: %0.3f", objectid, id, X, Y, Z);
return SendClientMessage(playerid,yellow, Jstring);
}
else return ShowMessage(playerid, red, 1);
}
Код:
new File:obj = fopen("codes.txt",io_append);
if(obj)
{
new str[100];
format(str,100,"CreateObject(%i,%f,%f,%f,0,0,%i/,300);\n",id,X,Y,Z,A);
fwrite(obj,str);
}
fclose(obj);