27.10.2009, 22:53
I have a problem.
I have this script:
It worked perfect in 0.2X. Now in 0.3a, it wont work properly. So, I have some NPCs in 0.3a. I made an experiment with friend with this rotating objects. I joined into the server first and than my friend. When i go to the barrier, i saw the barrier was moving, but other friends told me, that they see closed barrier. Than i go away from the barrier and than tried my friend. When my friend went to the barrier, i see the barrier was opening (rotating), and friend said that he saw closed barrier.
So, i mean, theres a problem with sinhronization. I cant synhronize that, like with clasical MoveObject (heres an example):
I have this script:
pawn Код:
#include <a_samp>
new zapornice0, zapornice1, zapornice2, zapornice3;
new GATE1;
public OnFilterScriptInit()
{
zapornice0 = CreateObject(2920,-1701.432785,687.618591,24.675754,-90.000000,0.000000,180.000000);
zapornice1 = CreateObject(2920,-1572.196166,658.782958,6.897510,-90.000000,0.000000,0.000000);
zapornice2 = CreateObject(2920,2238.192382,2450.399169,10.626952,-90.000000,0.000000,0.000000);
zapornice3 = CreateObject(2920,1544.694458,-1630.825073,13.141077,-90.000000,0.000000,0.000000);
GATE1 = SetTimer("Rampe", 5, true);
return 1;
}
forward Rampe();
public Rampe()
{
new Float:rotx0, Float:roty0, Float:rotz0;
GetObjectRot(zapornice0, rotx0, roty0, rotz0);
new Float:rotx1, Float:roty1, Float:rotz1;
GetObjectRot(zapornice1, rotx1, roty1, rotz1);
new Float:rotx2, Float:roty2, Float:rotz2;
GetObjectRot(zapornice2, rotx2, roty2, rotz2);
new Float:rotx3, Float:roty3, Float:rotz3;
GetObjectRot(zapornice3, rotx3, roty3, rotz3);
new Float:rotxls, Float:rotyls, Float:rotzls;
GetObjectRot(lsdoors, rotxls, rotyls, rotzls);
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerInRangeOfPoint(i, 10.0, -1701.4161,683.5115,24.8552))
{
if(rotx0 < 0.000000) SetObjectRot(zapornice0, rotx0+0.1, roty0, rotz0);
return 1;
}
if(IsPlayerInRangeOfPoint(i, 10.0, -1572.0817,663.0021,7.1875))
{
if(rotx1 < 0.000000) SetObjectRot(zapornice1, rotx1+0.1, roty1, rotz1);
return 1;
}
if(IsPlayerInRangeOfPoint(i, 10.0, 2238.1904,2454.4038,10.8203))
{
if(rotx2 < 0.000000) SetObjectRot(zapornice2, rotx2+0.1, roty2, rotz2);
return 1;
}
if(IsPlayerInRangeOfPoint(i, 10.0, 1544.5369,-1626.9111,13.3828))
{
if(rotx3 < 0.000000) SetObjectRot(zapornice3, rotx3+0.1, roty3, rotz3);
return 1;
}
if(IsPlayerInRangeOfPoint(i, 10.0, 1588.1935,-1637.9010,13.4239))
{
if(rotxls > -90.000000) SetObjectRot(lsdoors, rotxls-0.35, rotyls, rotzls);
return 1;
}
}
if(rotx0 > -90.000000) SetObjectRot(zapornice0, rotx0-0.1, roty0, rotz0);
if(rotx1 > -90.000000) SetObjectRot(zapornice1, rotx1-0.1, roty1, rotz1);
if(rotx2 > -90.000000) SetObjectRot(zapornice2, rotx2-0.1, roty2, rotz2);
if(rotx3 > -90.000000) SetObjectRot(zapornice3, rotx3-0.1, roty3, rotz3);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(GATE1);
DestroyObject(zapornice0);
DestroyObject(zapornice1);
DestroyObject(zapornice2);
DestroyObject(zapornice3);
return 1;
}
So, i mean, theres a problem with sinhronization. I cant synhronize that, like with clasical MoveObject (heres an example):
pawn Код:
public OnFilterScriptInit()
{
a51_desna = CreateObject(2927,211.854766,1875.358276,13.885452,0.000000,0.000000,180.000000);
SetTimer("CheckGate", 50, true);
return 1;
}
new OpenGate0[MAX_PLAYERS]; //<<<<<<<<<<<<<<<<<<
forward CheckGate();
public CheckGate()
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerInRangeOfPoint(i, 12.0, 213.8831,1875.3693,13.1470) && OpenGate0[i] == 0)//<<<<<here is this <<<<<<<<<
{
MoveObject(a51_desna,207.838668,1875.358276,13.885452,1.0);
OpenGate0[i] = 1;//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
else if(!IsPlayerInRangeOfPoint(i, 12.0, 213.8831,1875.3693,13.1470) && OpenGate0[i] == 1)//<<<<<here is this <<<<<<<<<
{
MoveObject(a51_desna,211.854766,1875.358276,13.885452,1.0);
OpenGate0[i] = 0;//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
}