SA-MP Forums Archive
I dont see my gate help.. - 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: I dont see my gate help.. (/showthread.php?tid=470089)



I dont see my gate help.. - ajam112 - 16.10.2013

my gates
pawn Код:
enum _gates
{
    gID,
    gFactionID,

    gModelID,

    gOpen,

    Float:closeX, Float:closeY, Float:closeZ, Float: rotX, Float: rotY, Float: rotZ,

    Float:openX, Float:openY, Float:openZ, Float: openrotX, Float: openrotY, Float: openrotZ,
}
new Gates [ ] [ _gates ] = {
    // SDC
    //{ 0, SDC, 2933,0, 2720.20434570,-2405.39379883,14.17885685,0.00000000,0.00000000,270.27026367, 2720.20434570,-2405.39379883,5.17885685,0.00000000,0.00000000,270.27026367 },
    //{ 1, SDC, 2933,0, 2720.22363281,-2503.98120117,14.17885685,0.00000000,0.00000000,270.26916504, 2720.22363281,-2503.98120117,5.17885685,0.00000000,0.00000000,270.26916504 },

    // Barzini
    //{ 2, BARZINI, 10184, 0, 1534.08666992,-1451.35705566,14.77957344,0.00000000,0.00000000,270.17565918, 1534.08666992,-1451.35705566,4.77957344,0.00000000,0.00000000,270.17565918 },

    // LSPD
    { 3, COPS, 980, 0, 1590.0000000,-1638.0000000,9.5000000,0.00000000,0.00000000,0.0000000, 1590.0000000,-1638.0000000,15.2000000,0.00000000,0.00000000,0.0000000 },

    // FBI
    //{ 4, FBI, 986, 0, 1285.42675781,-1648.62597656,14.24686813,0.00000000,0.00000000,270.01647949, 1285.42675781,-1648.62597656,4.24686813,0.00000000,0.00000000,270.01647949 },
    //{ 5, FBI, 986, 0, 1269.40429688,-1648.61547852,14.24686813,0.00000000,0.00000000,270.01647949, 1269.40429688,-1648.61547852,4.24686813,0.00000000,0.00000000,270.01647949 },

    // Stracci
    //{ 6, STRACCI, 971, 0, 1151.25085449,-1217.36987305,20.73587608,0.00000000,0.00000000,0.00000000, 1151.25085449,-1217.36987305,10.73587608,0.00000000,0.00000000,0.00000000 },

    // Tattaglia
    //{ 7, TATTAGLIA, 969, 0, 2234.07421875,-2215.81835938,12.67185783,0.00000000,0.00000000,315.07690430,2234.07421875,-2215.81835938,7.67185783,0.00000000,0.00000000,315.07690430 },
    //{ 8, TATTAGLIA, 969, 0, 2233.89501953,-2215.61938477,12.67187309,0.00000000,0.00000000,135.72973633,2233.89453125,-2215.61914062,7.89689255,0.00000000,0.00000000,135.72509766 },
    //{ 9, TATTAGLIA, 971, 0, 2178.12011719,-2254.65234375,17.29336739,0.00000000,0.00000000,45.65478516, 2178.12011719,-2254.65234375,9.74337959,0.00000000,0.00000000,45.65368652 },

    // Paterno
    //{ 10, PATERNO, 971, 0, 923.55010986,-1216.78002930,19.52148819,0.00000000,0.00000000,89.82449341,923.55010986,-1216.78002930,12.09649849,0.00000000,0.00000000,89.82449341 },
    //{ 11, PATERNO, 971, 0, 923.50872803,-1225.64953613,19.52147675,0.00000000,0.00000000,269.73840332, 923.50872803,-1225.64953613,12.52147675,0.00000000,0.00000000,269.73840332 }


};
and my command

