INVALID_VEHICLE_ID Does not work.. -
PaulDinam - 17.02.2013
pawn Код:
CMD:getcar(playerid, params[])
{
new vehicle, Float:x, Float:y, Float:z;
if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
if(sscanf(params,"i",vehicle)) return SyntaxMSG(playerid, "/getcar [vehicleid]");
if(vehicle == INVALID_VEHICLE_ID) return SCM(playerid, -1, "No such vehicle.");
GetPlayerPos(playerid, x, y, z);
SetVehiclePos(vehicle, x, y+4, z);
SetVehicleVirtualWorld(vehicle, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicle, GetInterior(playerid));
return 1;
}
if the vehicle == INVALID_VEHICLE_ID... when I do /getcar.. but it's not working
Re: INVALID_VEHICLE_ID Does not work.. -
YoYo123 - 17.02.2013
Car IDs range from 400 to 611 inclusive so check if the variable is smaller than 400 or bigger than 611. If yes, send the error message.
Not sure this is the kind of command you're trying to make, if not tell me
Re: INVALID_VEHICLE_ID Does not work.. -
IstuntmanI - 17.02.2013
Better change
pawn Код:
if(vehicle == INVALID_VEHICLE_ID) return SCM(playerid, -1, "No such vehicle.");
with
pawn Код:
if(!GetVehicleModel(vehicle)) return SCM(playerid, -1, "No such vehicle.");
If the model of the vehicle is 0 (not created vehicle), then say that the vehicle doesn't exists.
Re: INVALID_VEHICLE_ID Does not work.. -
YoYo123 - 17.02.2013
Forget my last post, I see what kind of command you're trying to make here.
Include this at the top of your script:
pawn Код:
native IsValidVehicle(vehicleid);
And use IsValidVehicle(vehicleid) in your command script.
Re: INVALID_VEHICLE_ID Does not work.. -
MP2 - 17.02.2013
Use this instead:
pawn Код:
if(GetVehicleModel(vehicleid) == 0)
Re: INVALID_VEHICLE_ID Does not work.. -
IstuntmanI - 17.02.2013
Quote:
Originally Posted by MP2
Use this instead:
pawn Код:
if(GetVehicleModel(vehicleid) == 0)
|
Quote:
Originally Posted by YoYo123
Forget my last post, I see what kind of command you're trying to make here.
Include this at the top of your script:
pawn Код:
native IsValidVehicle(vehicleid);
And use IsValidVehicle(vehicleid) in your command script.
|
I'm curious why it isn't included in a_vehicles.
Re: INVALID_VEHICLE_ID Does not work.. -
YoYo123 - 17.02.2013
Quote:
Originally Posted by costel_nistor96
I'm curious why it isn't included in a_vehicles.
|
Same, should have been added in 0.3x, I guess the team forgot to add it or something.
Re: INVALID_VEHICLE_ID Does not work.. -
PaulDinam - 17.02.2013
I just pasted
native IsValidVehicle(vehicleid);
in a_vehicles include.
Thanks people.
Re: INVALID_VEHICLE_ID Does not work.. -
Sergei - 17.02.2013
Quote:
Originally Posted by PaulDinam
I just pasted
native IsValidVehicle(vehicleid);
in a_vehicles include.
Thanks people.
|
Don't do that. Now if you update includes, make fresh copy of pawno, etc you will have to modify that include every time or your gammeode won't compile. Just post that line at top of your script.
Re: INVALID_VEHICLE_ID Does not work.. -
PaulDinam - 17.02.2013
you're right, but they won't add it in the next version?