help with gates!!!
#1

i have this in my game mode and i can't understand where exaxtly are the coordinates so can any one explain to me because i need to fix this gate position:
Код:
MakeGate(980, -2914.917969,-68.470116,4.496734, -2914.917969,-68.470116,9.400000, -2914.917969,-68.470116,6.948367, 270.0000, 3, 4);
plz explain to me where to put the new gate coordinates.
Reply
#2

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

X, Y, Z - this is coordinations of your gate. To make it.. example for move you need to make this:

pawn Код:
#include        "a_samp"

new MyMovableGate;

public OnGameModeInit()
{
    MyMovableGate = CreateObject(modelid, X, Y, Z, rX, rY, rZ, DrawDistance);
    return true;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/openmygate", cmdtext, true, 10) == 0)
    {
        MoveObject(MyMovableGate, X, Y, Z, Speed); // X, Y, Z of the gate opened.
        return true;
    }
   
    if(strcmp("/closemygate", cmdtext, true, 11) == 0)
    {
        MoveObject(MyMovableGate, X, Y, Z, Speed); // X, Y, Z of the gate closed.
        return true;
    }
   
    // Speed should be 4.0.
    return false;
}
Reply
#3

yes i know that but in my game mode automatic gates are putted in the way above so i need to figure out what are the cordinates in that script above .
Reply
#4

Show me a function of your MakeGate. Because obviously it should be:

Код:
Coordinations of your gate:

X = -2914.917969,
Y = -68.470116,
Z = 4.496734

rX = -2914.917969,
rY = -68.470116,
rZ = 9.400000
But show me this function.
Reply
#5

pawn Код:
public GateTimer()
{
    for(new tempgate=0; tempgate<GateNum; tempgate++)
    {
        for(new pid=0; pid<MAX_PLAYERS; pid++)
        {
            if(GateInfo[tempgate][9] == 0 && OpenGate[tempgate] == 0) OpenGate[tempgate] = IsPlayerNearGate(pid, tempgate, TOLERANCE);
            if(GateInfo[tempgate][9] == 1 && OpenGate[tempgate] == 0 && HasPGP[pid] == 1) OpenGate[tempgate] = IsPlayerNearGate(pid, tempgate, TOLERANCE);
            if(GateInfo[tempgate][9] == 2 && OpenGate[tempgate] == 0 && HasAirP[pid] == 1) OpenGate[tempgate] = IsPlayerNearGate(pid, tempgate, TOLERANCE);
            if(GateInfo[tempgate][9] == 3 && OpenGate[tempgate] == 0 && PlayerInfo[pid][Level] > 0) OpenGate[tempgate] = IsPlayerNearGate(pid, tempgate, TOLERANCE);
        }
        if(OpenGate[tempgate] == 1) MoveDynamicObject(GateObject[tempgate], GateInfo[tempgate][3], GateInfo[tempgate][4], GateInfo[tempgate][5], OPENSPEED), GateState[tempgate] = 1;
        else MoveDynamicObject(GateObject[tempgate], GateInfo[tempgate][0], GateInfo[tempgate][1], GateInfo[tempgate][2], CLOSESPEED), GateState[tempgate] = 0;
        OpenGate[tempgate] = 0;
    }
    return 1;
}

MakeGate(z, Float:a, Float:b, Float:c, Float:d, Float:e, Float:f, Float:g, Float:h, Float:i, Float:j, type, k)
{
    GateInfo[k][0] = a, GateInfo[k][1] = b, GateInfo[k][2] = c; //Start
    GateInfo[k][3] = d, GateInfo[k][4] = e, GateInfo[k][5] = f; //Finish
    GateInfo[k][6] = g, GateInfo[k][7] = h, GateInfo[k][8] = i; //Center
    GateInfo[k][9] = type;
    GateState[k] = 0; //Gate Closed
    GateObject[k] = CreateDynamicObject(z ,a, b, c, 0.0,0.0,j);
}

stock IsPlayerNearGate(pid, tempgate, tolerance)
{
    GetPlayerPos(pid, Tempx, Tempy, Tempz);
    xtol1 = GateInfo[tempgate][6] + tolerance;
    xtol2 = GateInfo[tempgate][6] - tolerance;
    ytol1 = GateInfo[tempgate][7] + tolerance;
    ytol2 = GateInfo[tempgate][7] - tolerance;
    if(Tempx >= xtol2 && Tempx <= xtol1 && Tempy >= ytol2 && Tempy <= ytol1) return 1;
    return 0;
}

stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
Reply
#6

the problem is i don't understand what's inside makegate(........)
Reply
#7

Just like i told you.

Function:
pawn Код:
native CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 200.0);
So..

pawn Код:
MakeGate(z, Float:a, Float:b, Float:c, Float:d, Float:e, Float:f, Float:g, Float:h, Float:i, Float:j, type, k)
Can be done like that:
pawn Код:
MakeGate(modelid, Float:X, Float:Y, Float:Z, Float:d, Float:e, Float:f, Float:g, Float:h, Float:i, Float:j, type, k)
{
    GateInfo[k][0] = X, GateInfo[k][1] = Y, GateInfo[k][2] = Z; //Start
    GateInfo[k][3] = d, GateInfo[k][4] = e, GateInfo[k][5] = f; //Finish
    GateInfo[k][6] = g, GateInfo[k][7] = h, GateInfo[k][8] = i; //Center
    GateInfo[k][9] = type;
    GateState[k] = 0; //Gate Closed
    GateObject[k] = CreateDynamicObject(modelid, X, Y, Z, 0.0, 0.0, j);
}
This three after modelid is your coordinates of gate.

If you don't know what to put there.. i think it should be.. hm.

X, Y, Z - gate closed.
d, e, f - gate opened.
g, ,h, i - can be removed?
Reply
#8

plz tell me how to insert these coordinates in MakeGate(......)
pawn Код:
CreateDynamicObject(980,2436.33349609,943.69189453,12.59370422,0.00000000,0.00000000,358.00000000); //object(airportgate) (1) closed
CreateDynamicObject(980,2435.81127930,943.29077148,17.90719223,0.00000000,0.00000000,0.00000000); //object(airportgate) (2) opened
Reply
#9

Give me enum of GateInfo.
Reply
#10

i can't find it tell me what to search
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)