pawn Код:
COMMAND:gate(playerid, params[])
{
    new i = playerid;
    for(new g; g < sizeof(Gates); g++)
    {
        if(IsPlayerInRangeOfPoint(i, 20.0, Gates[g][closeX],Gates[g][closeY],Gates[g][closeZ]) || IsPlayerInRangeOfPoint(i, 20.0, Gates[g][openX],Gates[g][openY],Gates[g][openZ]))
        {
            if(Gates[g][gFactionID] == -1 && PlayerInfo[i][playerteam] != COPS && PlayerInfo[i][playerteam] != SASF && PlayerInfo[i][playerteam] != FBI && PlayerInfo[i][playerteam] != POLITIC)
                return SendClientError(playerid, "Only for LSPD / SASF / FBI / GOV");
            if(Gates[g][gFactionID] != -1 && Gates[g][gFactionID] != PlayerInfo[i][playerteam])
                return SendClientError(playerid, "You don't have the permission!");
            if(Gates[g][gOpen] == 0)
            {
                MoveObject(Gates[g][gID], Gates[g][openX], Gates[g][openY], Gates[g][openZ], 5.0);
                SetObjectRot(Gates[g][gID], Gates[g][openrotX],Gates[g][openrotY],Gates[g][openrotZ]);
                Gates[g][gOpen] = 1;
            }
            else if(Gates[g][gOpen] == 1)
            {
                MoveObject(Gates[g][gID], Gates[g][closeX],Gates[g][closeY],Gates[g][closeZ], 5.0);
                SetObjectRot(Gates[g][gID], Gates[g][rotX],Gates[g][rotY],Gates[g][rotZ]);
                Gates[g][gOpen] = 0;
            }
        }
    }
    return 1;
}



Re: I dont see my gate help.. - LeMoi - 16.10.2013

Why do you use
pawn Код:
new Gates [ ] [ _gates ] = {
    // SDC
    //{ 0, SDC, 2933,0, 2720.20434570,-2405.39379883,14.17885685,0.00000000,0.00000000,270.27026367, 2720.20434570,-2405.39379883,5.17885685,0.00000000,0.00000000,270.27026367 },
    //{ 1, SDC, 2933,0, 2720.22363281,-2503.98120117,14.17885685,0.00000000,0.00000000,270.26916504, 2720.22363281,-2503.98120117,5.17885685,0.00000000,0.00000000,270.26916504 },

    // Barzini
    //{ 2, BARZINI, 10184, 0, 1534.08666992,-1451.35705566,14.77957344,0.00000000,0.00000000,270.17565918, 1534.08666992,-1451.35705566,4.77957344,0.00000000,0.00000000,270.17565918 },

    // LSPD
    { 3, COPS, 980, 0, 1590.0000000,-1638.0000000,9.5000000,0.00000000,0.00000000,0.0000000, 1590.0000000,-1638.0000000,15.2000000,0.00000000,0.00000000,0.0000000 },

    // FBI
    //{ 4, FBI, 986, 0, 1285.42675781,-1648.62597656,14.24686813,0.00000000,0.00000000,270.01647949, 1285.42675781,-1648.62597656,4.24686813,0.00000000,0.00000000,270.01647949 },
    //{ 5, FBI, 986, 0, 1269.40429688,-1648.61547852,14.24686813,0.00000000,0.00000000,270.01647949, 1269.40429688,-1648.61547852,4.24686813,0.00000000,0.00000000,270.01647949 },

    // Stracci
    //{ 6, STRACCI, 971, 0, 1151.25085449,-1217.36987305,20.73587608,0.00000000,0.00000000,0.00000000, 1151.25085449,-1217.36987305,10.73587608,0.00000000,0.00000000,0.00000000 },

    // Tattaglia
    //{ 7, TATTAGLIA, 969, 0, 2234.07421875,-2215.81835938,12.67185783,0.00000000,0.00000000,315.07690430,2234.07421875,-2215.81835938,7.67185783,0.00000000,0.00000000,315.07690430 },
    //{ 8, TATTAGLIA, 969, 0, 2233.89501953,-2215.61938477,12.67187309,0.00000000,0.00000000,135.72973633,2233.89453125,-2215.61914062,7.89689255,0.00000000,0.00000000,135.72509766 },
    //{ 9, TATTAGLIA, 971, 0, 2178.12011719,-2254.65234375,17.29336739,0.00000000,0.00000000,45.65478516, 2178.12011719,-2254.65234375,9.74337959,0.00000000,0.00000000,45.65368652 },

    // Paterno
    //{ 10, PATERNO, 971, 0, 923.55010986,-1216.78002930,19.52148819,0.00000000,0.00000000,89.82449341,923.55010986,-1216.78002930,12.09649849,0.00000000,0.00000000,89.82449341 },
    //{ 11, PATERNO, 971, 0, 923.50872803,-1225.64953613,19.52147675,0.00000000,0.00000000,269.73840332, 923.50872803,-1225.64953613,12.52147675,0.00000000,0.00000000,269.73840332 }


};
if there's only one gate you want to work with? There are betters ways to define it.
Also, could you please give us more information about the problem?
Seeing the code you only will be able to see one gate.
If you wanted to see every gates you had declared, you should have made the following

