18.05.2014, 20:17
hy. whats wrong with this?
PHP код:
stock kmsaver(id,vehicleid)
{
new
Float: OldPos[MAX_PLAYERS][3],
Float:DistanceKM [MAX_PLAYERS];
OldPos[id][0] = VehicleOPos[id][0];
OldPos[id][1] = VehicleOPos[id][1];
OldPos[id][2] = VehicleOPos[id][2];
GetPlayerPos (id , VehicleOPos[id][0] , VehicleOPos[id][1], VehicleOPos[id][2]);
DistanceKM [ id ] = GetDistanceBetweenPoints1 ( OldPos [ id ] [ 0 ] , OldPos [ id ] [ 1 ] , OldPos [ id ] [ 2 ] , VehicleOPos [ id ] [ 0 ] , VehicleOPos [ id ] [ 1 ] , VehicleOPos [ id ] [ 2 ] ) ;
VehicleInfo[vehicleid][vMegtettUt] += DistanceKM [id] / 1000 ;
VehicleInfo[vehicleid][vUzemanyag] = VehicleInfo[vehicleid][vUzemanyag]-1 ;
return 1;
}
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
SetPVarInt(playerid, "kmsaver1", SetTimerEx("kmsaver", 100, true, "id", playerid, vehicleid));
}