rendered paste bodynew SavePlayerPos[MAX_PLAYERS][SavePlayerPosEnum];
new g[255];
new s[MAX_PLAYERS];
new Float:checkpoints[24][3] = {
{2109.2126,917.5845,10.8203},
{2640.1831,1103.9224,10.8203},
{611.8934,1694.7921,6.7193},
{-1327.5398,2682.9771,49.7896},
{-2413.7427,975.9317,45.0031},
{-1672.3597,414.2950,6.8866},
{-2244.1365,-2560.6294,31.6276},
{-1603.0166,-2709.3589,48.2419},
{1939.3275,-1767.6813,13.2787},
{-94.7651,-1174.8079,1.9979},
{1381.6699,462.6467,19.8540},
{657.8167,-559.6507,16.0630},
{-1478.2916,1862.8318,32.3617},
{2147.3054,2744.9377,10.5263},
{2204.9602,2480.3494,10.5278},
{1939.3423,-1772.9888,13.0917},
{655.1845,-564.5622,16.0409},
{2205.5295,2474.7119,10.8203},
{1596.1466,2195.8643,10.8203},
{-2408.5120,976.0079,45.2969},
{-1675.2753,413.3416,7.1797},
{-91.3122,-1169.5854,2.4233},
{1765.7477,-2286.5205,26.7960},
{1590.9493,2202.2637,10.5247}
};
//-----------------------------------------
//------------------------------------------------------------------------------------------------------
public S()
{
for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == 2)
{
new Float:x,Float:y,Float:z;
new Float:distance,value;
new v = GetPlayerVehicleID(i);
GetPlayerPos(i,x,y,z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
value = floatround(distance * 5600);
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
new string[256];
format(string, sizeof(string),"~n~~n~~n~~n~~n~~n~MpH:~r~%d ~n~~w~Fuel:~r~%d",floatround(value/3580),g[v]);
GameTextForPlayer(i,string,1200,5);
g[v]--;
}
}
}
public F()
{
for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == 2)
{
new v = GetPlayerVehicleID(i);
if(g[v] <= 0)
{
GameTextForPlayer(i,"~r~No Fuel",1000,1);
RemovePlayerFromVehicle(i);
}
g[v]--;
}
}
}
//------------------------------------------------------------
public OnGameModeInit()
{
SetTimer("S",1200,1);
SetTimer("F",5000,1);
for(new v=0; v<255; v++) g[v] = 100;
return 1;
//-------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/refuel", true) == 0)
{
for(new s=0; s<16; s++)
if(PlayerToPoint(6,playerid,checkpoints[s][0],checkpoints[s][1],checkpoints[s][2]))
{
if(GetPlayerMoney(playerid) < 100)
{
SendClientMessage(playerid,0xFF0000AA,"Need $100 for gas");
return 1;
}
new v = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) != 2)
{
SendClientMessage(playerid,0xFF0000AA,"Need to be driver to refuel");
return 1;
}
g[v] = 100;
SendClientMessage(playerid,0x00FF00AA,"Vehicle Refuled");
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000AA,"Not near any gas station");
return 1;
}