23.08.2011, 21:47
pawn Код:
new
Float:Cos[MAX_PLAYERS][3],
Float:Gas[MAX_VEHICLES];
UpdateGas();
public UpdateGas()
{
for(new x = 0,y = GetMaxPlayers(); x != y; x++)
{
if(!IsPlayerConnected(x)) goto NEXT;
if(IsPlayerInAnyVehicle(x))
{
new
Float:Fts[3];
GetPlayerPos(x,Fts[0],Fts[1],Fts[2]);
if((floatsqroot(floatpower(Cos[x][0] - Fts[0],2) + floatpower(Cos[x][1] - Fts[1],2) + floatpower(Cos[x][2] - Fts[2],2))) >= 5) Gas[GetPlayerVehicleID(x)] -= 0.1;
if(Gas[GetPlayerVehicleID(x)] < 1.1)
//fazaqui
Cos[x][0] = Fts[0];
Cos[x][1] = Fts[1];
Cos[x][2] = Fts[2];
}
NEXT:
}
return 1;
}