[Pedido] Duvida e Pedido ._.
#1

galera hoje eu tava tentando adicionar um caixa de dialog nun veiculo

tipo assim eu tenho um codico aki q o cara entra no carro e faz /tunar certo abre uma caixa de dialog ele tuna o carro

queria fazer assim ao cara entra no veiculo altomaticamente essa caixa ja ia aparecer sem ele ter que fazer o comando

eu tentei fiz uma adapetaзao so que nao funcionou eu entro no veiculo e caixa de dialog nao aparace eu usei o
OnPlayerEnterVehicle

na minha opiniao talvez nao tenha como faz isso poq ate hoje nao vi nada parecido e essa calbek й chamada tabem ao player apertar enter perto do veiculo ou seja antes de ele entra no carro ja foi ativida essa calbek e para tunar o veiculo ele ja deveria estar la dentro seila so novato nisso nao conheзo todas calbk e nen as funзoes de todas to aki para aprender e nao so ficar pedindo coisa pronta e tal

queria saber si й possivel fazer isso, e como vou fazer ?? vou postar o codico de tunar o veiculo ai vcs dao uma olhada para adpater para quando o player entra no veiculo aparece o menu
( obs depoiis eu tou uma editada para deixar do jeito que eu quero )

valeu ai e descupa o portugues( eu sou analfabeto haha)

codico tunar

Код:
 em OnPlayerCommandText  
//=====================================
if(strcmp(cmdtext, "/tunar", true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)){
SendClientMessage(playerid,0xF50000FF,"[ERRO] Vocк nгo estб dentro de um veнculo!");
return 1;
}
else
{
ShowPlayerDialog(playerid, tunar, DIALOG_STYLE_LIST, "Tuning Menu", "Rodas\nCores\nPaintjobs\nNitro\nSuspensгo\nAutoTuning", "Selecionar", "Cancelar");
return 1;
}
}
//==========================================================================

em OnDialogResponse

