Determine if a vehicle passes in front of a player...
#5

PHP код:
stock GetDistanceToCar(playeridvehFloatposX 0.0FloatposY 0.0FloatposZ 0.0) {
    new
        
FloatFloats[2][3];
    if(
posX == 0.0 && posY == 0.0 && posZ == 0.0) {
        if(!
IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playeridFloats[0][0], Floats[0][1], Floats[0][2]);
        else 
GetVehiclePos(GetPlayerVehicleID(playerid), Floats[0][0], Floats[0][1], Floats[0][2]);
    }
    else {
        
Floats[0][0] = posX;
        
Floats[0][1] = posY;
        
Floats[0][2] = posZ;
    }
    
GetVehiclePos(vehFloats[1][0], Floats[1][1], Floats[1][2]);
    return 
floatround(floatsqroot((Floats[1][0] - Floats[0][0]) * (Floats[1][0] - Floats[0][0]) + (Floats[1][1] - Floats[0][1]) * (Floats[1][1] - Floats[0][1]) + (Floats[1][2] - Floats[0][2]) * (Floats[1][2] - Floats[0][2])));

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)