Distance between Floats not working
#1

Hi everyone,

I made this function for my taxi system, but it isn't working..
Does anyone know why?
pawn Код:
forward FareUpdate(playerid);
public FareUpdate(playerid)
{

    new farestring[128];
    GetPlayerPos(playerid,NewX[playerid],NewY[playerid],NewZ[playerid]);
    new Float:XDifference[MAX_PLAYERS],Float:YDifference[MAX_PLAYERS], Float:ZDifference[MAX_PLAYERS];
    XDifference[playerid] = floatsub(OldX[playerid],NewX[playerid]);
    YDifference[playerid] = floatsub(OldY[playerid],NewY[playerid]);
    ZDifference[playerid] = floatsub(OldZ[playerid],NewZ[playerid]);
    if(XDifference[playerid] >= 100.0)
    {
    TotalFare[playerid]++;
    format(farestring,sizeof(farestring),"Total Fare: %d $",TotalFare[playerid]);
    TextDrawSetString(taxithisfare[playerid],farestring);
    GetOldPos(playerid);
    return 1;
    }
    else if(YDifference[playerid] >= 100.0)
    {
    TotalFare[playerid]++;
    format(farestring,sizeof(farestring),"Total Fare: %d $",TotalFare[playerid]);
    TextDrawSetString(taxithisfare[playerid],farestring);
    GetOldPos(playerid);
    return 1;
    }
    else if(ZDifference[playerid] >= 100.0)
    {
    TotalFare[playerid]++;
    format(farestring,sizeof(farestring),"Total Fare: %d $",TotalFare[playerid]);
    TextDrawSetString(taxithisfare[playerid],farestring);
    GetOldPos(playerid);
    return 1;
    }
   

   
   
    return 1;
   
}
forward GetOldPos(playerid);
public GetOldPos(playerid)
{
    GetPlayerPos(playerid,Float:OldX[playerid],Float:OldY[playerid],Float:OldZ[playerid]);
}
The FareUpdate is getting called every second..
The idea is, that if one of the float differences is 100 or more, it adds 1 to the TotalFare[playerid]
I used the return1; 's because i don't want to add 1 5 times

Does anyone know what i have to do here?
Reply


Messages In This Thread
Distance between Floats not working - by Jstylezzz - 18.07.2012, 20:47
Re: Distance between Floats not working - by Vince - 18.07.2012, 21:01
Re: Distance between Floats not working - by Jstylezzz - 18.07.2012, 21:03
Re: Distance between Floats not working - by Vince - 18.07.2012, 21:30
Re: Distance between Floats not working - by Jstylezzz - 18.07.2012, 21:32

Forum Jump:


Users browsing this thread: 1 Guest(s)