/v always shows ERROR: Invalid vehicle ID when ID isn't invalid
#1

pawn Код:
CMD:v(playerid, params[])
{
    new
        modelid,
        Float:zPos[ 3 ];

    if( sscanf( params, "i", modelid ) ) SendClientMessage(playerid, COLOR_GREY, "USAGE: /v [vehicle id]");
    if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid vehicle ID.");
    {
    GetPlayerPos( playerid, zPos[ 0 ], zPos[ 1 ], zPos[ 2 ] );
    CreateVehicle( modelid, zPos[0], zPos[ 1 ], zPos[ 2 ], 0, 155, 1, -1);
    }
    return 1;
}
Help please? this has got me stumped i'm using YCMD for this everytime I use /v it will say it has an invalid vehicle ID even if it is correct
Reply
#2

pawn Код:
CMD:v(playerid, params[])
{
    new
        modelid,
        Float:zPos[ 3 ];

    if( sscanf( params, "i", modelid ) ) SendClientMessage(playerid, COLOR_GREY, "USAGE: /v [vehicle id]");
    if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid vehicle ID.");
    else
    {
    GetPlayerPos( playerid, zPos[ 0 ], zPos[ 1 ], zPos[ 2 ] );
    CreateVehicle( modelid, zPos[0], zPos[ 1 ], zPos[ 2 ], 0, 155, 1, -1);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Anuris
Посмотреть сообщение
pawn Код:
CMD:v(playerid, params[])
{
    new
        modelid,
        Float:zPos[ 3 ];

    if( sscanf( params, "i", modelid ) ) SendClientMessage(playerid, COLOR_GREY, "USAGE: /v [vehicle id]");
    if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid vehicle ID.");
    else
    {
    GetPlayerPos( playerid, zPos[ 0 ], zPos[ 1 ], zPos[ 2 ] );
    CreateVehicle( modelid, zPos[0], zPos[ 1 ], zPos[ 2 ], 0, 155, 1, -1);
    }
    return 1;
}
it works but if i just do /v to show the USAGE message it still comes up with the INVALID VEHICLE ID message aswell, anyway to stop this?
Reply
#4

This is zcmd not ycmd
Reply
#5

Works fine with zcmd...
Reply
#6

You forgot a return statement before sending usage
Use this
pawn Код:
CMD:v(playerid, params[])
{
    new
        modelid,
        Float:zPos[ 3 ];  
    if( sscanf( params, "i", modelid ) )return SendClientMessage(playerid, COLOR_GREY, "USAGE: /v [vehicle id]");
    if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid vehicle ID.");    
    GetPlayerPos( playerid, zPos[ 0 ], zPos[ 1 ], zPos[ 2 ] );
    CreateVehicle( modelid, zPos[0], zPos[ 1 ], zPos[ 2 ], 0, 155, 1, -1);    
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)