PDA

View Full Version : Native of SA-MP forgotted


iDarkRain
20/12/2011, 09:40 PM
The developers or Kye has forgotted a native "IsValidVehicle(vehicleid)" in the includes and the wiki.

If you want to use this native put in your script:

native IsValidVehicle(vehicleid);

Return true if is a valid vehicle ID
Return false if this vehicle id doesn't exists

kizla
20/12/2011, 09:52 PM
The developers or Kye has forgotted a native "IsValidVehicle(vehicleid)" in the includes and the wiki.

If you want to use this native put in your script:

native IsValidVehicle(vehicleid);

Return true if is a valid vehicle ID
Return false if this vehicle id doesn't exists

nope, if it exists give us a link...

here is all samp natives which are for vehicles;


native CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay);
native DestroyVehicle(vehicleid);
native IsVehicleStreamedIn(vehicleid, forplayerid);
native GetVehiclePos(vehicleid, &Float:x, &Float:y, &Float:z);
native SetVehiclePos(vehicleid, Float:x, Float:y, Float:z);
native GetVehicleZAngle(vehicleid, &Float:z_angle);
native GetVehicleRotationQuat(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z);
native Float:GetVehicleDistanceFromPoint(vehicleid, Float:X, Float:Y, Float:Z);
native SetVehicleZAngle(vehicleid, Float:z_angle);
native SetVehicleParamsForPlayer(vehicleid,playerid,objec tive,doorslocked);
native ManualVehicleEngineAndLights();
native SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
native GetVehicleParamsEx(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective);
native SetVehicleToRespawn(vehicleid);
native LinkVehicleToInterior(vehicleid, interiorid);
native AddVehicleComponent(vehicleid, componentid);
native RemoveVehicleComponent(vehicleid, componentid);
native ChangeVehicleColor(vehicleid, color1, color2);
native ChangeVehiclePaintjob(vehicleid, paintjobid);
native SetVehicleHealth(vehicleid, Float:health);
native GetVehicleHealth(vehicleid, &Float:health);
native AttachTrailerToVehicle(trailerid, vehicleid);
native DetachTrailerFromVehicle(vehicleid);
native IsTrailerAttachedToVehicle(vehicleid);
native GetVehicleTrailer(vehicleid);
native SetVehicleNumberPlate(vehicleid, numberplate[]);
native GetVehicleModel(vehicleid);
native GetVehicleComponentInSlot(vehicleid, slot);
native GetVehicleComponentType(component);
native RepairVehicle(vehicleid);
native GetVehicleVelocity(vehicleid, &Float:X, &Float:Y, &Float:Z);
native SetVehicleVelocity(vehicleid, Float:X, Float:Y, Float:Z);
native SetVehicleAngularVelocity(vehicleid, Float:X, Float:Y, Float:Z);
native GetVehicleDamageStatus(vehicleid, &panels, &doors, &lights, &tires);
native UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
native SetVehicleVirtualWorld(vehicleid, worldid);
native GetVehicleVirtualWorld(vehicleid);

Steven82
20/12/2011, 09:56 PM
This is an actual native. It works, i whipped up a test command to confirm and it works as long as you add the native part to the top of your script.


CMD:validveh(playerid, params[])
{
new vehid;
if(sscanf(params, "d", vehid))
return SendClientMessage(playerid, COLOR_GRAD1, "SYNTAX: /validveh [vehicleid]");
if(!IsValidVehicle(vehid))
return SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That is an invalid vehicle.");
//
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[Info]: That is a VALID vehicle.");
return 1;
}


nope, if it exists give us a link...
here is all samp natives which are for vehicles;

Next time test it, before acting like you know everything(not trying to sound like a dick). Just because it wasn't listed doesn't mean it's not there. Thats exactly why he posted the topic, not so you could show us all the natives for vehicles..

Edit:
It for sure wasn't forgotten about. Kye has to know it's there. But AFAIK right now there is no real use of this function so why include it?

Edit-2: I have actually found a use for this function and it was just recently that i thought i might need to use this function. So then i used it in a destroy vehicle command to check if the vehicleid given is even exists on the server and if it doesn't it display an error message.


CMD:dveh(playerid, params[])
{
new targetveh, string[128];
if(sscanf(params, "d", targetveh))
return SendClientMessage(playerid, COLOR_GRAD1, "SYNTAX: /dveh [vehicleid]");
if(!IsValidVehicle(targetveh))
return SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That vehicle doesn't exist.");
//
DestroyVehicle(targetveh);
format(string, sizeof(string), "[Info]: You have destroyed vehicle-id: %d", targetveh);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}

flrp
15/05/2012, 06:07 PM
Is this still valid too?

if(!IsValidVehicle(cartarget))
{
// case vehicle doesnt exist
}
else
{
// exists
}

OTACON
20/12/2013, 02:58 AM
http://wiki.sa-mp.com/wiki/IsValidVehicle

BigETI
20/12/2013, 03:10 AM
GetVehicleModel() can be used for the same purpose aswell.

CyNiC
20/12/2013, 03:38 AM
http://wiki.sa-mp.com/wiki/IsValidVehicle

What your post says which we don't know yet? You should ask yourself before to give an up for a 2011 thread.