SERVER: Unknown Command
#1

Right, I have a vehicle command on my server, and it works perfectly fine, it shows the car ModelID and car UID next to it.
pawn Код:
if(strcmp(cmd, "/v", true) == 0)
    {
        if(PlayerInfo[playerid][pCarKey1] == 999 && PlayerInfo[playerid][pCarKey2] == 999)
        {
            SendClientMessage(playerid, COLOR_WHITE,"Nie masz zadnego samochodu");
            return 0;
        }
        new stringV[256];
        new CarFile[35];
        new CarFile2[35];
        format(CarFile,sizeof(CarFile),"Auta/%d.ini",PlayerInfo[playerid][pCarKey1]);
        format(CarFile2,sizeof(CarFile2),"Auta/%d.ini",PlayerInfo[playerid][pCarKey2]);
        new model1;
        new model2;
        model1 = dini_Int(CarFile,"ModelID");
        model2 = dini_Int(CarFile2,"ModelID");
        format(globalcar1,sizeof(globalcar1),"%d [UID: %d]",model1,PlayerInfo[playerid][pCarKey1]);
        format(globalcar2,sizeof(globalcar2),"%d [UID: %d]",model2,PlayerInfo[playerid][pCarKey2]);
        format(stringV,sizeof(stringV),"%s\n%s",globalcar1,globalcar2);
        ShowPlayerDialog(playerid, VCMD, DIALOG_STYLE_LIST, "Twoje pojazdy:", stringV, "Wybierz", "Zamknij");
        return 1;
    }
But, when I try to convert car ModelID in to car name. The command doesnt work (SERVER: Uknown Command)

This is the new command with getting vehicle name from id.
pawn Код:
if(strcmp(cmd, "/v", true) == 0)
    {
        if(PlayerInfo[playerid][pCarKey1] == 999 && PlayerInfo[playerid][pCarKey2] == 999)
        {
            SendClientMessage(playerid, COLOR_WHITE,"Nie masz zadnego samochodu");
            return 0;
        }
        new stringV[256];
        new CarFile[35];
        new CarFile2[35];
        format(CarFile,sizeof(CarFile),"Auta/%d.ini",PlayerInfo[playerid][pCarKey1]);
        format(CarFile2,sizeof(CarFile2),"Auta/%d.ini",PlayerInfo[playerid][pCarKey2]);
        new model1;
        new model2;
        model1 = dini_Int(CarFile,"ModelID");
        model2 = dini_Int(CarFile2,"ModelID");
        format(globalcar1,sizeof(globalcar1),"%s [UID: %d]",GetVehicleName(model1),PlayerInfo[playerid][pCarKey1]);
        format(globalcar2,sizeof(globalcar2),"%s [UID: %d]",GetVehicleName(model2),PlayerInfo[playerid][pCarKey2]);
        format(stringV,sizeof(stringV),"%s\n%s",globalcar1,globalcar2);
        ShowPlayerDialog(playerid, VCMD, DIALOG_STYLE_LIST, "Twoje pojazdy:", stringV, "Wybierz", "Zamknij");
        return 1;
    }
And this is getttingid function:
pawn Код:
stock GetVehicleName(vehicleid)
{
    new String[64];
    format(String,sizeof(String),"%s",aVehicleNames[GetVehicleModel(vehicleid) - 400]);
    return String;
}

new aVehicleNames[][] =
{
    "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
    "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
    "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
    "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
    "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
    "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
    "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
    "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
    "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
    "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
    "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
    "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
    "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
    "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
    "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin",
    "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
    "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
    "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
    "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
    "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
    "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
    "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
    "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
    "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
    "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
    "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
    "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
    "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
    "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
    "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
    "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
    "Tiller", "Utility Trailer"
};
Reply
#2