pawn Код:
new Gates [ ] [ _gates ] = {
    // SDC
    { 0, SDC, 2933,0, 2720.20434570,-2405.39379883,14.17885685,0.00000000,0.00000000,270.27026367, 2720.20434570,-2405.39379883,5.17885685,0.00000000,0.00000000,270.27026367 },
    { 1, SDC, 2933,0, 2720.22363281,-2503.98120117,14.17885685,0.00000000,0.00000000,270.26916504, 2720.22363281,-2503.98120117,5.17885685,0.00000000,0.00000000,270.26916504 },

    // Barzini
    { 2, BARZINI, 10184, 0, 1534.08666992,-1451.35705566,14.77957344,0.00000000,0.00000000,270.17565918, 1534.08666992,-1451.35705566,4.77957344,0.00000000,0.00000000,270.17565918 },

    // LSPD
    { 3, COPS, 980, 0, 1590.0000000,-1638.0000000,9.5000000,0.00000000,0.00000000,0.0000000, 1590.0000000,-1638.0000000,15.2000000,0.00000000,0.00000000,0.0000000 },

    // FBI
    { 4, FBI, 986, 0, 1285.42675781,-1648.62597656,14.24686813,0.00000000,0.00000000,270.01647949, 1285.42675781,-1648.62597656,4.24686813,0.00000000,0.00000000,270.01647949 },
    { 5, FBI, 986, 0, 1269.40429688,-1648.61547852,14.24686813,0.00000000,0.00000000,270.01647949, 1269.40429688,-1648.61547852,4.24686813,0.00000000,0.00000000,270.01647949 },

    // Stracci
    { 6, STRACCI, 971, 0, 1151.25085449,-1217.36987305,20.73587608,0.00000000,0.00000000,0.00000000, 1151.25085449,-1217.36987305,10.73587608,0.00000000,0.00000000,0.00000000 },

    // Tattaglia
    { 7, TATTAGLIA, 969, 0, 2234.07421875,-2215.81835938,12.67185783,0.00000000,0.00000000,315.07690430,2234.07421875,-2215.81835938,7.67185783,0.00000000,0.00000000,315.07690430 },
    { 8, TATTAGLIA, 969, 0, 2233.89501953,-2215.61938477,12.67187309,0.00000000,0.00000000,135.72973633,2233.89453125,-2215.61914062,7.89689255,0.00000000,0.00000000,135.72509766 },
    { 9, TATTAGLIA, 971, 0, 2178.12011719,-2254.65234375,17.29336739,0.00000000,0.00000000,45.65478516, 2178.12011719,-2254.65234375,9.74337959,0.00000000,0.00000000,45.65368652 },

    // Paterno
    { 10, PATERNO, 971, 0, 923.55010986,-1216.78002930,19.52148819,0.00000000,0.00000000,89.82449341,923.55010986,-1216.78002930,12.09649849,0.00000000,0.00000000,89.82449341 },
    { 11, PATERNO, 971, 0, 923.50872803,-1225.64953613,19.52147675,0.00000000,0.00000000,269.73840332, 923.50872803,-1225.64953613,12.52147675,0.00000000,0.00000000,269.73840332 }


};



Re: I dont see my gate help.. - ajam112 - 16.10.2013

i did it, but it's doesn't show the gate which is i planned to located at.


Re: I dont see my gate help.. - iJumbo - 16.10.2013

Well you do not create it?.. where is code for CreateObject?


Re: I dont see my gate help.. - ajam112 - 16.10.2013

I dont know, maybe the function only like this?
pawn Код:
971, 0, 923.50872803,-1225.64953613,19.52147675,0.00000000,0.00000000,269.73840332, 923.50872803,-1225.64953613,12.52147675,0.00000000,0.00000000,269.73840332 }



Re: I dont see my gate help.. - iJumbo - 16.10.2013

https://sampwiki.blast.hk/wiki/CreateObject


Re: I dont see my gate help.. - ajam112 - 17.10.2013

should i use it? and so, how can i add the gate for police?


Re: I dont see my gate help.. - ajam112 - 17.10.2013

BUMP, anybody?