SA-MP Forums Archive
Sa-mp 0.3e 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: Sa-mp 0.3e gate help (/showthread.php?tid=404633)



Sa-mp 0.3e gate help - coolmark1995 - 03.01.2013

I am trying to make a gate that auto opens with rcon the gate model I am using is 10841 but I am not sure how to script this the coords I have are
X:2890.6000976563
Y:-1963.5
Z:16.5
Rotation is z:270
is there any way someone could help me ive looked at all the tutorials but I dont understand them.


Re: Sa-mp 0.3e gate help - ReneG - 03.01.2013

Put this in a game mode and compile it. Log into rcon in-game and go near the gate to see if it works. If you go far enough from the gate
pawn Код:
new
    g_gate,
    g_gateTog;

public OnGameModeInit()
{
    g_gate = CreateObject(10841, 2890.60, -1963.5, 17.2, 0.0, 0.0, 270.0);
    SetTimer("gateCheck", 1000, 1);
    return 1;
}

forward gateCheck();
public gateCheck()
{
    new p_count;
    for(new i; i<MAX_PLAYERS; i++) {
        if(IsPlayerAdmin(i)) {
            if(IsPlayerInRangeOfPoint(i, 5.0, 2890.60, -1963.5, 17.2)) {
                p_count++;
                break;
            }
        }
    }

    if(p_count) {
        g_gateTog = 1;
        MoveObject(g_gate, 2890.60, -1963.5, 17.2-5.0, 1.0, 0.0, 0.0, 0.0);
    }

    else {
        g_gateTog = 0;
        MoveObject(g_gate, 2890.60, -1963.5, 17.2, 1.0, 0.0, 0.0, 0.0);
    }
    return 1;
}



Re: Sa-mp 0.3e gate help - coolmark1995 - 03.01.2013

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Put this in a game mode and compile it. Log into rcon in-game and go near the gate to see if it works. If you go far enough from the gate
pawn Код:
new
    g_gate,
    g_gateTog;

public OnGameModeInit()
{
    g_gate = CreateObject(10841, 2890.60, -1963.5, 17.2, 0.0, 0.0, 270.0);
    SetTimer("gateCheck", 1000, 1);
    return 1;
}

forward gateCheck();
public gateCheck()
{
    new p_count;
    for(new i; i<MAX_PLAYERS; i++) {
        if(IsPlayerAdmin(i)) {
            if(IsPlayerInRangeOfPoint(i, 5.0, 2890.60, -1963.5, 17.2)) {
                p_count++;
                break;
            }
        }
    }

    if(p_count) {
        g_gateTog = 1;
        MoveObject(g_gate, 2890.60, -1963.5, 17.2-5.0, 1.0, 0.0, 0.0, 0.0);
    }

    else {
        g_gateTog = 0;
        MoveObject(g_gate, 2890.60, -1963.5, 17.2, 1.0, 0.0, 0.0, 0.0);
    }
    return 1;
}
the gate appeared sideways and dosent move under rcon


Re: Sa-mp 0.3e gate help - coolmark1995 - 03.01.2013

is this fixable?