SA-MP Forums Archive
[Pedido] Nao aparece!!!! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Nao aparece!!!! (/showthread.php?tid=375856)



[RESOLVIDO] Nao aparece!!!! - Aleex_Mason - 08.09.2012

Nao consigo colocar para aparecer a mensagem automaticamente, quando o Tanker se conecta ao trailer

Segue abaixo o codigo!

Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
	{
	if(GetVehicleModel(GetVehicleTrailer(vehicleid)) == 584)
		{
		new string[256];
	---->> ( Estб mensagem, nao aparece automaticamente, quando eu ligo o tanker ao trailer) format(string, sizeof(string), "{#32EDFF}| INFO | Seu Caminhao estб carregado, leve-o atй um posto para descarregar!.(/pdescarregar)");
		SendClientMessageToAll(outraadm, string);
		SendClientMessage(playerid, Vermelho, "Engatou.");	
		}
}
Agradeзo desde Jб!


Re: Nao aparece!!!! - telmo_ferreira - 08.09.2012

new string[128];
nunca uses mais que 128 numa mensagem que vai para o chat й desperdicio de cells
estas a meter esse cуdigo em que public ?


Re: Nao aparece!!!! - Aleex_Mason - 08.09.2012

Quote:
Originally Posted by telmo_ferreira
Посмотреть сообщение
new string[128];
nunca uses mais que 128 numa mensagem que vai para o chat й desperdicio de cells
estas a meter esse cуdigo em que public ?
Vlw, agr sу vou usar "128", manim, estб na "OnPlayerEnterVehicle"!!


Re: Nao aparece!!!! - hard_dalzot - 08.09.2012

coloca em um timer para que ele cheque se estб engatada ou nгo
pawn Код:
//No ongamemode poe isso
SetTimer("ChecarTrailer", 1000, true);

//Em algum lugar do seu gm poe isso
forward ChecarTrailer();
public ChecarTrailer()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        new vehicleid = GetPlayerVehicleID(i);
        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(i)))
        {
            if(GetVehicleModel(GetVehicleTrailer(vehicleid)) == 584)
            {
                new string[128];
                format(string, sizeof(string), "{#32EDFF}| INFO | Seu Caminhao estб carregado, leve-o atй um posto para descarregar!.(/pdescarregar)");
                SendClientMessage(i, string);
            }
        }
    }
    return 1;
}
tenta ai e se nгo der certo me avisa


Re: Nao aparece!!!! - telmo_ferreira - 08.09.2012

com isso que que ai tens apenas aparece a mensagem se ao entres no veiculo ele ja tiver o trailer connectado ao tanker


Re: Nao aparece!!!! - hard_dalzot - 08.09.2012

nгo entendi o que quiz dizer telmo


Re: Nao aparece!!!! - Aleex_Mason - 08.09.2012

Quote:
Originally Posted by hard_dalzot
Посмотреть сообщение
coloca em um timer para que ele cheque se estб engatada ou nгo
pawn Код:
//No ongamemode poe isso
SetTimer("ChecarTrailer", 1000, true);

//Em algum lugar do seu gm poe isso
forward ChecarTrailer();
public ChecarTrailer()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        new vehicleid = GetPlayerVehicleID(i);
        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(i)))
        {
            if(GetVehicleModel(GetVehicleTrailer(vehicleid)) == 584)
            {
                new string[128];
                format(string, sizeof(string), "{#32EDFF}| INFO | Seu Caminhao estб carregado, leve-o atй um posto para descarregar!.(/pdescarregar)");
                SendClientMessage(i, string);
            }
        }
    }
    return 1;
}
tenta ai e se nгo der certo me avisa
Manim, deu certo agora й o seguinte , ele fica repetindo a frase direto, ai se eu coloque SetTimer("ChecarTrailer", 1000, false); , ele nao mostra a msg!


Re: Nao aparece!!!! - hard_dalzot - 08.09.2012

ta bom espera que eu vo arrumar amigo rapidгo eu esqueci de uma parte para ele parar de mandar a msg quando ingatar jaja posto o novo script


Re: Nao aparece!!!! - hard_dalzot - 08.09.2012

pawn Код:
new engatado[MAX_PLAYERS] = 0;
new timertrailer;

//No ongamemode poe isso
timertrailer = SetTimer("ChecarTrailer", 1000, true);

//Em algum lugar do seu gm poe isso
forward ChecarTrailer();
public ChecarTrailer()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(engatado[i] == 1)
        {
            KillTimer(timertrailer);
        }
        new vehicleid = GetPlayerVehicleID(i);
        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(i)))
        {
            if(GetVehicleModel(GetVehicleTrailer(vehicleid)) == 584)
            {
                SendClientMessage(i, "{#32EDFF}| INFO | Seu Caminhao estб carregado, leve-o atй um posto para descarregar!.(/pdescarregar)");
                engatado[i] = 1;
            }
        }
    }
    return 1;
}
tenta agora

@Edit.
Desculpa pelo double post '-' esqueci de editar a msg anterior


Re: Nao aparece!!!! - Aleex_Mason - 08.09.2012

Quote:
Originally Posted by hard_dalzot
Посмотреть сообщение
pawn Код:
new engatado[MAX_PLAYERS] = 0;
new timertrailer;

//No ongamemode poe isso
timertrailer = SetTimer("ChecarTrailer", 1000, true);

//Em algum lugar do seu gm poe isso
forward ChecarTrailer();
public ChecarTrailer()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(engatado[i] == 1)
        {
            KillTimer(timertrailer);
        }
        new vehicleid = GetPlayerVehicleID(i);
        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(i)))
        {
            if(GetVehicleModel(GetVehicleTrailer(vehicleid)) == 584)
            {
                SendClientMessage(i, "{#32EDFF}| INFO | Seu Caminhao estб carregado, leve-o atй um posto para descarregar!.(/pdescarregar)");
                engatado[i] = 1;
            }
        }
    }
    return 1;
}
tenta agora

@Edit.
Desculpa pelo double post '-' esqueci de editar a msg anterior
Manim, muitнssimo obrigado.. Vlw! ..
Se precisar estou aqui!