Vehicle Library - Transmission and Speed Detection System -
Luka P. - 11.08.2010
Description
Vehicle Library allows you to get vehicle speed and transmission. I got the idea from Ryder's Transmission filterscript (actually, it is transmission and speed info in textdraw, but with no callbacks).
Usage
Definitions/states:
Code:
VEH_STATE_DRIVING_FORWARD
VEH_STATE_DRIVING_BACKWARDS
VEH_STATE_NOT_DRIVING
You can use the above definitions to compare them with the "newtrans" or "oldtrans" parameter in OnPlayerTransmissionChange callback.
You can use the above definitions to define what you want to use - kilometers or miles. You must put a definition like #define USE_MPH above the include. Default unit is kilometers, so you don't have to define anything if you want to use kilometers.
Callbacks:
Code:
OnVehicleTransmissionChange(vehicleid, newtrans, oldtrans);
OnVehicleSpeedChange(vehicleid, newspeed, oldspeed);
Example
Code:
public OnVehicleSpeedChange(vehicleid, newspeed, oldspeed)
{
if(newspeed >= 200)
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
format(string, sizeof(string),
"SERVER: %s, you are driving too fast. (%i kmph)", newspeed);
SendClientMessage(i, 0xF00000AA, string);
}
}
}
}
return 1;
}
Download
Solidfiles.com
Re: Vehicle Library - Transmission and Speed Detection System -
Kar - 11.08.2010
very nice but easy ^^ lol i wonder who would be the one to make gear's as in you have to shift up & down ^:P
Re: Vehicle Library - Transmission and Speed Detection System -
WillyP - 11.08.2010
Quote:
Originally Posted by Kar
very nice but easy ^^ lol i wonder who would be the one to make gear's as in you have to shift up & down ^:P
|
i thought about that idea
Re: Vehicle Library - Transmission and Speed Detection System -
ivex - 11.08.2010
Quote:
Originally Posted by Kar
very nice but easy ^^ lol i wonder who would be the one to make gear's as in you have to shift up & down ^:P
|
i made that... it isnt very hard ... just Set/GetVehicleVelocity and a timer ... but its looks stupid becaus in samp we cant make "neutral" gear so its stupid for me ... now i use just textdraw who shows speed and gear xd
Re: Vehicle Library - Transmission and Speed Detection System -
Kar - 11.08.2010
getvehiclevelocity? lol you dont need that for gear's im just preddi lazy;\
Re: Vehicle Library - Transmission and Speed Detection System -
Lorenc_ - 11.08.2010
I might use this after all my boats on my server need to go @ the speed of 60.
Code:
if(newspeed >= 60)
{
}
Very damn usful
i love it, thanks.
Re: Vehicle Library - Transmission and Speed Detection System -
ivex - 14.08.2010
Quote:
Originally Posted by Kar
getvehiclevelocity? lol you dont need that for gear's im just preddi lazy;\
|
man you didnt get it ... Using the GetVehicleVelocity and SetVehicleVelocity i can slow down and speed up vehicles right .. so i have made that with button CTRL and SHIFT i can gear up and gear down so .. with SetVehicleVelocity i can reduce vehicle speed get it
??