I'm not sure but you should write this replace that
pawn Код:
new aVehicleNames[212][] =
{
    {"Landstalker"},
    {"Bravura"},
    {"Buffalo"},
    {"Linerunner"},
    {"Perrenial"},
    {"Sentinel"},
    {"Dumper"},
    {"Firetruck"},
    {"Trashmaster"},
    {"Stretch"},
    {"Manana"},
    {"Infernus"},
    {"Voodoo"},
    {"Pony"},
    {"Mule"},
    {"Cheetah"},
    {"Ambulance"},
    {"Leviathan"},
    {"Moonbeam"},
    {"Esperanto"},
    {"Taxi"},
    {"Washington"},
    {"Bobcat"},
    {"MrWhoopee"},
    {"BFInjection"},
    {"Hunter"},
    {"Premier"},
    {"Enforcer"},
    {"Securicar"},
    {"Banshee"},
    {"Predator"},
    {"Bus"},
    {"Rhino"},
    {"Barracks"},
    {"Hotknife"},
    {"Trailer1"},
    {"Previon"},
    {"Coach"},
    {"Cabbie"},
    {"Stallion"},
    {"Rumpo"},
    {"RCBandit"},
    {"Romero"},
    {"Packer"},
    {"Monster"},
    {"Admiral"},
    {"Squalo"},
    {"Seasparrow"},
    {"Pizzaboy"},
    {"Tram"},
    {"Trailer2"},
    {"Turismo"},
    {"Speeder"},
    {"Reefer"},
    {"Tropic"},
    {"Flatbed"},
    {"Yankee"},
    {"Caddy"},
    {"Solair"},
    {"BerkleyRCVan"},
    {"Skimmer"},
    {"PCJ-600"},
    {"Faggio"},
    {"Freeway"},
    {"RCBaron"},
    {"RCRaider"},
    {"Glendale"},
    {"Oceanic"},
    {"Sanchez"},
    {"Sparrow"},
    {"Patriot"},
    {"Quad"},
    {"Coastguard"},
    {"Dinghy"},
    {"Hermes"},
    {"Sabre"},
    {"Rustler"},
    {"ZR-350"},
    {"Walton"},
    {"Regina"},
    {"Comet"},
    {"BMX"},
    {"Burrito"},
    {"Camper"},
    {"Marquis"},
    {"Baggage"},
    {"Dozer"},
    {"Maverick"},
    {"NewsChopper"},
    {"Rancher"},
    {"FBIRancher"},
    {"Virgo"},
    {"Greenwood"},
    {"Jetmax"},
    {"Hotring"},
    {"Sandking"},
    {"Blista Compact"},
    {"Police Maverick"},
    {"Boxville"},
    {"Benson"},
    {"Mesa"},
    {"RCGoblin"},
    {"HotringRacer A"},
    {"HotringRacer B"},
    {"BloodringBanger"},
    {"Rancher"},
    {"SuperGT"},
    {"Elegant"},
    {"Journey"},
    {"Bike"},
    {"MountainBike"},
    {"Beagle"},
    {"Cropdust"},
    {"Stunt"},
    {"Tanker"},
    {"Roadtrain"},
    {"Nebula"},
    {"Majestic"},
    {"Buccaneer"},
    {"Shamal"},
    {"Hydra"},
    {"FCR-900"},
    {"NRG-500"},
    {"HPV1000"},
    {"CementTruck"},
    {"TowTruck"},
    {"Fortune"},
    {"Cadrona"},
    {"FBITruck"},
    {"Willard"},
    {"Forklift"},
    {"Tractor"},
    {"Combine"},
    {"Feltzer"},
    {"Remington"},
    {"Slamvan"},
    {"Blade"},
    {"Freight"},
    {"Streak"},
    {"Vortex"},
    {"Vincent"},
    {"Bullet"},
    {"Clover"},
    {"Sadler"},
    {"FiretruckLA"},
    {"Hustler"},
    {"Intruder"},
    {"Primo"},
    {"Cargobob"},
    {"Tampa"},
    {"Sunrise"},
    {"Merit"},
    {"Utility"},
    {"Nevada"},
    {"Yosemite"},
    {"Windsor"},
    {"MonsterA"},
    {"MonsterB"},
    {"Uranus"},
    {"Jester"},
    {"Sultan"},
    {"Stratum"},
    {"Elegy"},
    {"Raindance"},
    {"RC Tiger"},
    {"Flash"},
    {"Tahoma"},
    {"Savanna"},
    {"Bandito"},
    {"FreightFlat"},
    {"StreakCarriage"},
    {"Kart"},
    {"Mower"},
    {"Duneride"},
    {"Sweeper"},
    {"Broadway"},
    {"Tornado"},
    {"AT-400"},
    {"DFT-30"},
    {"Huntley"},
    {"Stafford"},
    {"BF-400"},
    {"Newsvan"},
    {"Tug"},
    {"Trailer 3"},
    {"Emperor"},
    {"Wayfarer"},
    {"Euros"},
    {"Hotdog"},
    {"Club"},
    {"FreightCarriage"},
    {"Trailer3"},
    {"Andromada"},
    {"Dodo"},
    {"RCCam"},
    {"Launch"},
    {"PoliceCar(LSPD)"},
    {"PoliceCar(SFPD)"},
    {"PoliceCar(LVPD)"},
    {"PoliceRanger"},
    {"Picador"},
    {"S.W.A.T.Van"},
    {"Alpha"},
    {"Phoenix"},
    {"Glendale"},
    {"Sadler"},
    {"LuggageTrailerA"},
    {"LuggageTrailerB"},
    {"StairTrailer"},
    {"Boxville"},
    {"FarmPlow"},
    {"UtilityTrailer"}
};
Reply
#3

Try this.

Код:
format(globalcar1,sizeof(globalcar1),"%s [UID: %d]", aVehicleNames[ model1 - 400 ], PlayerInfo[playerid][pCarKey1]);
format(globalcar2,sizeof(globalcar2),"%s [UID: %d]", aVehicleNames[ model2 - 400 ], PlayerInfo[playerid][pCarKey2]);
Reply
#4

Thx FTLOG it works.

Mineralo thx for trying to help, but the code you gave me is exactly the same as mine, it's just that mine takes up less space xd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)