22.08.2015, 11:22
Hello when i create a object i want to save the position of the object in.Scriptfiles/object.txt
here is the code
here is the code
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);
}