SA-MP Forums Archive
vehicle timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: vehicle timer (/showthread.php?tid=513938)



vehicle timer - n00el - 18.05.2014

hy. whats wrong with this?

PHP код:
stock kmsaver(id,vehicleid)
{
    new
    
FloatOldPos[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 ] [ ] , OldPos id ] [ ] , OldPos id ] [ ] , VehicleOPos id ] [ ] , VehicleOPos id ] [ ] , VehicleOPos id ] [ ] ) ;
    
VehicleInfo[vehicleid][vMegtettUt] += DistanceKM [id] / 1000 ;
    
VehicleInfo[vehicleid][vUzemanyag] = VehicleInfo[vehicleid][vUzemanyag]-;
    return 
1;

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == 2)
    {
        new 
vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
    
SetPVarInt(playerid"kmsaver1"SetTimerEx("kmsaver"100true"id"playeridvehicleid));
    } 



Re: vehicle timer - rappy93 - 18.05.2014

Well,how about you tell us if there is something wrong with it and we can try to help you instead of guessing the problem.


Re: vehicle timer - n00el - 18.05.2014

sorry.. so i enter a car as driver, and the timer dosent set vUzemanyag -1.. its always in default value, 100..


Re: vehicle timer - rappy93 - 18.05.2014

Well, I can't really understand what you're trying to do but I suspect the problem is in your stock, the last few lines. Also, 100ms is a bit low,you should set the timer to at least 500 ms. Sorry if I can't provide more information.


Re: vehicle timer - n00el - 18.05.2014

solved, sorry for this