Native of SA-MP forgotted
#1

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:

pawn Код:
native IsValidVehicle(vehicleid);
Return true if is a valid vehicle ID
Return false if this vehicle id doesn't exists
Reply
#2

Quote:
Originally Posted by iDarkRain
Посмотреть сообщение
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:

pawn Код:
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;

pawn Код:
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,objective,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);
Reply
#3

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.

pawn Код:
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;
}
Quote:
Originally Posted by kizla
Посмотреть сообщение
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.

pawn Код:
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;
}
Reply
#4

Is this still valid too?

Quote:

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

Reply
#5

https://sampwiki.blast.hk/wiki/IsValidVehicle
Reply
#6

GetVehicleModel() can be used for the same purpose aswell.
Reply
#7

Quote:
Originally Posted by OTACON
Посмотреть сообщение
What your post says which we don't know yet? You should ask yourself before to give an up for a 2011 thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)