SA-MP Forums Archive
CP functions are executing too fast! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: CP functions are executing too fast! (/showthread.php?tid=192458)



CP functions are executing too fast! - OldDirtyBastard - 22.11.2010

Hello dear SA-MP community, im kinda stuck with a checkpoint, when i enter the checkpoint it
should execute some functions(bring up a menu in my case), so when ever i enter a checkpoint
it brings up the menu right away and i never get into the checkpoint only at his edge which kinda sucks.
Ive tried like:

pawn Код:
public AmmuCheckpoint(playerid)
{
    ShowMenuForPlayer(wepmenu, playerid);
    TogglePlayerControllable(playerid,0);
    ClearAnimations(playerid);
    SetPlayerFacingAngle(playerid, 178.8904);
    SetCameraBehindPlayer(playerid);
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    SetTimerEx("AmmuCheckpoint", 1500, 0, "i", playerid);
    AmmuCheckpoint(playerid);
    return 1;
}
But it didnt worked out, the efect was the same...
Anyone could please give me some tips if you can.
Thanks, regards.


Re: CP functions are executing too fast! - SkizzoTrick - 22.11.2010

Why don't you try this?
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid,5,AmmuNation Coords))
        {
        ShowMenuForPlayer(wepmenu, playerid);
    TogglePlayerControllable(playerid,0);
    ClearAnimations(playerid);
    SetPlayerFacingAngle(playerid, 178.8904);
    SetCameraBehindPlayer(playerid);
        }
    return 1;
}



Re: CP functions are executing too fast! - OldDirtyBastard - 22.11.2010

Quote:
Originally Posted by SkizzoTrick
Посмотреть сообщение
Why don't you try this?
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid,5,AmmuNation Coords))
}
why ammunation coords? not the one of the checkpoint?


Re: CP functions are executing too fast! - SkizzoTrick - 22.11.2010

Quote:
Originally Posted by OldDirtyBastard
Посмотреть сообщение
why ammunation coords? not the one of the checkpoint?
Yes,but i said AmmuNation,nvm,put there the checkpoint coords


Re: CP functions are executing too fast! - SkizzoTrick - 22.11.2010

But listen,for this kind of scripts,you better use Pickups!

here is the script:

pawn Код:
new Ammupickup;

public OnGameModeInit()

Ammupickup = CreatePickup(1242, 23, 1503.3359, 1432.3585, 10.1191, -1);

public OnPlayerPickupPickup(playerid, pickupid)
{

    if ( pickupid == Ammupickup )
            {
            ShowMenuForPlayer(wepmenu, playerid);
                TogglePlayerControllable(playerid,0);
                ClearAnimations(playerid);
                SetPlayerFacingAngle(playerid, 178.8904);
                SetCameraBehindPlayer(playerid);
            }
return 1;
}



Re: CP functions are executing too fast! - OldDirtyBastard - 22.11.2010

Theres nothing changed, tried to adjust it a bit but still nothing, and i dont wanna go with a pickup...
I would need something like he needs to stay into the checkpoint for like 1sec so the menu will show up.


Re: CP functions are executing too fast! - Hiddos - 22.11.2010

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    SetTimerEx("AmmuCheckpoint", 1500, 0, "i", playerid);
    AmmuCheckpoint(playerid);
    return 1;
}
Remove this line:
pawn Код:
AmmuCheckpoint(playerid);



Re: CP functions are executing too fast! - OldDirtyBastard - 22.11.2010

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    SetTimerEx("AmmuCheckpoint", 1500, 0, "i", playerid);
    AmmuCheckpoint(playerid);
    return 1;
}
Remove this line:
pawn Код:
AmmuCheckpoint(playerid);
Your the best!