Auto gate help
#1

hey guys .. well im a puree noob
How can i make the gate open when Player> "[Cro]Mexi69" get close them ?
pawn Код:
#include <a_samp>
new Mexi69;
public OnGameModeInit()
{
    Mexi69 = CreateObject(976, );
    SetTimer("Mexi", 1000, 1);
}
forward Mexi();
public Mexi()
{
    new open;
    for(new i=GetMaxPlayers(); i > -1; i--)
    {
        if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 2.0, , , ))
        {
            open = 1;
            MoveObject(Mexi69, 318.5770, -1190.4686, 75.4311, 2.0);
            break;
        }
    }
    if(!open)
        MoveObject(Mexi69, , , , 2.0);
}
ANYONE ?
Reply
#2

If it's just for that player, then I sugest just starting the timer when he connects and save the id in a variable. Then in the timer simply check if that id is close to the gate. If it's true then open the gate. Simple and efficient.
Reply
#3

well thanks i will try
btw
can u post me some codes to be sure
so i learn some Shit
Reply
#4

pawn Код:
new gatepid, timer;

public OnPlayerConnect(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    if(!strcmp(pName,"[Cro]Mexi69")
    {
          gatepid=playerid;
      timer = SetTimer("Mexi", 1000, 1);
    }
}

forward Mexi();
public Mexi()
{
        if(!IsPlayerConnected(gatepid))
        {
                KillTimer(timer);
                return 0;
        }
        if(IsPlayerInRangeOfPoint(i, 2.0, , , ))
        MoveObject(Mexi69, 318.5770, -1190.4686, 75.4311, 2.0);
}
codes weren't tested, but it should be something like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)