How to
#1

Hello when i create a object i want to save the position of the object in.Scriptfiles/object.txt
here is the code

PHP код:
CMD:object(playerid,params[])
{
    if(
pInfo[playerid][pLevel] >= 4)
    {
        new 
idobjectidFloat:XFloat:YFloat:ZFloat:A;
        if(
sscanf(params"i",id)) return SendClientMessage(playerid,yellow,"Usage: /Object <Object Model>");
        
CommandToAdmins(playerid,"object");
        
GetPlayerPos(playeridXYZ);
        
GetPlayerFacingAngle(playeridA);
        
+= (floatsin(-Adegrees)); //Thanks to ******
        
+= (floatcos(-Adegrees));
        
objectid CreateObject(idXYZ0.00.0A);
        
format(Jstringsizeof(Jstring), "Object Created | ID: %d | Object model: %d | Object Position - X: %0.3f, Y: %0.3f, Z: %0.3f"objectididXYZ);
        return 
SendClientMessage(playerid,yellowJstring);
    }
    else return 
ShowMessage(playeridred1);

Reply
#2

use this to save:
Код:
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);
For id i think %i or %d
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)