[Pedido] Comando /CV Veiculos
#1

Olб, Pessoas, serб meu ultimo tуpico de pedido e ajuda, jб que estou criando muitos tуpicos.. enfim, hoje eu quero um comando chamado /cv ou /Veh, que й tipo: a pessoa digita /cv [ID DO CARRO] [COR1] [COR2], e cria o carro que ela deseja, jб usei search, e nгo achei jб pedi ajuda pra procurar pra 2 negos, claro se vocкs quiserem me ajudar, pf jб estou atras desse comando faz 2 dias..

Serei Grato, para quem me ajudar, darei um +REP, e irб para os creditos do meu servidor.
Reply
#2

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;
}
Reply
#3

pawn Код:
if(strcmp(cmd, "/veh", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        if (PlayerInfo[playerid][pAdmin] >= 1337)
        {
            if(CreatedCar >= 200)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Jб criaram muitos carros, destrua alguns primeiro /destruirid");
                return true;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /veh [IDCARRO] [COR1] [COR2]");
                return true;
            }
            new car;
            car = strval(tmp);
            if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, "   Modelo Do Carro Tem Que Ser Entre 411 e 600 !"); return true; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /veh [IDCARRO] [COR1] [COR2]");
                return true;
            }
            new COLOR1;
            COLOR1 = strval(tmp);
            if(COLOR1 < 0 || COLOR1 > 236) { SendClientMessage(playerid, COLOR_GREY, "   Nъmero Da Cor tem que ser entre 0 e 126 !"); return true; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /veh [IDCARRO] [COR1] [COR2]");
                return true;
            }
            new COLOR2;
            COLOR2 = strval(tmp);
            if(COLOR2 < 0 || COLOR2 > 236) { SendClientMessage(playerid, COLOR_GREY, "   Nъmero Da Cor tem que ser entre 0 e 126 !"); return true; }
            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), "   Veiculo %d Criado.", carid);
            SendClientMessage(playerid, COLOR_GREY, string);
        }
        }
        return true;
    }
Reply
#4

WTAFUQ? Mteck, seu safado! falou que nгo sabia nada de pwn, e quando vejo....
EU QUE NГO SEI NADA DE PAWN!


DASHDUSAHDAUSHDSA =d
thanks, vou ver se pega.
Reply
#5

Quote:
Originally Posted by Diksplay
Посмотреть сообщение
WTAFUQ? Mteck, seu safado! falou que nгo sabia nada de pwn, e quando vejo....
EU QUE NГO SEI NADA DE PAWN!


DASHDUSAHDAUSHDSA =d
thanks, vou ver se pega.
kodskpaopdas isso e verdade

pawn Код:
if(strcmp(cmd, "/cv", true) == 0) {
new tmp[256];
new plid;
new cor1,cor2;
new veiculo;
new Float:X,Float:Y,Float:Z,Float:Angle;
tmp = strtok(cmdtext, idx);
cor1 = strval(tmp);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "| ERRO | Digite: /cv [id]");
return 1;
}
if(IsPlayerConnected(playerid)){
if(plid >= 400 && plid <= 611){
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
new carro = CreateVehicle(plid, X, Y, Z, Angle, -1, -1, 120000);
PutPlayerInVehicle(playerid,carro,0);
if(GetPlayerInterior(playerid))
veiculo = GetPlayerVehicleID(playerid);
LinkVehicleToInterior(carro,GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carro,GetPlayerVirtualWorld(playerid));
ChangeVehicleColor(veiculo,cor1,cor2);
format(string, sizeof(string), "| Carro-Car | Vocк criou o veнculo de 'ID %d , Cor1 %d , Cor2 %d.", plid,cor1,cor2);
SendClientMessage(playerid, outraadm, string);
return 1;
}else{
SendClientMessage(playerid, Vermelho, "| ERRO | ID invбlido || ID's = 400-611");
return 1;
}
}
}
Reply
#6

