I have a problem with a command "/vehicle"
#8

Quote:
Originally Posted by Jefff
Посмотреть сообщение
sscanf is better as you can see, it's more code with strtok vs sscanf

this should work
pawn Код:
if(strcmp(cmd, "/vehicle", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] != 10) SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
    else
    {
        new Model[4];
        strcat(Model,strtok(cmdtext, idx));
        if(!Model[0]) SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /vehicul [model] [culoare1] [culoare2]");
        else if(!(400 <= (Model[0] = strval(Model)) <= 611)) SendClientMessage(playerid,COLOR_GRAD2, "Invalid vehicle ID specified !(411 - 611)");
        else
        {
            new color_1[4];
            strcat(color_1,strtok(cmdtext, idx));
            if(!color_1[0]) SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /vehicul [model] [culoare1] [culoare2]");
            else if(!(0 <= (color_1[0] = strval(color_1)) <= 255)) SendClientMessage(playerid, COLOR_GRAD2, "Car color ID's: 0-255");
            else
            {
                new color_2[4];
                strcat(color_2,strtok(cmdtext, idx));
                if(!color_2[0]) SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /vehicul [model] [culoare1] [culoare2]");
                else if(!(0 <= (color_2[0] = strval(color_2)) <= 255)) SendClientMessage(playerid, COLOR_GRAD2, "Car color ID's: 0-255");
                else
                {
                    new Float:X, Float:Y, Float:Z, Float:A;
                    GetPlayerPos(playerid, X,Y,Z);
                    GetPlayerFacingAngle(playerid,A);
                    new carid = CreateVehicle(Model[0], X, Y, Z, A, color_1[0], color_2[0], -1);
                    LinkVehicleToInterior(carid,GetPlayerInterior(playerid));
                    PutPlayerInVehicle(playerid,carid,0);
                }
            }
        }
    }
    return 1;
}
Thx a lot :d it works
Reply


Messages In This Thread
I have a problem with a command "/vehicle" - by radiobizza - 10.01.2016, 17:24
Re: I have a problem with a command "/vehicle" - by radiobizza - 10.01.2016, 19:36
Re: I have a problem with a command "/vehicle" - by Stanford - 10.01.2016, 20:03
Re: I have a problem with a command "/vehicle" - by radiobizza - 10.01.2016, 20:30
Re: I have a problem with a command "/vehicle" - by Jefff - 10.01.2016, 20:35
Re: I have a problem with a command "/vehicle" - by radiobizza - 10.01.2016, 20:49
Re: I have a problem with a command "/vehicle" - by Jefff - 10.01.2016, 20:51
Re: I have a problem with a command "/vehicle" - by radiobizza - 11.01.2016, 03:36

Forum Jump:


Users browsing this thread: 1 Guest(s)