21.11.2011, 12:30
Phaarell
Valeu irmгo, funciono!
Cara sу to com um problema:
Tenho outro comando para criar carros "/cs" o player digita, abre um dialog com todos os
veнculos do samp por categoria para spawnar.
Tentei fazer o "Attach3DTextLabelToVehicle" nele. Deu certo, porйm nгo ta deletando o Nome do Player ao Estar dentro do veнculo criado pelo /cs
e apуs sair do veiculo e criar novamente "/carro" o "Nome do Player" tambйm nгo desapareзe.
Intendeu? rs
Vo postar como Fiz:
Bom й isso ai Pharel, grande ajuda que vc me deu. +REPP! Muito Grato
Valeu irmгo, funciono!
Cara sу to com um problema:
Tenho outro comando para criar carros "/cs" o player digita, abre um dialog com todos os
veнculos do samp por categoria para spawnar.
Tentei fazer o "Attach3DTextLabelToVehicle" nele. Deu certo, porйm nгo ta deletando o Nome do Player ao Estar dentro do veнculo criado pelo /cs
e apуs sair do veiculo e criar novamente "/carro" o "Nome do Player" tambйm nгo desapareзe.
Intendeu? rs
Vo postar como Fiz:
PHP код:
#include <a_samp>
new VeiculoID[MAX_PLAYERS];
new VeiculoC[MAX_PLAYERS];
new Text3D:DonoVeiculo[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256],idx, tmp[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmdtext,"/c", true) == 0 || strcmp(cmdtext,"/carro", true) == 0)
{
if(GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COR_VERMELHO,"[ERRO]: Vocк nгo Pode Criar Veнculos em Interiores");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COR_VERMELHO,"[ERRO]: Vocк Jб Possui um Veнculo.");
new string[128];
new Float: X, Float: Y, Float: Z, Float: Angle;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
VeiculoID[playerid] = GetPlayerVehicleID(playerid);
DestroyVehicle(VeiculoID[playerid]);
DestroyVehicle(VeiculoC[playerid]); // й do "/CS"
DestroyVehicle(GetPVarInt(playerid,"Veiculo"));
PutPlayerInVehicle(playerid,CreateVehicle(411,X,Y, Z+2,Angle,-1,-1,-1),0);
new car = GetPlayerVehicleID(playerid);
AddVehicleComponent(car,1079);
SetPVarInt(playerid,"Veiculo",GetPlayerVehicleID(playerid));
format(string,sizeof(string),"Veiculo De:\n%s[ID:%d]", PlayerName(playerid), playerid);
DonoVeiculo[playerid] = Create3DTextLabel(string,0xFF8000FF,0,0,0,40.0,1);
Attach3DTextLabelToVehicle(DonoVeiculo[playerid], car, 0.0, 0.0, 1.0);
return 1;
}
if(strcmp(cmdtext, "/cs", true) == 0)
{
new allvehicles[] = "1\tAviхes\n2\tHelicopteros\n3\tMotos\n4\tConversiveis\n5\tIndustriais\n6\tLowriders\n7\tOffRoad\n8\tServiзos Publicos\n9\tSaloons\n10\tEsportivos\n11\tPeruas\n12\tBarcos\n13\tVeiculos Unicos\n14\tVeiculos RC\n15\tTrailers";
ShowPlayerDialog(playerid,3057,DIALOG_STYLE_LIST," Veiculos:",allvehicles,"Selecionar","Cancelar");
return 1;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 3057) // [CS]
{
if(response)
{
if(listitem == 0)
{
new allvehicles[] = "1\tAndromada\n2\tAT-400\n3\tBeagle\n4\tCropduster\n5\tDodo\n6\tHydra\n7\tNevada\n8\tRustler\n9\tShamal\n10\tSkimmer\n11\tStunt Plane";
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"Aviхes:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 1)
{
new allvehicles[] = "1\tCargobob\n2\tHunter\n3\tLeviathan\n4\tMaverick\n5\tNews Maverick\n6\tPolice Maverick\n7\tRaindance\n8\tSeasparrow\n9\tSparrow";
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Helicopteros:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 2)
{
new allvehicles[] = "1\tBF-400\n2\tBike\n3\tBMX\n4\tFaggio\n5\tFCR-900\n6\tFreeway\n7\tMountain Bike\n8\tNRG-500\n9\tPCJ-600\n10\tPizzaBoy\n11\tQuad\n12\tSanchez\n13\tWayfarer";
ShowPlayerDialog(playerid,5,DIALOG_STYLE_LIST,"Motos:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 3)
{
new allvehicles[] = "1\tComet\n2\tFeltzer\n3\tStallion\n4\tWindsor";
ShowPlayerDialog(playerid,6,DIALOG_STYLE_LIST,"Convertibles:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 4)
{
new allvehicles[] = "1\tBenson\n2\tBobcat\n3\tBurrito\n4\tBoxville\n5\tBoxburg\n6\tCement Truck\n7\tDFT-300\n8\tFlatbed\n9\tLinerunner\n10\tMule\n11\tNews Van\n12\tPacker\n13\tPetrol Tanker\n14\tPicador\n15\tPony\n16\tRoad Train\n17\tRumpo\n18\tSadler\n19\tSadler Shit( Ghost Car )\n20\tTopfun\n21\tTractor\n22\tTrashmaster\n23\tUitlity Van\n24\tWalton\n25\tYankee\n26\tYosemite";
ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Industrial Vehicles:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 5)
{
new allvehicles[] = "1\tBlade\n2\tBroadway\n3\tRemington\n4\tSavanna\n5\tSlamvan\n6\tTahoma\n7\tTornado\n8\tVoodoo";
ShowPlayerDialog(playerid,8,DIALOG_STYLE_LIST,"Lowriders:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 6)
{
new allvehicles[] = "1\tBandito\n2\tBF Injection\n3\tDune\n4\tHuntley\n5\tLandstalker\n6\tMesa\n7\tMonster Truck\n8\tMonster Truck 'A'\n9\tMonster Truck 'B'\n10\tPatriot\n11\tRancher 'A'\n12\tRancher 'B'\n13\tSandking";
ShowPlayerDialog(playerid,9,DIALOG_STYLE_LIST,"Off Road Vehicles:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 7)
{
new allvehicles[] = "1\tAmbulance\n2\tBarracks\n3\tBus\n4\tCabbie\n5\tCoach\n6\tHPV-1000 ( Cop Bike )\n7\tEnforcer\n8\tF.B.I Rancher\n9\tF.B.I Truck\n10\tFiretruck\n11\tFireTruck LA\n12\tPolice Car ( LSPD )\n13\tPolice Car ( LVPD )\n14\tPolice Car ( SFPD )\n15\tRanger\n16\tS.W.A.T\n17\tTaxi\n18\tRhino";
ShowPlayerDialog(playerid,10,DIALOG_STYLE_LIST,"Public Service Vehicles:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 8)
{
new allvehicles[] = "1\tAdmiral\n2\tBloodring Banger\n3\tBravura\n4\tBuccaneer\n5\tCadrona\n6\tClover\n7\tElegant\n8\tElegy\n9\tEmperor\n10\tEsperanto\n11\tFortune\n12\tGlendale Shit ( Ghost Car )\n13\tGlendale\n14\tGreenwood\n15\tHermes\n16\tIntruder\n17\tMajestic\n18\tMananal\n19\tMerit\n20\tNebula\n21\tOceanic\n22\tPremier\n23\tPrevion\n24\tPrimo\n25\tSentinel\n26\tStafford\n27\tSultan \n28\tSunrise\n29\tTampa\n30\tVicent\n31\tVirgo\n32\tWillard\n33\tWashington";
ShowPlayerDialog(playerid,11,DIALOG_STYLE_LIST,"Saloons:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 9)
{
new allvehicles[] = "1\tAlpha\n2\tBanshee\n3\tBlista Compact\n4\tBuffalo\n5\tBullet\n6\tCheetah\n7\tClub\n8\tEuros\n9\tFlash\n10\tHotring Racer 'A'\n11\tHotring Racer 'B'\n12\tHotring Racer 'C'\n13\tInfernus\n14\tJester\n15\tPhoenix\n16\tSabre\n17\tSuper GT\n18\tTurismo\n19\tUranus\n20\tZR-350";
ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Sport:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 10)
{
new allvehicles[] = "1\tMoonbeam\n2\tPerenniel\n3\tRegina\n4\tSolair\n5\tStratum";
ShowPlayerDialog(playerid,13,DIALOG_STYLE_LIST,"Peruas:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 11)
{
new allvehicles[] = "1\tCoastguard\n2\tDinghy\n3\tJetmax\n4\tLaunch\n5\tMarquis\n6\tPredator\n7\tReefer\n8\tSpeeder\n9\tSquallo\n10\tTropic";
ShowPlayerDialog(playerid,14,DIALOG_STYLE_LIST,"Botes:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 12)
{
new allvehicles[] = "1\tBaggage\n2\tCaddy\n3\tCamper 'A'\n4\tCamper 'B'\n5\tCobine Harvester\n6\tDozer\n7\tDumper\n8\tForklift\n9\tHotknife\n10\tHustler\n11\tHotdog\n12\tKart\n13\tMower\n14\tMr. Whoopee\n15\tRomero\n16\tSecuricar\n17\tStretch\n18\tSweeper\n19\tTowtruck\n20\tTug\n21\tVortex";
ShowPlayerDialog(playerid,15,DIALOG_STYLE_LIST,"Unicos:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 13)
{
new allvehicles[] = "1\tRC Bandit\n2\tRC Baron\n3\tRC Raider'\n4\tRC Goblin'\n5\tRC Tiger\n6\tRC Cam";
ShowPlayerDialog(playerid,16,DIALOG_STYLE_LIST,"RC:",allvehicles,"Selecionar","Voltar");
}
else if(listitem == 14)
{
new allvehicles[] = "1\tArticle Trailer\n2\tArticle Trailer 2\n3\tArticle Trailer 3'\n4\tBaggage Trailer 'A''\n5\tBaggage Trailer 'B'\n6\tFarm Trailer\n7\tFreight Frat Trailer(Train)\n8\tFreight Box Trailer(Train)\n9\tPetrol Trailer\n10\tStreak Trailer(Train)\n11\tStairs Trailer\n12\tUitlity Trailer";
ShowPlayerDialog(playerid,17,DIALOG_STYLE_LIST,"Trailers Vehicles:",allvehicles,"Selecionar","Voltar");
}
}
}
else if(dialogid == 3)
{
if(response)
{
if(listitem == 0)
{
DestroyVehicle(VeiculoC[playerid]);
DestroyVehicle(VeiculoID[playerid]);
DestroyVehicle(GetPVarInt(playerid,"Veiculo"));
PutPlayerInVehicle(playerid,CreateVehicle(592,X,Y,Z,0,-1,-1,-1),0); new str[60]; format(str,sizeof(str),"Vocк spawnou um %s",GetVehicleName(GetPlayerVehicleID(playerid))); SendClientMessage(playerid,COR_AMARELO,str);
VeiculoC[playerid] = GetPlayerVehicleID(playerid);
new string[128];
new car = GetPlayerVehicleID(playerid);
format(string,sizeof(string),"Veiculo De:\n%s[ID:%d]", PlayerName(playerid), playerid);
DonoVeiculo[playerid] = Create3DTextLabel(string,0xFF8000FF,0,0,0,40.0,1);
Attach3DTextLabelToVehicle(DonoVeiculo[playerid], car, 0.0, 0.0, 1.0);
}
else if(listitem == 1)
{
DestroyVehicle(VeiculoC[playerid]);
PutPlayerInVehicle(playerid,CreateVehicle(577,X,Y,Z,0,-1,-1,-1),0); new str[60]; format(str,sizeof(str),"Vocк spawnou um %s",GetVehicleName(GetPlayerVehicleID(playerid))); SendClientMessage(playerid,COR_AMARELO,str);
VeiculoC[playerid] = GetPlayerVehicleID(playerid);
}
CONTINUA......
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new str[50];
if (newstate == 2 || newstate == 3)
{
format(str, sizeof(str), "~g~%s",Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
GameTextForPlayer(playerid, str, 1000, 1);
if(Nitro(GetPlayerVehicleID(playerid))) //[sistema de nitro]
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
if(strcmp(VeiculoID[GetPlayerVehicleID(playerid)], PlayerName(playerid), true) == 0)
if(strcmp(VeiculoC[GetPlayerVehicleID(playerid)], PlayerName(playerid), true) == 0) // ESTE EU ADD
Update3DTextLabelText(DonoVeiculo[playerid], 0xFF8000FF, " ");
}
if(oldstate == PLAYER_STATE_DRIVER)
{
if(strcmp(VeiculoID[GetPlayerVehicleID(playerid)], PlayerName(playerid), true) == 0)
{
new string[50];
format(string, sizeof(string), "Veiculo De:\n%s[ID:%d]", PlayerName(playerid), playerid);
Update3DTextLabelText(DonoVeiculo[playerid], 0xFF8000FF, string);
}
if(strcmp(VeiculoC[GetPlayerVehicleID(playerid)], PlayerName(playerid), true) == 0) // ESTE EU ADD
{
new string[50];
format(string, sizeof(string), "Veiculo De:\n%s[ID:%d]", PlayerName(playerid), playerid);
Update3DTextLabelText(DonoVeiculo[playerid], 0xFF8000FF, string);
}
}
new DataFile[256]; // SISTEMA DO GODCAR
format(DataFile,sizeof(DataFile),"gc/%s.ini",PlayerName(playerid));
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsABike(GetPlayerVehicleID(playerid)) && (Capacete[playerid] = true))
{
SendClientMessage(playerid,COR_LARANJA,"INFO: Digite /CAP para desativar o capacete");
}
else
{
SendClientMessage(playerid,COR_LARANJA,"INFO: Digite /CAP para ativar o capacete");
}
if(fexist(DataFile))
{
GC_Mode[playerid] = SetTimerEx("GodCar",1000,true,"i",playerid);
SendClientMessage(playerid,COR_LARANJA,"INFO: Digite /GC e deixe seu veнculo vulnerбvel");
}
else if(!fexist(DataFile))
{
SendClientMessage(playerid,COR_LARANJA,"INFO: Digite /GC e deixe seu veнculo invulnerбvel");
}
}
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
KillTimer(GC_Mode[playerid]);
}
return 1;
}