//=====================================
if(dialogid == tunar) // Menu
{
if(response)
{
if(listitem == 0) // Rodas
{
ShowPlayerDialog(playerid, tunarroda, DIALOG_STYLE_LIST, "Rodas", "Roda 1 \nRoda 2 \nRoda 3 \nRoda 4 \nRoda 5 \nRoda 6 \nVoltar", "Instalar", "Cancelar");
}
if(listitem == 1) // Cores
{
ShowPlayerDialog(playerid, tunarcor, DIALOG_STYLE_LIST, "Cores", "Preto \nBranco \nAzul Escuro \nAzul Claro \nVerde \nVermelho \nAmarelo \nRosa \nVoltar", "Pintar", "Cancelar");
}
if(listitem == 2) // Paintjobs
{
ShowPlayerDialog(playerid, tunarpaint, DIALOG_STYLE_LIST, "Paintjobs", "Estilo 1 \nEstilo 2 \nEstilo 3 \nVoltar", "Pintar", "Cancelar");
}
if(listitem == 3) // Nitro
{
AddVehicleComponent(car,1010);
}
if(listitem == 4) // Suspensгo
{
AddVehicleComponent(car,1087);
}
if(listitem == 5) // AutoTuning
{
new idcarro;
idcarro = GetPlayerVehicleID(playerid);
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 562)
{
AddVehicleComponent(idcarro,1046);
AddVehicleComponent(idcarro,1171);
AddVehicleComponent(idcarro,1149);
AddVehicleComponent(idcarro,1035);
AddVehicleComponent(idcarro,1147);
AddVehicleComponent(idcarro,1036);
AddVehicleComponent(idcarro,1040);
ChangeVehiclePaintjob(idcarro, 2);
ChangeVehicleColor(idcarro, 6, 6);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 560)
{
AddVehicleComponent(idcarro,1028);
AddVehicleComponent(idcarro,1169);
AddVehicleComponent(idcarro,1141);
AddVehicleComponent(idcarro,1032);
AddVehicleComponent(idcarro,1138);
AddVehicleComponent(idcarro,1026);
AddVehicleComponent(idcarro,1027);
ChangeVehiclePaintjob(idcarro, 2);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 565)
{
AddVehicleComponent(idcarro,1046);
AddVehicleComponent(idcarro,1153);
AddVehicleComponent(idcarro,1150);
AddVehicleComponent(idcarro,1054);
AddVehicleComponent(idcarro,1049);
AddVehicleComponent(idcarro,1047);
AddVehicleComponent(idcarro,1051);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 2);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 559)
{
AddVehicleComponent(idcarro,1065);
AddVehicleComponent(idcarro,1160);
AddVehicleComponent(idcarro,1159);
AddVehicleComponent(idcarro,1067);
AddVehicleComponent(idcarro,1162);
AddVehicleComponent(idcarro,1069);
AddVehicleComponent(idcarro,1071);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 1);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 561)
{
AddVehicleComponent(idcarro,1064);
AddVehicleComponent(idcarro,1155);
AddVehicleComponent(idcarro,1154);
AddVehicleComponent(idcarro,1055);
AddVehicleComponent(idcarro,1158);
AddVehicleComponent(idcarro,1056);
AddVehicleComponent(idcarro,1062);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 2);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 558)
{
AddVehicleComponent(idcarro,1089);
AddVehicleComponent(idcarro,1166);
AddVehicleComponent(idcarro,1168);
AddVehicleComponent(idcarro,1088);
AddVehicleComponent(idcarro,1164);
AddVehicleComponent(idcarro,1090);
AddVehicleComponent(idcarro,1094);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 2);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 575)
{
AddVehicleComponent(idcarro,1044);
AddVehicleComponent(idcarro,1174);
AddVehicleComponent(idcarro,1176);
AddVehicleComponent(idcarro,1042);
AddVehicleComponent(idcarro,1099);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 0);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 534)
{
AddVehicleComponent(idcarro,1126);
AddVehicleComponent(idcarro,1179);
AddVehicleComponent(idcarro,1180);
AddVehicleComponent(idcarro,1122);
AddVehicleComponent(idcarro,1101);
AddVehicleComponent(idcarro,1125);
AddVehicleComponent(idcarro,1123);
AddVehicleComponent(idcarro,1100);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 2);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 536)
{
AddVehicleComponent(idcarro,1104);
AddVehicleComponent(idcarro,1182);
AddVehicleComponent(idcarro,1184);
AddVehicleComponent(idcarro,1108);
AddVehicleComponent(idcarro,1107);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 1);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 567)
{
AddVehicleComponent(idcarro,1129);
AddVehicleComponent(idcarro,1189);
AddVehicleComponent(idcarro,1187);
AddVehicleComponent(idcarro,1102);
AddVehicleComponent(idcarro,1133);
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
ChangeVehiclePaintjob(idcarro, 2);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
AddVehicleComponent(idcarro,1010);
AddVehicleComponent(idcarro,1087);
AddVehicleComponent(idcarro,1081);
AddVehicleComponent(idcarro,1139);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 400)
{
AddVehicleComponent(idcarro,1010);
AddVehicleComponent(idcarro,1087);
AddVehicleComponent(idcarro,1018);
AddVehicleComponent(idcarro,1013);
AddVehicleComponent(idcarro,1081);
AddVehicleComponent(idcarro,1086);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 401)
{
AddVehicleComponent(idcarro,1086);
AddVehicleComponent(idcarro,1139);
AddVehicleComponent(idcarro,1081);
AddVehicleComponent(idcarro,1010);
AddVehicleComponent(idcarro,1087);
AddVehicleComponent(idcarro,1012);
AddVehicleComponent(idcarro,1013);
AddVehicleComponent(idcarro,1042);
AddVehicleComponent(idcarro,1043);
AddVehicleComponent(idcarro,1018);
AddVehicleComponent(idcarro,1006);
AddVehicleComponent(idcarro,1007);
AddVehicleComponent(idcarro,1017);
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 576)
{
ChangeVehiclePaintjob(idcarro,2);
AddVehicleComponent(idcarro,1191);
AddVehicleComponent(idcarro,1193);
AddVehicleComponent(idcarro,1010);
AddVehicleComponent(idcarro,1018);
AddVehicleComponent(idcarro,1081);
AddVehicleComponent(idcarro,1087);
AddVehicleComponent(idcarro,1134);
AddVehicleComponent(idcarro,1137);
}
else
{
AddVehicleComponent(idcarro,nitro);

AddVehicleComponent(idcarro,suspensao);
}
}
}
return 1;
}
//============================================================================================================================================================================================================
if(dialogid == tunarroda) // Rodas
{
if(response)
{
if(listitem == 0) // Estilo 1
{
AddVehicleComponent(car,1084);
}
if(listitem == 1) // Estilo 2
{
AddVehicleComponent(car,1073);
}
if(listitem == 2) // Estilo 3
{
AddVehicleComponent(car,1075);
}
if(listitem == 3) // Estilo 4
{
AddVehicleComponent(car,1077);
}
if(listitem == 4) // Estilo 5
{
AddVehicleComponent(car,1079);
}
if(listitem == 5) // Estilo 6
{
AddVehicleComponent(car,1080);
}
if(listitem == 6) // Voltar
{
ShowPlayerDialog(playerid, tunar, DIALOG_STYLE_LIST, "Tuning Menu", "Rodas\nCores\nPaintjobs\nNitro\nSuspensгo\nAutoTuning", "Instalar", "Cancelar");
}
}
return 1;
}
//============================================================================================================================================================================================================
if(dialogid == tunarcor) // Cores
{
if(response)
{
if(listitem == 0) // Preto
{
ChangeVehicleColor(car,0,0);
}
if(listitem == 1) // Branco
{
ChangeVehicleColor(car,1,1);
}
if(listitem == 2) // Azul Escuro
{
ChangeVehicleColor(car,425,425);
}
if(listitem == 3) // Azul Claro
{
ChangeVehicleColor(car,2,2);
}
if(listitem == 4) // Verde
{
ChangeVehicleColor(car,16,16);
}
if(listitem == 5) // Vermelho
{
ChangeVehicleColor(car,3,3);
}
if(listitem == 6) // Amarelo
{
ChangeVehicleColor(car,6,6);
}
if(listitem == 7) // Rosa
{
ChangeVehicleColor(car,146,146);
}
if(listitem == 8) // Voltar
{
ShowPlayerDialog(playerid, tunar, DIALOG_STYLE_LIST, "Tuning Menu", "Rodas\nCores\nPaintjobs\nNitro\nSuspensгo\nAutoTuning", "Pintar", "Cancelar");
}
}
return 1;
}
//============================================================================================================================================================================================================

