[Ajuda] Erro Comando de Criar Carros
#1

bom, achei um comando de criar carros por nome ou id via internet, posteriormente vou melhorar o comando para colocar em caixinha e separar em categoria, mas agr preciso do comando , como nao sei procurei na net e foi oq achei

pawn Код:
CMD:v(playerid, params[])
{
        new Vehicle[32], VehicleID, ColorOne, ColorTwo;
        PlayerInfo[playerid][pCanSpawnVehicle] = true;
        if(sscanf(params, "s[32]D(1)D(1)", Vehicle, ColorOne, ColorTwo))
        {
            PlayerInfo[playerid][pCanSpawnVehicle] = true;
            SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /v[Vehiclename/Vehicleid] [Color 1 (optional)] [Color 2 (optional)]");
            SendClientMessage(playerid, COLOR_GREY, "[USAGE]: Like /v Turismo , /v Elegy /v Nrg /v 522");
            return 1;
        }

        if(PlayerInfo[playerid][pCanSpawnVehicle])
        {
            VehicleID = GetVehicleModelIDFromName(Vehicle);
            if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 &&
               VehicleID != 430 && VehicleID != 417 && VehicleID != 435 &&
           VehicleID != 446 && VehicleID != 449 && VehicleID != 450 &&
               VehicleID != 452 && VehicleID != 453 && VehicleID != 454 &&
                   VehicleID != 460 && VehicleID != 464 && VehicleID != 465 &&
                   VehicleID != 469 && VehicleID != 472 && VehicleID != 473 &&
                   VehicleID != 476 && VehicleID != 484 && VehicleID != 487 &&
                   VehicleID != 488 && VehicleID != 493 && VehicleID != 497 &&
                   VehicleID != 501 && VehicleID != 511 && VehicleID != 512 &&
                   VehicleID != 513 && VehicleID != 519 && VehicleID != 520 &&
                   VehicleID != 537 && VehicleID != 538 && VehicleID != 548 &&
                   VehicleID != 553 && VehicleID != 563 && VehicleID != 564 &&
                   VehicleID != 569 && VehicleID != 570 && VehicleID != 577 &&
                   VehicleID != 584 && VehicleID != 590 && VehicleID != 591 &&
                   VehicleID != 592 && VehicleID != 593 && VehicleID != 594 &&
                   VehicleID != 595 && VehicleID != 606 && VehicleID != 607 &&
                   VehicleID != 608 && VehicleID != 610 && VehicleID != 611) {
                        if(VehicleID == -1 )
                        {
                                VehicleID = strval(Vehicle);

                                if(VehicleID < 400 || VehicleID > 611 )
                                {
                                        return SendClientMessage(playerid, COLOR_GREY, "You entered an invalid vehiclename!");
                                }
                        }

                        GetPlayerPos(playerid, pX, pY, pZ);
                        GetPlayerFacingAngle(playerid, pAngle);

                        DestroyVehicle(PlayerInfo[playerid][pSpawnVehicle]);
                        PlayerInfo[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, ColorOne, ColorTwo, -1);
                        LinkVehicleToInterior(PlayerInfo[playerid][pSpawnVehicle], GetPlayerInterior(playerid));
                        PutPlayerInVehicle(playerid, PlayerInfo[playerid][pSpawnVehicle], 0);
                        SendClientMessage(playerid, COLOR_GREY, "You succesfully spawned this vehicle!");
                } else {
                    SendClientMessage(playerid, COLOR_GREY, "You are not allowed to spawn this vehicle!!");
                }
        } else {
                SendClientMessage(playerid, COLOR_GREY, "You can not spawn vehicles in this zone!");
        }
        return 1;
}
pawn Код:
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : warning 217: loose indentation
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : error 029: invalid expression, assumed zero
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : error 017: undefined symbol "cmd_v"
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : error 029: invalid expression, assumed zero
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
esses sao os erros, mas para a nao confusao de quem for me ajudar, eu coloquei esse comando em OnPlayerCommandText ja que nao sabia onde isso pode ir ,( acho q deve ser ai mesmo mas sei la o troзo nao usa /command .-. )

PS: linha 156 e esta
pawn Код:
CMD:v(playerid, params[])
Reply
#2

Tem jeito mais fбcil de criar carros!
Reply
#3

