[AJUDA]com codigo para abrir e fechar portгo
#1

queria colocar esse fs para abrir so para a gang de cada hq alguem pode me ajudar desde ja agradeзo!!!!


pawn Код:
#include <a_samp>
forward gate1();
new objgate1;
forward gate2();
new objgate2;
forward gate3();
new objgate3;
forward gate4();
new objgate4;
forward gate5();
new objgate5;
forward gate6();
new objgate6;

public OnFilterScriptInit()
{
SetTimer("gate1",1000,true);
SetTimer("gate2",1000,true);
SetTimer("gate3",1000,true);
SetTimer("gate4",1000,true);
SetTimer("gate5",1000,true);
SetTimer("gate6",1000,true);
objgate1 = CreateObject(980, 2720.0784, -2405.6216, 12.3537 ,0.0000, 0.0000, 89.8487);/////fechado
objgate2 = CreateObject(980, 2720.2627, -2503.8779, 12.4846 ,0.0000, 0.0000, 89.7827);/////fechado
objgate3 = CreateObject(980, 308.60000610352, -1556.1999511719, 31.700000762939 ,0.0000, 0.0000, 340);////fechado
objgate4 = CreateObject(980, 362.5, -1465.8000488281, 32.299999237061 ,0.0000, 0.0000, 260);//////fechado
objgate5 = CreateObject(980, 1118.0999755859, -1161.8000488281, 25.299999237061 ,0.0000, 0.0000, 0.0000);//////fechado
objgate6 = CreateObject(980, 2813.1999511719, -1468.5, 18 ,0.0000, 0.0000, 0.0000);//////fechado
CreateObject(3267, 2770.41, -2427.26, 12.24,   0.00, 0.00, 86.34);
CreateObject(3267, 2770.52, -2409.03, 12.24,   0.00, 0.00, 86.34);
CreateObject(3267, 2770.67, -2445.81, 12.24,   0.00, 0.00, 86.34);
CreateObject(3267, 2771.05, -2464.95, 12.24,   0.00, 0.00, 86.34);
CreateObject(3267, 2770.90, -2483.65, 12.24,   0.00, 0.00, 86.34);
CreateObject(3267, 2770.21, -2503.37, 12.24,   0.00, 0.00, 86.34);
return 1;
}

public gate1()
{
    new objgate1_status;
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i,10.0,2720.0784, -2405.6216, 12.3537))objgate1_status=1;/////fechado
    }
    if(objgate1_status)MoveObject(objgate1, 2720.2378, -2395.5022, 12.3537,9);////aberto
    else MoveObject(objgate1, 2720.0784, -2405.6216, 12.3537, 10);//////fechado
}
public gate2()
{
    new objgate2_status;
    for(new i1;i1<MAX_PLAYERS;i1++)
    {
        if(!IsPlayerConnected(i1)) continue;
        if(IsPlayerInRangeOfPoint(i1,10.0,2720.2627, -2503.8779, 12.4846))objgate2_status=1;/////fechado
    }
    if(objgate2_status)MoveObject(objgate2, 2720.2888, -2493.8040, 12.4846,9);/////aberto
    else MoveObject(objgate2, 2720.2627, -2503.8779, 12.4846, 10);//////fechado
}
public gate3()
{
    new objgate3_status;
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i,10.0,308.60000610352, -1556.1999511719, 31.700000762939))objgate3_status=1;//////fechado
    }
    if(objgate3_status)MoveObject(objgate3, 300.599609375, -1556.19921875, 27.700000762939,9);/////aberto
    else MoveObject(objgate3, 308.60000610352, -1556.1999511719, 31.700000762939, 10);//////fechado
}
public gate4()
{
    new objgate4_status;
    for(new i1;i1<MAX_PLAYERS;i1++)
    {
        if(!IsPlayerConnected(i1)) continue;
        if(IsPlayerInRangeOfPoint(i1,10.0,362.5, -1465.8000488281, 32.299999237061))objgate4_status=1;//////fechado
    }
    if(objgate4_status)MoveObject(objgate4, 362.5, -1465.7998046875, 26.299999237061,9);/////aberto
    else MoveObject(objgate4, 362.5, -1465.8000488281, 32.299999237061, 10);//////fechado
}
public gate5()
{
    new objgate5_status;
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i,10.0,1118.0999755859, -1161.8000488281, 25.299999237061))objgate5_status=1;/////fechado
    }
    if(objgate5_status)MoveObject(objgate5, 1110.0999511719, -1161.8000488281, 25.299999237061,9);////aberto
    else MoveObject(objgate5, 1118.0999755859, -1161.8000488281, 25.299999237061, 10);//////fechado
}
public gate6()
{
    new objgate6_status;
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i,10.0,2813.1999511719, -1468.5, 18))objgate6_status=1;/////fechado
    }
    if(objgate6_status)MoveObject(objgate6, 2825.1999511719, -1468.5, 18,9);////aberto
    else MoveObject(objgate6, 2813.1999511719, -1468.5, 18, 10);//////fechado
}
Reply
#2

Bom creio que se vc criar portхes assim seria muito mais Fбcil !

pawn Код:
//===================No Topo ( Nas News) ===================
new PortaoAz;
///====================No topo nas Forwards========================
forward AzAndando();
//==============================Na On GameModeInit
PortaoAz = CreateObject(980,1001.79998779,-2112.89990234,14.89999962,0.00000000,0.00000000,0.00000000);//Muda pelas cordenada do portao fechado
//==============================Na public Command Text La talz========================
if(strcmp(cmd, "/portaoaz", true) == 0)
    {
    if (PlayerToPoint(15.0, playerid, 1001.6422,-2107.3374,13.0859)) { //Lugar que o Player Tem que ta pro portao abri
    MoveObject( PortaoAz, 988.6989,-2111.7212,13.0938,3);//Lugar pra onde o portao vai i (Aberto)
    SetTimer("AzAndando", 5000, false);}
    }
//==================================== FIM DO GM ====================================
public AzAndando()
{
    MoveObject(PortaoAz,1001.79998779,-2112.89990234,14.89999962, 2);//Cordenada x,y,z do portao fechado.
    return 1;
    }


//Й Isso, agora muda o nome do "PortaoAz" para o nome do seu Portao ;)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)