20.09.2011, 13:26
Okay, I have a vehicle sync script in my gamemode, but I have a problem. If I make a vehicle with a respawn timer and use it after it respawns vehicle sync starts to work and brings back the vehicle to the position were I left the vehicle after done using it ;/ I could remove one of those things, but unfortunately I need them both. Does anyone have any ideas?
I tried to do one thing, but after the vehicle respawned all the others disapear from the map
Well I tried to do so:
1. In:
I added
And got:
2. Then I made these things:
I tried to do one thing, but after the vehicle respawned all the others disapear from the map

Well I tried to do so:
1. In:
Код:
if(!(vehicleDB[vehicleid][lastpos][0]==0 && vehicleDB[vehicleid][lastpos][1] == 0 && vehicleDB[vehicleid][lastpos][2] == 0))
{
SetVehiclePos(vehicleid,vehicleDB[vehicleid][lastpos][0],vehicleDB[vehicleid][lastpos][1],vehicleDB[vehicleid][lastpos][2]);
SetVehicleZAngle(vehicleid,vehicleDB[vehicleid][lastpos][3]);
Код:
vehicleDB[vehicleid][sync]==1 &&
Код:
forward SyncVehis();
public SyncVehis()
{
new bool:dontsync[500];
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
{
new vehicleid=GetPlayerVehicleID(playerid);
dontsync[vehicleid]=true;
GetVehiclePos(vehicleid,vehicleDB[vehicleid][lastpos][0],vehicleDB[vehicleid][lastpos][1],vehicleDB[vehicleid][lastpos][2]);
GetVehicleZAngle(vehicleid,vehicleDB[vehicleid][lastpos][3]);
}
}
for(new vehicleid=0; vehicleid<maxvehicles+1; vehicleid++)
{
if(!dontsync[vehicleid])
{
if(!(vehicleDB[vehicleid][sync]==1 && vehicleDB[vehicleid][lastpos][0]==0 && vehicleDB[vehicleid][lastpos][1] == 0 && vehicleDB[vehicleid][lastpos][2] == 0))
{
SetVehiclePos(vehicleid,vehicleDB[vehicleid][lastpos][0],vehicleDB[vehicleid][lastpos][1],vehicleDB[vehicleid][lastpos][2]);
SetVehicleZAngle(vehicleid,vehicleDB[vehicleid][lastpos][3]);
}
}
}
}
Код:
public NoSync(vehicleid)
{
vehicleDB[vehicleid][sync]=0;
return 1;
}
public OnVehicleSpawn(vehicleid)
{
SetTimer("NoSync", 65000, false);
vehicleDB[vehicleid][sync]=1;

