my gate is not work
#1

I do not see the gate that I have made (see below) and this became a problem for me, if there is anyone who is good at scripting, please help me. I do not know why I can not see it, but I have done it right, or I forgot something or do wrong?

#Someone once said to me that using the "CreateObject", but I do not know where to put it.

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
    //1590.0000000,-1638.0000000,9.5000000,0.00000000,0.00000000,0.0000000, 1590.0000000,-1638.0000000,15.2000000,0.00000000,0.00000000,0.0000000 },
    { 3, COPS, 980, 0, 1590.0000000,-1638.0000000,15.2000000,0.00000000,0.00000000,0.0000000, 1590.0000000,-1638.0000000,9.5000000,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 this is a command, it was true or not?
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;
}
Reply
#2

You need to define the objects like this for example
pawn Код:
//Global
new GateExample;

//OnGameModeInit
GateExample = CreateObject(blabla

//CMD
MoveObject(GateExample, ....
Reply
#3

pawn Код:
for(new f; f < sizeof(Gates); f++)
    {
        Gates[f][gID] = CreateObject(Gates[f][gModelID], Gates[f][closeX],Gates[f][closeY],Gates[f][closeZ], Gates[f][rotX],Gates[f][rotY],Gates[f][rotZ]);
       // CreateDynamic3DTextLabel("{FFFFFF}GATE", COLOR_WHITE, Gates[f][closeX],Gates[f][closeY],Gates[f][closeZ]+0.2, 10);
        printf("%d gates created",f);
    }
Add this on ongamemodeinit
Reply
#4

this is my first gate function
pawn Код:
new GateInfo[MAX_GATES][gateInfo];
Reply
#5

Quote:
Originally Posted by AnonMKD
Посмотреть сообщение
pawn Код:
for(new f; f < sizeof(Gates); f++)
    {
        Gates[f][gID] = CreateObject(Gates[f][gModelID], Gates[f][closeX],Gates[f][closeY],Gates[f][closeZ], Gates[f][rotX],Gates[f][rotY],Gates[f][rotZ]);
       // CreateDynamic3DTextLabel("{FFFFFF}GATE", COLOR_WHITE, Gates[f][closeX],Gates[f][closeY],Gates[f][closeZ]+0.2, 10);
        printf("%d gates created",f);
    }
Add this on ongamemodeinit
tested it and let's see if it work fine
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)