Vehsystem -
titanak - 19.09.2011
anny suggestions / ideas / scripts ? :P repping too
Re: Need Suggestions With Vehicle Odometer -
=WoR=Varth - 19.09.2011
By getting vehicle speed (with speedometer FS or make it by your own) you can calculate it (But not accurate I think).
Re: Need Suggestions With Vehicle Odometer -
titanak - 19.09.2011
im using that classic style
pawn Code:
GetVehicleSpeed(vehicleid);
but i need little bit more explain :P
i have thinked about that style but my brainz are still dumped lol
Re: Need Suggestions With Vehicle Odometer -
[HiC]TheKiller - 19.09.2011
Can you post that function? It probably just returns the speed in a float value.
Re: Need Suggestions With Vehicle Odometer -
titanak - 19.09.2011
ya i use that way
pawn Code:
Float:GetVehicleSpeed(vehicleid)
{
new
Float:vX,
Float:vY,
Float:vZ;
GetVehicleVelocity(vehicleid, vX, vY, vZ);
return floatsqroot(vX*vX + vY*vY + vZ*vZ);
}
and sometimes this way xD
pawn Code:
stock SpeedVehicle(playerid)
{
new Float:ST[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3;
return floatround(ST[3]);
}
i think the second one is easier or what ?
Re: Need Suggestions With Vehicle Odometer -
titanak - 19.09.2011
Quote:
Originally Posted by [HiC]TheKiller
Can you post that function? It probably just returns the speed in a float value.
|
can you help me then :P?
Re: Need Suggestions With Vehicle Odometer -
dowster - 19.09.2011
pawn Code:
OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid)) {
if(GetPlayerVehicleSeat(playerid) == 0) {
new Float:veh_pos[3], vehid = GetPlayerVehicleID(playerid);
static Float:old_veh_pos[MAX_VEHICLES + 1][3], Float:vehicle_odometers[MAX_VEHICLES + 1];
GetVehiclePos( vehid, veh_pos[0], veh_pos[1], veh_pos[2]);
vehicle_odometers[vehid] += DISTANCE( veh_pos[0], veh_pos[1], veh_pos[2], old_veh_pos[vehid][0], old_veh_pos[vehid][1], old_veh_pos[vehid][2]);
old_veh_pos[vehid][0] = veh_pos[0];
old_veh_pos[vehid][1] = veh_pos[1];
old_veh_pos[vehid][2] = veh_pos[2];
}
}
return 1;
}
Untested, i coded it in the input box.
Re: Need Suggestions With Vehicle Odometer -
titanak - 20.09.2011
it seems a hard code one but thanks
Re: Need Suggestions With Vehicle Odometer -
titanak - 20.09.2011
does that DISTANCE() Func misses ?? or what ?
Re: Need Suggestions With Vehicle Odometer -
titanak - 20.09.2011
okay fixed code a little bit , can some one help me to forward :P?
Re: Need Suggestions With Vehicle Odometer -
Shetch - 20.09.2011
Easiest solution:
https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint
Re: Need Suggestions With Vehicle Odometer -
titanak - 20.09.2011
Quote:
Originally Posted by Shetch
|
but this function wasn't found..
Code:
C:\**.pwn(2085) : error 017: undefined symbol "GetPlayerDistanceFromPoint"
Re: Need Suggestions With Vehicle Odometer -
=WoR=Varth - 20.09.2011
It's R5 function. Upgrade your samp server.
EIDT

ebug your veriable
pawn Code:
printf("%f",vehicle_odometers[vehid]);
Make sure you set that variable Float
pawn Code:
new Float:vehicle_odometers[MAX_VEHICLES];
Re: Need Suggestions With Vehicle Odometer -
Redgie - 20.09.2011
The most effective way is to run a frequent timer (Every .5-1 second) and calculate the distance between the vehicles last point and it's point now.
But it's extremely intensive, especially on a server with hundreds if not thousands of vehicles.
Re: Need Suggestions With Vehicle Odometer -
titanak - 20.09.2011
okay. already got it
Re: Need Suggestions With Vehicle Odometer -
=WoR=Varth - 20.09.2011
https://sampforum.blast.hk/showthread.php?tid=271586
Re: Need Suggestions With Vehicle Odometer -
titanak - 20.09.2011
still zero. result:
when i use GetPlayerDistance then i have to use Player cordinates too ??
Re: Need Suggestions With Vehicle Odometer -
titanak - 20.09.2011
i just have replaced the GetVehiclePos With GetPlayerPos and the result is impressive:
and the amound increases when i stand in one place.
Re: Need Suggestions With Vehicle Odometer -
=WoR=Varth - 20.09.2011
Player current coordinate and player old coordinate.
Re: Need Suggestions With Vehicle Odometer -
=WoR=Varth - 20.09.2011
pawn Code:
new Float:a
a += GetPlayerDistanceFromPoint(playerid,playerx[playerid],playery[playerid],playerz[playerid]);
GetPlayerPos(playerid,playerx[playerid],playery[playerid],playerz[playerid]);
Ups, didn't mean to double post.