19.03.2011, 20:41
i use a loop in automatic gate and car script and in both it doesnt work properly
this is the loop i use
idk why its not working
here
it works well when iam alone in the server but when someone connects it doesnt work ir opens for him and doesnt open for me and its not the first time it happens
about the car i made a FS it destroy the car and create it back and its supposed to put the players(if there is players in the car) again in the new created car
and it also dont work only one player is putted in the new car and the other is removed
i used foreach.inc by ****** here and it didnt work lol
please tell me wth is going on with the loop
this is the loop i use
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
}
here
pawn Код:
forward gatecheck();
public gatecheck()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 15.0,1545.93554688,-1626.52050781,12.58281231))
{
MoveObject(lspleftgate, 1545.93554688,-1617.52050781,12.58281231, 5.0);
MoveObject(lsprightgate, 1545.93554688,-1635.82055664,12.58281231, 5.0);
}
else if(IsPlayerInRangeOfPoint(i, 15.0, 1140.91699219,-1292.01171875,12.68227100))
{
MoveObject(lsmgate1, 1148.21447754,-1292.01245117,12.68227100, 5.0);
MoveObject(lsmgate2, 1133.91699219,-1292.01171875,12.68227100, 5.0);
}
else if(IsPlayerInRangeOfPoint(i, 15.0, 1591.87133789,-1638.18017578,13.89877319))
{
MoveObject(lspgar, 1591.87133789, -1638.18017578, 6.89877319, 5.0);
}
else
{
MoveObject(lspleftgate, 1545.93554688,-1626.52050781,12.58281231, 5.0);
MoveObject(lsprightgate, 1545.93554688,-1626.82055664,12.58281231, 5.0);
MoveObject(lsmgate1, 1141.21447754,-1292.01245117,12.68227100, 5.0);
MoveObject(lsmgate2, 1140.91699219,-1292.01171875,12.68227100, 5.0);
}
}
}
return 1;
}
about the car i made a FS it destroy the car and create it back and its supposed to put the players(if there is players in the car) again in the new created car
and it also dont work only one player is putted in the new car and the other is removed
i used foreach.inc by ****** here and it didnt work lol
pawn Код:
if(PRESSED(KEY_ANALOG_DOWN))
{
if(!IsPlayerAdmin(playerid)) return 0;
else
{
if(ATTACK == 1)
{
GetVehiclePos(OMGCAR[0], CX, CY, CZ);
GetVehicleZAngle(OMGCAR[0], CA);
GetVehicleVelocity(OMGCAR[0], VX, VY, VZ);
foreach(Player, i)
{
if(IsPlayerInVehicle(i, OMGCAR[0]))
{
new seat = GetPlayerVehicleSeat(i);
DestroyVehicle(OMGCAR[0]);
OMGCAR[0] = CreateVehicle(522, CX, CY, CZ, CA, 0, 1, 0);
PutPlayerInVehicle(i, OMGCAR[0], seat);
SetVehicleVelocity(OMGCAR[0], VX, VY, VZ);
}
}
}
}
}