SA-MP Forums Archive
/v always shows ERROR: Invalid vehicle ID when ID isn't invalid - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /v always shows ERROR: Invalid vehicle ID when ID isn't invalid (/showthread.php?tid=559300)



/v always shows ERROR: Invalid vehicle ID when ID isn't invalid - Wizardking - 22.01.2015

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


Re: /v always shows ERROR: Invalid vehicle ID when ID isn't invalid - Anuris - 22.01.2015

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;
}



Re: /v always shows ERROR: Invalid vehicle ID when ID isn't invalid - Wizardking - 22.01.2015

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?


Re: /v always shows ERROR: Invalid vehicle ID when ID isn't invalid - AdamsP - 22.01.2015

This is zcmd not ycmd


Re: /v always shows ERROR: Invalid vehicle ID when ID isn't invalid - Schneider - 22.01.2015

Works fine with zcmd...


Re: /v always shows ERROR: Invalid vehicle ID when ID isn't invalid - BroZeus - 22.01.2015

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;
}