SA-MP Forums Archive
Dynamic Gate Bugged - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dynamic Gate Bugged (/showthread.php?tid=610970)



Dynamic Gate Bugged - NealPeteros - 30.06.2016

So, I'm running a server. It had a Dynamic Gate System. Players reported that they get killed if they go near the gate or if they open the gate. Their life slowly goes down to 0. I need help on this, please. Thanks


Re: Dynamic Gate Bugged - DTV - 30.06.2016

What's the code for when players open/close gates?


Re: Dynamic Gate Bugged - NealPeteros - 01.07.2016

Sorry for the late reply. Anyways, here it is:
pawn Код:
CMD:gate(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command.");
    // Dynamic Gates
    for(new idx=1; idx<MAX_GATES; idx++)
    {
        if(GateInfo[idx][gModel] && IsPlayerInRangeOfPoint(playerid, 8, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]))
        {
            if(strlen(GateInfo[idx][gPassword]))
            {
                if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gate [password]");
                if(strcmp(params, GateInfo[idx][gPassword])) return SendClientMessage(playerid, COLOR_GREY, "Invalid gate password.");
                if(!GateInfo[idx][gStatus])
                {
                    GateInfo[idx][gStatus] = 1;
                    MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed]);
                    SetDynamicObjectRot(GateInfo[idx][gGate], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
                }
                else
                {
                    GateInfo[idx][gStatus] = 0;
                    MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed]);
                    SetDynamicObjectRot(GateInfo[idx][gGate], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
                }
            }
            else
            {
                if(!GateInfo[idx][gStatus])
                {
                    GateInfo[idx][gStatus] = 1;
                    MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed]);
                    SetDynamicObjectRot(GateInfo[idx][gGate], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
                }
                else
                {
                    GateInfo[idx][gStatus] = 0;
                    MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed]);
                    SetDynamicObjectRot(GateInfo[idx][gGate], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
                }
            }
            idx = MAX_GATES;
            return 1;
        }
    }
    // Static Gates
    if(IsACop(playerid) && IsPlayerInRangeOfPoint(playerid, 6, 1544.7363,-1627.0232,13.3672)) // LSPD Barrier
    {
        if(!LSPDBarrierStatus)
        {
            LSPDBarrierStatus = 1;
            MoveDynamicObject(LSPDBarrier, 1544.6943359375, -1630.73046875, 13.27956199646+0.0001, 0.0002, 0, 0, 90);
        }
        else
        {
            LSPDBarrierStatus = 0;
            MoveDynamicObject(LSPDBarrier, 1544.6943359375, -1630.73046875, 13.27956199646-0.0001, 0.0003, 0, 90, 90);
        }
        return 1;
    }
    else if(IsACop(playerid) && IsPlayerInRangeOfPoint(playerid, 7, 1588.4501,-1638.5692,13.3672)) // LSPD Gate
    {
        if(!LSPDGateStatus)
        {
            LSPDGateStatus = 1;
            MoveDynamicObject(LSPDGate, 1588.6501464844, -1638.0750732422, 6.2343215942383, 3);
        }
        else
        {
            LSPDGateStatus = 0;
            MoveDynamicObject(LSPDGate, 1588.6428222656, -1638.02734375, 15.240161895752, 3);
        }
        return 1;
    }
    else if(IsFBI(playerid) && IsPlayerInRangeOfPoint(playerid, 7, 282.0358,-1544.4222,25.0337)) // LSPD Gate
    {
        if(!FBIGateStatus)
        {
            FBIGateStatus = 1;
            MoveDynamicObject(FBIGate, 284.29998779, -1543.40002441, 20.20000076, 3);
        }
        else
        {
            FBIGateStatus = 0;
            MoveDynamicObject(FBIGate, 284.29998779, -1543.40002441, 26.20000076, 3);
        }
    }
    else if(IsAReporter(playerid) && IsPlayerInRangeOfPoint(playerid, 6, 778.0338,-1385.0182,13.7254)) // NA Gate 1
    {
        if(!SAGateStatus1)
        {
            SAGateStatus1 = 1;
            MoveDynamicObject(SAGate1, 770.497985, -1384.939453, 14.392275, 3);
        }
        else
        {
            SAGateStatus1 = 0;
            MoveDynamicObject(SAGate1, 777.457580, -1384.939453, 14.392275, 3);
        }
    }
    else if(IsAReporter(playerid) && IsPlayerInRangeOfPoint(playerid, 6, 777.5819,-1330.1381,13.5500)) // NA Gate 2
    {
        if(!SAGateStatus2)
        {
            SAGateStatus2 = 1;
            MoveDynamicObject(SAGate2, 783.026306, -1330.353393, 14.167037, 3);
        }
        else
        {
            SAGateStatus2 = 0;
            MoveDynamicObject(SAGate2, 778.548583, -1330.212890, 14.167037, 3);
        }
    }
    else if(IsATaxidriver(playerid) && IsPlayerInRangeOfPoint(playerid, 6.0,1812.9000,-2071.8999,13.5000)) // Taxi Gate
    {
        if(!TaxiGateStatus)
        {
            TaxiGateStatus = 1;
            MoveDynamicObject(TaxiGate, 1812.9000,-2071.8999,9.3000, 3);
        }
        else
        {
            TaxiGateStatus = 0;
            MoveDynamicObject(TaxiGate, 1812.9000,-2071.8999,13.5000, 3);
        }
    }
    else SendClientMessage(playerid, COLOR_GREY, "You aren't near a gate you can open.");
    return 1;
}



Re: Dynamic Gate Bugged - NealPeteros - 01.07.2016

Please help