SA-MP Forums Archive
Bug with editObject & Streamer - 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: Bug with editObject & Streamer (/showthread.php?tid=457257)



Bug with editObject & Streamer - darreugne - 10.08.2013

Hey,

I do a simple command to spawn a ladder and edit him.
Problem is, when you finish object's editing, you see him on her new position but other players see him on old position, before editing.

Code :

Код:
if(strcmp(subsubcmd,"poser",true) == 0)
{
	if(EchelleType[playerid] == 0)
		{ShowMessageBox(playerid,"~r~Vous n'avez pas sorti d'echelle !","~b~Erreur"); return 1;}
	new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, Float:OA, Object;
	GetPlayerPos(playerid, OX, OY, OZ);
	GetPlayerFacingAngle(playerid, OA);
	SendClientMessage(playerid, -1, "Utilisez la touche SPRINT pour bouger la camйra");
	Object = CreateDynamicObject(EchelleType[playerid], OX+2, OY, OZ, ORX, ORY, ORZ,-1,-1,-1,100.0);
	Streamer_UpdateEx(playerid,OX+2, OY, OZ,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
	EditDynamicObject(playerid,Object);
	EchelleHolding[playerid] = false;
	RemovePlayerAttachedObject(playerid, 8);
	return 1;
}
Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)//Pour les objets streamйs comme les tags
{
    new Float:oldX, Float:oldY, Float:oldZ,
		Float:oldRotX, Float:oldRotY, Float:oldRotZ;
	GetObjectPos(objectid, oldX, oldY, oldZ);
	GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
    if(response == EDIT_RESPONSE_FINAL)
	{
        if(EchelleHolding[playerid] == 1 || EchelleType[playerid] != 0)
	    {
	 		CreateEchelle(x,y,z,rx,ry,rz, EchelleType[playerid]);
			DestroyObject(objectid);
			EchelleType[playerid] = 0;
		}
	}
}