if(dialogid == tunarpaint) // Paintjobs
{
if(response)
{
if(listitem == 0) // Estilo 1
{
ChangeVehiclePaintjob(car,0);
}
if(listitem == 1) // Estilo 2
{
ChangeVehiclePaintjob(car,1);
}
if(listitem == 2) // Estilo 3
{
ChangeVehiclePaintjob(car,2);
}
if(listitem == 4) // Voltar
{
ShowPlayerDialog(playerid, tunar, DIALOG_STYLE_LIST, "Tuning Menu", "Rodas\nCores\nPaintjobs\nNitro\nSuspensгo\nAutoTuning", "Pintar", "Cancelar");
}
}

return 1;
}
Reply
#2

PHP код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)//verifica se o player estб dentro do veнculo. 
    
{    
        
ShowPlayerDialog(playeridtunarDIALOG_STYLE_LIST"Tuning Menu""Rodas\nCores\nPaintjobs\nNitro\nSuspensгo\nAutoTuning""Selecionar""Cancelar");        
    }    
    return 
1;    

Reply
#3

pow valeu irmao explica tabem si nao for incomodo para que que serve essa puplic

public OnPlayerStateChange(playerid,newstate,oldstate)

ele й excutada ao todo momento tipo desde que o player entra no servidor ate ele sai ela й excutada ?
Reply
#4

Estuda isso: https://sampwiki.blast.hk/wiki/OnPlayerStateChange , https://sampwiki.blast.hk/wiki/Playerstates
Reply
#5

"eu sou analfabeto HAHA"

Reply
#6

valeu + reep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)