02.11.2011, 13:28
Hi peoples. I need some help. I want to do that thing if player in car is 10 metres from other car,then he get stopped,i try to something:
But this not work...
Код:
forward OnPlayerUpdate(playerid);
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new Float:Coord[3];
GetVehiclePos(i, Coord[0], Coord[1], Coord[2]);
if(IsPlayerConnected(i))
{
if(i != playerid)
{
if(IsPlayerInRangeOfPoint(i, 10.0, Coord[0], Coord[1], Coord[2]))
{
GameTextForPlayer(playerid,"~r~Car in way!",3000,5);
SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.0);
}
}
}
}


) and then you check is vehicle id different from player id and then with same loop you used to get vehicle that are connected you are checking is player id with vehicle id in range of point.