[Include] Vehicle Category check
#1

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;
}
Bugs
No 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!
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Code?
Sorry ****** i forgot the code

EDIT: added the codes
Reply
#3

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
Reply
#4

nice dude
Reply
#5

Quote:
Originally Posted by JFF
Посмотреть сообщение
nice dude
Thanks!
Reply
#6

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.
Reply
#7

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
Reply
#8

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
Reply
#9

Thanks, ill be able to use this to make an ATC system for my server.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)