21.06.2011, 20:56
Fazendo Veiculo atravйs do Nome / ID em Dialog
pawn Code:
new
VeiculoNomes[212][] =
{
"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",
"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",
"ZR3-50",
"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-A",
"Monster-B",
"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-B",
"Trailer-C",
"Andromada",
"Dodo",
"RC-CaLm",
"Launch",
"Police Car [LSPD]",
"Police Car [SFPD]",
"Police Car [LVPD]",
"Police Ranger",
"Picador",
"S.W.A.T",
"Alpha",
"Phoenix",
"Glendale",
"Sadler",
"Luggage Trailer",
"Luggage Trailer",
"Stair Trailer",
"Boxville",
"Farm Plow",
"Utility Trailer"
};
stock
CriarVeiculo( playerid, modelid )
{
new veiculo,Float:X,Float:Y,Float:Z,Float:X2,Float:Y2,Float:Z2,Float:Angulo;
if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
veiculo = GetPlayerVehicleID( playerid );
GetVehiclePos( veiculo, X, Y, Z );
GetVehicleZAngle( veiculo, Angulo );
GetVehicleVelocity(veiculo,X2,Y2,Z2);
DestroyVehicle( veiculo );
}
else
{
GetPlayerPos( playerid, X, Y, Z );
GetPlayerFacingAngle( playerid, Angulo );
}
vehicle = AddStaticVehicle( modelid, X, Y, ( Z + 1 ), Angulo,-1,-1);
LinkVehicleToInterior( veiculo, GetPlayerInterior( playerid ) );
SetVehicleVirtualWorld( veiculo, GetPlayerVirtualWorld( playerid ) );
PutPlayerInVehicle( playerid, veiculo, 0 );
return true;
}
IsNumeric(const stringf[])
{
for (new g = 0, kho = strlen(stringf); g < kho; g++)
{
if (stringf[g] > '9' || stringf[g] < '0') return 0;
}
return true;
}
GetVehicleModelIDFromName(Nome[])
{
for(new i = 0; i < 211; i++)
{
if ( strfind(VeiculoNomes[i], Nome, true) != -1 )
return i + 400;
}
return -true;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/veiculo", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 1007, DIALOG_STYLE_INPUT, "Nome do Carro","Por favor Digite o nome do veiculo que vocк deseja criar.","Ok","Cancelar");
return true;
}
return false;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1007)
{
new
id;
if(!IsNumeric(inputtext)) id = GetVehicleModelIDFromName(inputtext); else ida = strval(inputtext);
if(id < 400 || id > 603) return SendClientMessage(playerid ,-1,"Modelo/Nome Invalido");
CriarVeiculo(playerid, id);
}
return true;
}