Quote:
Originally Posted by Stroon
Посмотреть сообщение
Tem jeito mais fбcil de criar carros!
se vc puder me passar eu seria grato
Reply
#4

Esse e funcional
pawn Код:
#define DIALOG_CARS 231
pawn Код:
if(!strcmp(cmdtext, "/carro", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] Digite seu Carro");
        ShowPlayerDialog(playerid,DIALOG_CARS,DIALOG_STYLE_INPUT,"Carros","Digite id do seu carro abaixo:","Carro","Sair");

        return 1;
    }
pawn Код:
if(dialogid == DIALOG_CARS)
    {
        if(!response)
            return SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] Vocк cancelou a seleзгo de carros");
        if(!strval(inputtext))
            return SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] Vocк cancelou a seleзгo de carros");
        if(!IsValidVehicle(strval(inputtext)))
            return SendClientMessage(playerid, 0xFFFFFFFF, "[ERRO] Carro Invбlido");

        format(message, sizeof(message), "Vocк colocou o carro %s(%i)", NomeCarros[strval(inputtext)-400],strval(inputtext));
        SendClientMessage(playerid, 0xFFFFFFFF, message);
        GetPlayerPos(playerid, x, y, z);
        PutPlayerInVehicle(playerid,CreateVehicle(strval(inputtext),x, y, z, 82,0,1,60), 0);
        PlayerPlaySound(playerid,1133,0.0,0.0,0.0); //sound
        return 1;
    }
pawn Код:
new
    NomeCarros[][] =
{
    "Landstalker",
    "Bravura",
    "Buffalo",
    "Linerunner",
    "Pereniel",
    "Sentinel",
    "Dumper",
    "Firetruck",
    "Trashmaster",
    "Stretch",
    "Manana",
    "Infernus",
    "Voodoo",
    "Pony",
    "Mule",
    "Cheetah",
    "Ambulance",
    "Leviathan",
    "Moonbeam",
    "Esperanto",
    "Taxi",
    "Washington",
    "Bobcat",
    "Mr Whoopee",
    "BF Injection",
    "Hunter",
    "Premier",
    "Enforcer",
    "Securicar",
    "Banshee",
    "Predator",
    "Bus",
    "Rhino",
    "Barracks",
    "Hotknife",
    "Trailer",
    "Previon",
    "Coach",
    "Cabbie",
    "Stallion",
    "Rumpo",
    "RC Bandit",
    "Romero",
    "Packer",
    "Monster Truck",
    "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",
    "Hotring Racer",
    "Bloodring Banger",
    "Rancher",
    "Super GT",
    "Elegant",
    "Journey",
    "Bike",
    "Mountain Bike",
    "Beagle",
    "Cropdust",
    "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 Truck",
    "Monster Truck",
    "Uranus",
    "Jester",
    "Sultan",
    "Stratum",
    "Elegy",
    "Raindance",
    "RC Tiger",
    "Flash",
    "Tahoma",
    "Savanna",
    "Bandito",
    "Freight",
    "Trailer",
    "Kart",
    "Mower",
    "Duneride",
    "Sweeper",
    "Broadway",
    "Tornado",
    "AT-400",
    "DFT-30",
    "Huntley",
    "Stafford",
    "BF-400",
    "Newsvan",
    "Tug",
    "Trailer",
    "Emperor",
    "Wayfarer",
    "Euros",
    "Hotdog",
    "Club",
    "Trailer",
    "Trailer",
    "Andromada",
    "Dodo",
    "RC Cam",
    "Launch",
    "Police Car (LS)",
    "Police Car (SF)",
    "Police Car (LV)",
    "Police Ranger",
    "Picador",
    "S.W.A.T. Van",
    "Alpha",
    "Phoenix",
    "Glendale",
    "Sadler",
    "Luggage Trailer",
    "Luggage Trailer",
    "Stair Trailer",
    "Boxville",
    "Farm Plow",
    "Utility Trailer"
};
pawn Код:
stock IsValidVehicle(modelid)
{
    switch(modelid)
    {
        case 581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 509,
            481, 510, 472, 473, 493, 595, 484, 430, 453,
            452, 446, 454, 445, 602, 416, 485, 568, 429, 433, 499, 424, 536, 496,
            504, 422, 609, 498, 401, 575, 518,
            402, 541, 482, 431, 438, 457, 527, 483, 524, 415, 542, 589, 437, 532,
            480, 596, 599, 597, 598, 578, 486,
            507, 562, 585, 427, 419, 587, 490, 528, 533, 544, 407, 565, 455, 530,
            526, 466, 604, 492, 474, 588, 434,
            502, 503, 494, 579, 545, 411, 546, 559, 508, 571, 400, 403, 517, 410,
            551, 500, 418, 572, 423, 414, 516,
            582, 467, 443, 470, 404, 514, 603, 600, 413, 426, 436, 547, 489, 441,
            594, 564, 515, 479, 534, 432, 505,
            442, 440, 475, 543, 605, 495, 567, 428, 405, 535, 458, 580, 439, 561,
            409, 560, 506, 601, 574, 566, 549,
            420, 459, 576, 525, 531, 408, 583, 451, 558, 552, 540, 491, 412, 478,
            421, 529, 456, 554, 477, 548, 425,
            417, 487, 497, 563, 501, 465, 447, 469, 488, 406, 573, 444, 556, 557,
            592, 577, 511, 512, 593, 520, 553,
            464, 476, 519, 460, 513, 539, 471, 435, 450, 591, 606, 607, 610, 584,
            608, 611, 590, 449:
            return modelid;
    }
    return 1;
}
ou mais simples
pawn Код:
if(strcmp(cmd, "/veh", true) == 0 || strcmp(cmd, "/criarveiculo", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
          new nome[24];
          GetPlayerName(playerid, nome, sizeof nome);
          if (PlayerInfo[playerid][pAdmin] > 5000)
          {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USO: /veiculo [carid] [color1] [color2]");
                return 1;
            }
            new car;
            car = strval(tmp);
            if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 ou above 611 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USO: /veiculo [carid] [color1] [color2]");
                return 1;
            }
            new color1;
            color1 = strval(tmp);
            if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 ou above 126 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USO: /veiculo [carid] [color1] [color2]");
                return 1;
            }
            new color2;
            color2 = strval(tmp);
            if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 ou above 126 !"); return 1; }
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid, X,Y,Z);
            new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2,60000);
            CreatedCars[CreatedCar] = carid;
            CreatedCar ++;
            format(string, sizeof(string), "   Veнculo spawnado de nъmero %d;", carid);
            SendClientMessage(playerid, COLOR_GREY, string);
          }
          else
          {
                SendClientMessage(playerid, COLOR_GRAD1, "   Autorizaзгo insuficiente !");
                return 1;
          }
        }
        return 1;
    }
