/aveh command not working.
#1

Hello, I have a custom admin system, i created this command /aveh to spawn admin vehicles by name but it not working every time i'm getting message "USAGE: /aveh [vehicle name]" and cars are not spawning.

please tell what is wrong here.
here is code:

pawn Code:
dcmd_aveh(playerid, params[])
{
    new Vehicle[50], Float:pos[4];
    if(pInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
    if(sscanf(params, "s[50]", Vehicle)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /aveh [vehicle name]");
    else
    {
        new string[128];
        new veh = GetVehicleModelIDFromName(Vehicle);
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        GetPlayerFacingAngle(playerid, pos[3]);
        format(string, sizeof(string), "* You have spawned a %s. ID: %i. ", VehicleNames[veh - 400], veh);
        SendClientMessage(playerid, COLOR_SKYBLUE, string);
        for(new i=0; i<MAX_CUSTOM_VEHICLES; i++)
        {
           if(!cVeh[i])
           {
            cVeh[i] = CreateVehicle(veh, pos[0], pos[1], pos[2], pos[3], 0, 0, 1200);
            PutPlayerInVehicle(playerid,cVeh[i],0);
            i = MAX_CUSTOM_VEHICLES;
            LinkVehicleToInterior(cVeh[i], GetPlayerInterior(playerid));
            SetVehicleVirtualWorld(cVeh[i], GetPlayerVirtualWorld(playerid));
           }
        }
        if(veh < 400 || veh > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid Vehicle ID / Name.");
    }
    return 1;
}
Reply


Messages In This Thread
/aveh command not working. - by Anak - 30.06.2013, 17:37
Re: /aveh command not working. - by _Khaled_ - 30.06.2013, 19:56

Forum Jump:


Users browsing this thread: 1 Guest(s)