@EDIT
Quote:
Originally Posted by Standby
Посмотреть сообщение
kodskpaopdas isso e verdade

pawn Код:
if(strcmp(cmd, "/cv", true) == 0) {
new tmp[256];
new plid;
new cor1,cor2;
new veiculo;
new Float:X,Float:Y,Float:Z,Float:Angle;
tmp = strtok(cmdtext, idx);
cor1 = strval(tmp);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "| ERRO | Digite: /cv [id]");
return 1;
}
if(IsPlayerConnected(playerid)){
if(plid >= 400 && plid <= 611){
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
new carro = CreateVehicle(plid, X, Y, Z, Angle, -1, -1, 120000);
PutPlayerInVehicle(playerid,carro,0);
if(GetPlayerInterior(playerid))
veiculo = GetPlayerVehicleID(playerid);
LinkVehicleToInterior(carro,GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carro,GetPlayerVirtualWorld(playerid));
ChangeVehicleColor(veiculo,cor1,cor2);
format(string, sizeof(string), "| Carro-Car | Vocк criou o veнculo de 'ID %d , Cor1 %d , Cor2 %d.", plid,cor1,cor2);
SendClientMessage(playerid, outraadm, string);
return 1;
}else{
SendClientMessage(playerid, Vermelho, "| ERRO | ID invбlido || ID's = 400-611");
return 1;
}
}
}
erro:
Код:
Server\gamemodes\gmofficial.pwn(568) : error 017: undefined symbol "cmd"
Server\gamemodes\gmofficial.pwn(574) : error 017: undefined symbol "strtok"
Server\gamemodes\gmofficial.pwn(574) : error 033: array must be indexed (variable "tmp")
Server\gamemodes\gmofficial.pwn(591) : error 017: undefined symbol "string"
Server\gamemodes\gmofficial.pwn(591) : error 017: undefined symbol "string"
Server\gamemodes\gmofficial.pwn(591) : error 029: invalid expression, assumed zero
Server\gamemodes\gmofficial.pwn(591) : fatal error 107: too many error messages on one line
Reply
#7

Vocк tem isso aqui no inicio da:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
pawn Код:
new cmd[256];
cmd = strtok(cmdtext, idx);
Reply
#8

Quote:
Originally Posted by Standby
Посмотреть сообщение
kodskpaopdas isso e verdade

pawn Код:
if(strcmp(cmd, "/cv", true) == 0) {
new tmp[256];
new plid;
new cor1,cor2;
new veiculo;
new Float:X,Float:Y,Float:Z,Float:Angle;
tmp = strtok(cmdtext, idx);
cor1 = strval(tmp);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "| ERRO | Digite: /cv [id]");
return 1;
}
if(IsPlayerConnected(playerid)){
if(plid >= 400 && plid <= 611){
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
new carro = CreateVehicle(plid, X, Y, Z, Angle, -1, -1, 120000);
PutPlayerInVehicle(playerid,carro,0);
if(GetPlayerInterior(playerid))
veiculo = GetPlayerVehicleID(playerid);
LinkVehicleToInterior(carro,GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carro,GetPlayerVirtualWorld(playerid));
ChangeVehicleColor(veiculo,cor1,cor2);
format(string, sizeof(string), "| Carro-Car | Vocк criou o veнculo de 'ID %d , Cor1 %d , Cor2 %d.", plid,cor1,cor2);
SendClientMessage(playerid, outraadm, string);
return 1;
}else{
SendClientMessage(playerid, Vermelho, "| ERRO | ID invбlido || ID's = 400-611");
return 1;
}
}
}
Linda identaзгo.
Reply
#9

HELP!!
Reply
#10

http://pastebin.com/bfMMApAy

Nгo quero reputaзгo nem crйditos.

@ATENЗГO
Vocк deve ter SSCANF e ZCMD instalados no seu gamemode.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)