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]);
}
stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
x1 -= x2;
y1 -= y2;
z1 -= z2;
return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
}
warning 208: function with tag result used before definition, forcing reparse
stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
forward Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2);
pawn Код:
|