[Pedido] Nao aparece!!!!
#1

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б!
Reply
#2

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 ?
Reply
#3

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"!!
Reply
#4

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
Reply
#5

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

nгo entendi o que quiz dizer telmo
Reply
#7

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!
Reply
#8

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
Reply
#9

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
Reply
#10

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)