INVALID_VEHICLE_ID Does not work..
#1

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

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

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

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

Use this instead:

pawn Код:
if(GetVehicleModel(vehicleid) == 0)
Reply
#6

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

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

I just pasted
native IsValidVehicle(vehicleid);

in a_vehicles include.
Thanks people.
Reply
#9

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

you're right, but they won't add it in the next version?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)