Reply
#5

pawn Код:
//--------------- Topo---------------|
new carrocriado[50];
new totalCV;

CMD:c(playerid, params[])
{
    new carroid = strval(params);
    new Float:X,Float:Y,Float:Z,Float:Angle;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"[ERRO] Vocк nгo й um administrador!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "[ERRO] Uso: /C [Carro ID]");
    if(carroid >= 400 && carroid <= 611){
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,Angle);

        carrocriado[totalCV] = AddStaticVehicle(carroid, X, Y, Z, Angle, -1, -1);
        PutPlayerInVehicle(playerid,carrocriado[totalCV],0);
        if(GetPlayerInterior(playerid))
        LinkVehicleToInterior(carrocriado[totalCV],GetPlayerInterior(playerid));
        SetVehicleVirtualWorld(carrocriado[totalCV],GetPlayerVirtualWorld(playerid));
        new string[200];
        format(string, sizeof(string), "* Veнculo criado com sucesso [ID:%d]", carroid);
        SendClientMessage(playerid, -1, string);
        totalCV++;
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Stroon
Посмотреть сообщение
pawn Код:
//--------------- Topo---------------|
new carrocriado[50];
new totalCV;

CMD:c(playerid, params[])
{
    new carroid = strval(params);
    new Float:X,Float:Y,Float:Z,Float:Angle;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"[ERRO] Vocк nгo й um administrador!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "[ERRO] Uso: /C [Carro ID]");
    if(carroid >= 400 && carroid <= 611){
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,Angle);

        carrocriado[totalCV] = AddStaticVehicle(carroid, X, Y, Z, Angle, -1, -1);
        PutPlayerInVehicle(playerid,carrocriado[totalCV],0);
        if(GetPlayerInterior(playerid))
        LinkVehicleToInterior(carrocriado[totalCV],GetPlayerInterior(playerid));
        SetVehicleVirtualWorld(carrocriado[totalCV],GetPlayerVirtualWorld(playerid));
        new string[200];
        format(string, sizeof(string), "* Veнculo criado com sucesso [ID:%d]", carroid);
        SendClientMessage(playerid, -1, string);
        totalCV++;
    }
    return 1;
}
pawn Код:
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : warning 217: loose indentation
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : error 029: invalid expression, assumed zero
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : error 017: undefined symbol "cmd_c"
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : error 029: invalid expression, assumed zero
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\aprender.pwn(156) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
sobraram esses erros
Reply
#7

