optimize code
#5

Quote:
Originally Posted by Mencent
View Post
Hello!

You forgot the Float:-Tag.
PHP Code:
stock PlacaVeiculoPerto(playerid)
{
    new 
Float:distance 10.0FloatcurrentDistance 11.0vehicleid 0Float:Pos[3];
    for(new 
iMAX_VEHICLESi++)
    {
        
GetVehiclePos(iPos[0], Pos[1], Pos[2]);
        
currentDistance GetPlayerDistanceFromPoint(playeridPos[0], Pos[1], Pos[2]);
        if(
currentDistance <= 7.0 && currentDistance distance) {
            
vehicleid i;
            
distance currentDistance;
        }
    }
    return 
vehicleid;


- Mencent
Tranks!

@topic
Sorry, but it was not that above code that was in error, is the code below that checks the id of the vehicle, and it checks where this really the vehicle, this is the code with the error:

PHP Code:

public PlayerPertoVeiculo(playerid)
{
    static 
Float:Pos[3];
    for( new 
iMAX_VEHICLESi++) {
        
GetVehiclePos(iPos[0], Pos[1], Pos[2]);
        if(
IsPlayerInRangeOfPoint(playerid7.0Pos[0], Pos[1], Pos[2])) {
            return 
1;
        }
    }
    return 
0;

Reply


Messages In This Thread
optimize code - by JoshNudock - 22.06.2015, 14:21
Re: optimize code - by CoaPsyFactor - 22.06.2015, 14:32
Re: optimize code - by JoshNudock - 22.06.2015, 19:33
AW: optimize code - by Mencent - 22.06.2015, 19:34
Re: AW: optimize code - by JoshNudock - 22.06.2015, 19:38

Forum Jump:


Users browsing this thread: 1 Guest(s)