[HELP]Reading car names with ID's - Read. (giving +1 rep who soolve it for me)
#1

Hai,
I have started a new gamemode, and started using for first time zcmd and sscanf. I have made a /car command easily, it is /car [ID], and it works perfectly good. next thing is that I wanted also to be able to use /car [Name/Part of name]. Example, /car infer for infernus. I have copied from here all car list, a GetModelIDFromName function, and I just need if someone should explain me how to make it work also with names. I jsutw ant to keep this, so I can use /car 411 for xample, an in same time /car infernus @ same command. I'll give +1 rep to everyone who helps me.

heres code:

pawn Код:
COMMAND:car(playerid,params[])
{
    if (IsPlayerInAnyVehicle(playerid) != 1)
        {
            new Float: x, Float: y, Float: z, Float: r, vehicle;
            if (!sscanf(params, "i", vehicle))
             {
               if((vehicle < 400 || vehicle > 611) != true )
                {
                    GetPlayerPos(playerid,x,y,z);
                    GetPlayerFacingAngle(playerid,r);
                    vehicle =  CreateVehicle(vehicle, x, y, z, r, 0, 1, 0);
                    PutPlayerInVehicle(playerid,vehicle,0);
                }
               else  SendClientMessage(playerid,-1,"***"#COL_CYAN" ID's: "COL_BLUE"    400-611");
            }
            else SendClientMessage(playerid,-1,"***"#COL_CYAN" Usage: "COL_BLUE"    /car [Car ID]");
        }
    else SendClientMessage(playerid,-1,"***"#COL_CYAN" You already have a "#COL_MAGENTA"car!!");
    return 1;
}
Thank you in advance,
Aco.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)