Identa o cуdigo, E coloque isso no topo do GM: #pragma tabsize 0;
Vocк colocou a include <zcmd> nй?


Abraзos!
Reply
#8

Quote:
Originally Posted by Stroon
Посмотреть сообщение
Identa o cуdigo, E coloque isso no topo do GM: #pragma tabsize 0;
Se identar, pra que o #pragma tabsize 0 ? rs
Reply
#9

Quote:
Originally Posted by DannielCooper
Посмотреть сообщение
Se identar, pra que o #pragma tabsize 0 ? rs
Pra dб uma garantida!
Reply
#10

Quote:
Originally Posted by Stroon
Посмотреть сообщение
pawn Код:
//--------------- Topo---------------|
new carrocriado[50];
new totalCV;

CMD:c(playerid, params[])
{
    new carroid = strval(params);
    new Float:X,Float:Y,Float:Z,Float:Angle;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"[ERRO] Vocк nгo й um administrador!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "[ERRO] Uso: /C [Carro ID]");
    if(carroid >= 400 && carroid <= 611){
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,Angle);

        carrocriado[totalCV] = AddStaticVehicle(carroid, X, Y, Z, Angle, -1, -1);
        PutPlayerInVehicle(playerid,carrocriado[totalCV],0);
        if(GetPlayerInterior(playerid))
        LinkVehicleToInterior(carrocriado[totalCV],GetPlayerInterior(playerid));
        SetVehicleVirtualWorld(carrocriado[totalCV],GetPlayerVirtualWorld(playerid));
        new string[200];
        format(string, sizeof(string), "* Veнculo criado com sucesso [ID:%d]", carroid);
        SendClientMessage(playerid, -1, string);
        totalCV++;
    }
    return 1;
}
pelo visto o erro futuro que da de bloqueio em todos os comandos se da porq todos os outros comandos do gamemode sao por /command e esse e por CMD:

eu tentei converter ele para /command ficou assim
pawn Код:
if (strcmp("/carro", cmdtext, true, 10) == 0)
{
    new carroid;
    new Float:X,Float:Y,Float:Z,Float:Angle;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"[ERRO] Vocк nгo й um administrador!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "[ERRO] Uso: /C [Carro ID]");
    if(carroid >= 400 && carroid <= 611){
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,Angle);

        carrocriado[totalCV] = AddStaticVehicle(carroid, X, Y, Z, Angle, -1, -1);
        PutPlayerInVehicle(playerid,carrocriado[totalCV],0);
        if(GetPlayerInterior(playerid))
        LinkVehicleToInterior(carrocriado[totalCV],GetPlayerInterior(playerid));
        SetVehicleVirtualWorld(carrocriado[totalCV],GetPlayerVirtualWorld(playerid));
        new string[200];
        format(string, sizeof(string), "* Veнculo criado com sucesso [ID:%d]", carroid);
        SendClientMessage(playerid, -1, string);
        totalCV++;
    }
    return 1;
}
porem a linha
pawn Код:
if(isnull(params)) return SendClientMessage(playerid, -1, "[ERRO] Uso: /C [Carro ID]");
nao sei o que fazer com ela e recebo esse erro
Код:
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\DeathDrift.pwn(419) : error 017: undefined symbol "params"
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\DeathDrift.pwn(419) : error 029: invalid expression, assumed zero
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\DeathDrift.pwn(419) : error 017: undefined symbol "params"
C:\Users\William\Desktop\samp03z_svr_R1_win32\gamemodes\DeathDrift.pwn(419) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)