SA-MP Forums Archive
Bug Onplayerkeystatechange - 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: Bug Onplayerkeystatechange (/showthread.php?tid=482869)



Bug Onplayerkeystatechange - Stereotype - 23.12.2013

I created when the player is near pos x,y,z and when he press space server should teleport him to interior, but the bug is when he enters server automaticly put him in the interior and eject him from interion .. I TRIED ALL KEYS,
if (newkeys & KEY_SPRINT)
if ((newkeys & KEY_SPRINT) && !(oldkeys & KEY_SPRINT))
NOTE: WHEN I HOLD SPACE HE PUTS ME IN THE INTERIOR , BUT WHEN I RELEASE IT IT EJECT ME

http://www.youtube.com/watch?v=w_-0Q...ature=*********

pawn Код:
else if ((newkeys & KEY_SPRINT))
    if(IsPlayerInRangeOfPoint(playerid,3.0,1123.4500,-2036.6272,69.8872))
    {
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid,938.0398,97.6458,1001.2659);
        PlayerInfo[playerid][pInt] = 1;
        TogglePlayerControllable(playerid,0);
        GameTextForPlayer(playerid, "Ucitavanje Objekata", 5000, 5);
        SetTimerEx("UcitavanjeObejekata", 3000, false, "i", playerid);
    }
    if(IsPlayerInRangeOfPoint(playerid,3.0,938.0398,97.6458,1001.2659))
    {
        SetPlayerPos(playerid,1123.4500,-2036.6272,69.8872);
        GameTextForPlayer(playerid, "~w~Los Santos", 5000, 1);
        SetPlayerInterior(playerid, 0);
        PlayerInfo[playerid][pInt] = 0;
    }



Re: Bug Onplayerkeystatechange - park4bmx - 23.12.2013

a simple elseif would solve the problem
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,3.0,1123.4500,-2036.6272,69.8872))
{
    //code
}else if(IsPlayerInRangeOfPoint(playerid,3.0,938.0398,97.6458,1001.2659))
{
    //code
}



Re: Bug Onplayerkeystatechange - Aliassassin123456 - 23.12.2013

pawn Код:
else if ((((newkeys & (KEY_SPRINT)) == (KEY_SPRINT)) && ((oldkeys & (KEY_SPRINT)) != (KEY_SPRINT))))
{
    if(IsPlayerInRangeOfPoint(playerid,3.0,1123.4500,-2036.6272,69.8872))
    {
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid,938.0398,97.6458,1001.2659);
        PlayerInfo[playerid][pInt] = 1;
        TogglePlayerControllable(playerid,0);
        GameTextForPlayer(playerid, "Ucitavanje Objekata", 5000, 5);
        SetTimerEx("UcitavanjeObejekata", 3000, false, "i", playerid);
    }
    else if(IsPlayerInRangeOfPoint(playerid,3.0,938.0398,97.6458,1001.2659))
    {
        SetPlayerPos(playerid,1123.4500,-2036.6272,69.8872);
        GameTextForPlayer(playerid, "~w~Los Santos", 5000, 1);
        SetPlayerInterior(playerid, 0);
        PlayerInfo[playerid][pInt] = 0;
    }
}



Re: Bug Onplayerkeystatechange - Stereotype - 23.12.2013

Fixed it alone . ty all