Command not working right
#2

I am unsure what the whole looping construct is for. You should just try to create the vehicle and if that fails because the limit is reached then CreateVehicle will return INVALID_VEHICLE_ID. What you described should be easily achievable with sscanf's optional parameters.

pawn Код:
if(sscanf(params, "D(-1)D(-1)D(-1)D(300)", model, col1, col2, delay))
{
    if(!(400 <= model <= 611))
    {
        // model not valid, do something
    }

    if(col1 == -1)
        col1 = random(126);

    if(col2 == -1)
        col2 = random(126);

    if(!(15 <= delay <= 300))
        return SendClientMessage ... invalid respawn delay must be between 15 and 300

    v[playerid] = CreateVehicle(model, ..., col1, col2, delay);

    if(v[playerid] == INVALID_VEHICLE_ID)
        return SendClientMessage ... failed, vehicle limit reached
   
}
You could even prepare the formatstring by inserting the player's current vehicle model.
Reply


Messages In This Thread
Command not working right - by BGTrucker - 12.04.2015, 16:54
Re: Command not working right - by Vince - 12.04.2015, 18:05
Re: Command not working right - by BGTrucker - 13.04.2015, 04:41

Forum Jump:


Users browsing this thread: 1 Guest(s)