native IsValidVehicle(vehicleid);
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 Код:
Return false if this vehicle id doesn't exists |
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);
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; |
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;
}
if(!IsValidVehicle(cartarget)) { // case vehicle doesnt exist } else { // exists } |