[Include] Vehicle Category check - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Vehicle Category check (
/showthread.php?tid=514756)
Vehicle Category check -
superrobot48 - 23.05.2014
I was so bored so i was thinking and thinking and ended up with this very easy to make include.
well here it goes
Features
This include can check if a Vehicle is a flying vehicle or a boat or a car or a bike!
this include might be useful
Natives
pawn Код:
native IsVehicleFlyingVehicle(vehicleid);
native IsVehicleLandVehicle(vehicleid);
native IsVehicleBoat(vehicleid);
native IsVehicleBike(vehicleid);
Example Usage
pawn Код:
#include <vehcheck> //add this at top
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
if(IsVehicleLandVehicle(vehicleid))
{
SendClientMessage(playerid,-1,"You are currently entering a vehicle which runs on land :P");
}
if(IsVehicleBoat(vehicleid))
{
SendClientMessage(playerid,-1,"You are currently entering a boat");
}
if(IsVehicleFlyingVehicle(vehicleid))
{
SendClientMessage(playerid,-1,"You are currently entering a flying vehicle!");
}
if(IsVehicleBike(vehicleid))
{
SendClientMessage(playerid,-1,"You are currently entering a bike");
}
return 1;
}
BugsNo bugs reported
Download
Pastebin:
http://pastebin.com/ZS5KgTdT
Dropbox:
https://www.dropbox.com/s/1kfe0wfwjy1xup2/vehcheck.inc
Report any bugs.
Thanks to ****** for the suggestion of the usage of arrays
and to JFF for helping me with the arrays
Thank you So much for reading!
Re: Vehicle Category check -
superrobot48 - 23.05.2014
Quote:
Originally Posted by ******
Code?
|
Sorry ****** i forgot the code
EDIT: added the codes
Re: Vehicle Category check -
superrobot48 - 23.05.2014
Quote:
Originally Posted by ******
May I suggest using an array of data for this, instead of calling a native function dozens of times?
|
Thanks for the suggestion
Re: Vehicle Category check -
JFF - 23.05.2014
nice dude
Re: Vehicle Category check -
superrobot48 - 23.05.2014
Quote:
Originally Posted by JFF
nice dude
|
Thanks!
Re: Vehicle Category check -
Konstantinos - 23.05.2014
And except the one ****** mentioned, IsPlayerInCar function is wrong. If a vehicle is neither boat nor an aircraft, that doesn't mean it's a car. It can be a bike, a train/tram, a kart, an RC vehicle etc.
Re: Vehicle Category check -
superrobot48 - 23.05.2014
Quote:
Originally Posted by Konstantinos
And except the one ****** mentioned, IsPlayerInCar function is wrong. If a vehicle is neither boat nor an aircraft, that doesn't mean it's a car. It can be a bike, a train/tram, a kart, an RC vehicle etc.
|
Thanks ! i'll edit it ASAP
Re: Vehicle Category check -
superrobot48 - 23.05.2014
Quote:
Originally Posted by ******
Why are the functions called "IsPlayerInX", when none of them take a player parameter, nor do they check that anyone is in the vehicles? "IsVehicleX" would be a much better class of names.
|
First i was planning to do that sir , sorry .
UPDATED TO 1.1
Re: Vehicle Category check -
Mark_Weston - 23.05.2014
Thanks, ill be able to use this to make an ATC system for my server.