SA-MP Forums Archive
Object is changing virtual world on its own - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Object is changing virtual world on its own (/showthread.php?tid=598961)



Object is changing virtual world on its own - SpaMaster - 18.01.2016

When I create a new Dynamic Object and want to edit it via CreateDynamicObject, it just keeps setting it's own virtual world on 0, and I can't see it anymore. Here's the code.
pawn Код:
new Float:pPos[4];
   GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
   GetPlayerFacingAngle(playerid, pPos[3]);
   EventObject[playerid] = CreateDynamicObject(modelid, pPos[0]+(20.0 * floatsin(-pPos[3], degrees)), pPos[1]+(20.0 * floatcos(-pPos[3], degrees)), pPos[2], 90.0000, 0.0000, 0.0000, 1, -1, -1, 300.0);
   EditDynamicObject(playerid, EventObject[playerid]);



Re: Object is changing virtual world on its own - valych - 18.01.2016

When you create a dynamic object, it won't be "shown" for a player if he doesn't move. So, before using EditDynamicObject function, you should update streamer for the player:
PHP код:
   new Float:pPos[4];
   
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
   
GetPlayerFacingAngle(playeridpPos[3]);
   
EventObject[playerid] = CreateDynamicObject(modelidpPos[0]+(20.0 floatsin(-pPos[3], degrees)), pPos[1]+(20.0 floatcos(-pPos[3], degrees)), pPos[2], 90.00000.00000.00001, -1, -1300.0);
   
Streamer_Update(playeridSTREAMER_TYPE_OBJECT); // <-- updates dynamic objects for a player
   
EditDynamicObject(playeridEventObject[playerid]);