SA-MP Forums Archive
[Ajuda] Portao - 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: [Ajuda] Portao (/showthread.php?tid=361644)



Portao - .:LucasxD:. - 21.07.2012

Bem vou direto ao assunto eu fiz um portгo automбtico sem comando de primeira ele abria normal depois pus mais 2 portхes em 1 comando e der repente nгo abriu mas ai estou pedindo ajuda de vocкs pra ver se tem alguma coisa de errada no code que possa me ajudar!

Variбveis e Forward's :

pawn Код:
new portaocop;
new parkinggate;//Variavel
new parkinggate2;//variavel
forward portaoandando();
forward ChecarPortao();
OnFilterScriptInit() :

pawn Код:
portaocop = CreateObject(980,898.50000000,-2262.30004883,14.80000019,0.00000000,0.00000000,279.99206543);
parkinggate = CreateObject(980,866.59997559,-2258.80004883,15.00000000,0.00000000,0.00000000,10.00000000); //object(airportgate) (2)
parkinggate2 = CreateObject(980,855.09997559,-2189.89990234,15.60000038,0.00000000,0.00000000,8.00000000); //object(airportgate) (3)
Portгo sem Comando :

pawn Код:
public ChecarPortao()
{
    new P1; //Novos news para abrir e fechar os portхes
    for(new playerid;playerid<MAX_PLAYERS;playerid++)//Loop
    {
    if(IsPlayerInRangeOfPoint(playerid,10.0,1,2,3)) P1=1; //Aqui a coordenada do 1° portгo fechado.
    }
    if(P1)MoveObject(portaocop,896.59997559,-2250.89990234,14.80000019, 1.5); //Aqui se estiver alguem perto do portгo e for do time certo, o portгo se abrirб!(Coordenadas do portгo aberto)
    else MoveObject(portaocop,898.50000000,-2262.30004883,14.80000019, 1.0); //Caso ele se afaste de mais o portгo irб fechar.(Coordenadas do portгo fechado)
}
Portгo com Comando:

pawn Код:
public portaoandando()
{
        if(strcmp(cmdtext,"/abrirestacionamento",true) == 0)//COMANDO QUE ABRE O PORTAO
//if(IsPlayerInRangeOfPoint(playerid,5.0,Coord X, Coord Y, Coord Z);
{
    MoveObject(parkinggate,866.59997559,-2258.80004883,9.19999981,2);// 3 = velocidade, mude se quiser
    MoveObject(parkinggate2,855.09997559,-2189.89990234,9.80000019,2); // 2 = Velocidade
    SetTimer("portaoandando",5000,false);//5000 = 5 segundos
    SendClientMessage(playerid,0xF60000AA,"Estacionamento Aberto, Fecharб em 5 Segundos!");
    return 1;
}
Public do portгo com comando:
pawn Код:
public portaoandando()
{
        MoveObject(parkinggate,866.59997559,-2258.80004883,15.00000000, 1.5);
        MoveObject(parkinggate2,855.09997559,-2189.89990234,15.60000038, 1.0);
        return 1;
}
PS: sу o Segundo Portгo Funciona PS:Sou novato em Pawn
PS2:Esses portoes vieram pelo exemplos de Tutoriais


Re: Portao - .:LucasxD:. - 21.07.2012

Poxa Ningem?


Re: Portao - .:LucasxD:. - 22.07.2012

Affs '-'


Re: Portao - .:LucasxD:. - 22.07.2012

'-' porfavor algem responde


Re: Portao - [BOPE]Seu._.Madruga - 19.02.2014

Poste as coordenadas do portгo aberto e fechado de todos. e me fala oque vocк quer que eu pego e te ajudo.


Re: Portao - [BOPE]Seu._.Madruga - 19.02.2014

Ajudei? + Reputaзгo

PHP код:
#include <a_samp>
/*-- Vбriaveis Globais --*/
new
    
portaocop,
    
parkinggate,
    
parkinggate2
    
;
/*-- Forwards --*/
forward portaoandando(playerid);
forward portaofechando();
forward ChecarPortao();
public 
OnGameModeInit()
{
    
/*-- Portхes --*/
    
portaocop CreateObject(980,898.50000000,-2262.30004883,14.80000019,0.00000000,0.00000000,279.99206543);
    
parkinggate CreateObject(980,866.59997559,-2258.80004883,15.00000000,0.00000000,0.00000000,10.00000000);
    
parkinggate2 CreateObject(980,855.09997559,-2189.89990234,15.60000038,0.00000000,0.00000000,8.00000000);
    
SetTimer("ChecarPortao",5000,false);
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext,"/abrirestacionamento"true) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid,10.01,2,3)) /*-- Coloque aqui a cordenada do Portгo 1 --*/
        
{
            
MoveObject(parkinggate,866.59997559,-2258.80004883,9.19999981,0.97); /*-- 0.97 = Velocidade mude se quiser --*/
            
MoveObject(parkinggate2,855.09997559,-2189.89990234,9.80000019,0.97); /*-- 0.97 = Velocidade mude se quiser --*/
            
SetTimer("portaofechando",5000,false);/*-- Timer que fecharб o portгo em 5 segundos --*/
            
SendClientMessage(playerid,0xF60000AA,"Estacionamento Aberto, Fecharб em 5 Segundos!");
            return 
1;
        }
        else
        {
            
SendClientMessage(playerid, -1"[x] {FF0000}Vocк nгo estб a menos de 10 metros do portгo."); /*-- Se ele se afastar do portгo a mais de 10 metros o portгo fecharб --*/
        
}
        return 
1;
    }
    return 
0;
}
public 
ChecarPortao()
{
    for( new 
0<GetMaxPlayers( ) ; i++ )
    {
        if(
IsPlayerInRangeOfPoint(i,10.01,2,3)) /*-- Coloque aqui a cordenada do Portгo 1 --*/
        
{
            
MoveObject(portaocop,896.59997559,-2250.89990234,14.800000191.5); /*-- Se ele estiver a menos de 10 metros do portгo, o portгo abrirб --*/
        
}
        else
        {
            
MoveObject(portaocop,898.50000000,-2262.30004883,14.800000191.0); /*-- Se ele se afastar do portгo a mais de 10 metros o portгo fecharб --*/
        
}
    }
    return 
1;
}
public 
portaofechando()
{
    
MoveObject(parkinggate,866.59997559,-2258.80004883,15.000000001.5);
    
MoveObject(parkinggate2,855.09997559,-2189.89990234,15.600000381.0);
    return 
1;




Re: Portao - Sky™ - 19.02.2014

Certamente nгo olhou a data do tуpico :P

nгo pessa rep ^^


Respuesta: Portao - [BWL]Chamaleon - 19.02.2014

Meus parabйns ao sinhor que reviveu um tуpico de 2 anos ^_^

E ainda pediu reputaзгo *--*

Preste mais atenзгo na prуxima cara!

Atenciosamente,