08.03.2014, 01:19
Galera,baixei um GM TDM base,e queria criar o comando /vn para criar o carro pelo nome dele,e queria que ficasse o nome do dono do carro em cima do teto,podem me ajudar?
//Topo do GM
new Text3D:vehicle3Dtext[MAX_VEHICLES],vehicle_id;
//OnPlayerCommandText
CMD:vn(playerid)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " /vn [ID do Veiculo]");
return 1;
}
new type, string[128],sendername[28];
type = strval(tmp);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
vehicle_id = CreateVehicle(type, X, Y, Z, 0, 1, 1, -1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string,sizeof(string),"[Dono do veiculo: %s ]",sendername);
vehicle3Dtext[vehicle_id] = Create3DTextLabel( string, 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( vehicle3Dtext[ vehicle_id ] , vehicle_id, 0.0, 0.0, 2.0);
}
//No Topo do GM:
new NomeVeiculos[212][17] =
{
"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 Cam", "Launch", "Police Car", "Police Car",
"Police Car", "Police Ranger", "Picador", "S.W.A.T.", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer", "Luggage Trailer",
"Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer"
};
//E, no OnPlayerCommandText:
if(!strfind(cmdtext, "/vn", true))
{
if(cmdtext[3] == '\0' || cmdtext[3] == ' ')
{
if(cmdtext[3] != ' ' || cmdtext[4] == '\0') return SendClientMessage(playerid, 0xFFFFFFFF, "Digite: /vn [nome do veнculo]");
for(new x = 4; cmdtext[x] != EOS; x++)
{
if(cmdtext[x] != ' ')
{
new Param[17];
strcat(Param, cmdtext[x]);
for(new y = 0; y < 212; y++)
{
if(!strcmp(Param, NomeVeiculos[y], true))
{
new Float:Posicao[3];
new Float:Angulo;
GetPlayerPos(playerid, Posicao[0], Posicao[1], Posicao[2]);
GetPlayerFacingAngle(playerid, Angulo);
Angulo += 90.0;
Posicao[0] += 5.0 * floatcos(Angulo, degrees);
Posicao[1] += 5.0 * floatsin(Angulo, degrees);
new VeiculoID = CreateVehicle(y + 400, Posicao[0], Posicao[1], Posicao[2], 0.0, 2, 2, -1);
new NickName[25];
new STR[35];
GetPlayerName(playerid, NickName, 25);
format(STR, 35, "Dono: %s", NickName);
new Text3D:VeiculoTexto = Create3DTextLabel(STR, 0x33CCFFFF, 0.0, 0.0, 0.0, 10.0, 0, 0);
Attach3DTextLabelToVehicle(VeiculoTexto, VeiculoID, 0.0, 0.0, 1.0);
SendClientMessage(playerid, 0x00FF00FF, "Veнculo criado com sucesso !");
return true;
}
}
SendClientMessage(playerid, 0xFF0000FF, "Nome de veнculo invбlido !");
return true;
}
}
SendClientMessage(playerid, 0xFFFFFFFF, "Digite: /vn [nome do veнculo]");
return true;
}
}
Isto deve resolver o seu problema .
Coloque : pawn Code:
Espero ter ajudado . |