SA-MP Forums Archive
Help is needed! - 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: Help is needed! (/showthread.php?tid=483545)



Help is needed! - $Marco$ - 26.12.2013

Hello SA-MP community.
I need a way of making a player unable to move (W,A,S,D keys and the arrows) but be able to move the moues around.
For example a TogglePlayerControlable but a one that allows you to move your mouse.
Thanks in regards, Marco.


Re: Help is needed! - ProjectNewYork - 26.12.2013

I think there is no way for it....
I will notify u once i get a solution


Re: Help is needed! - $Marco$ - 26.12.2013

Thanks, waiting for a response.


Re: Help is needed! - SuperViper - 26.12.2013

Rather than using TogglePlayerControllable, you can store the player's position and repeatedly set it back to that position in a quick timer.

pawn Код:
forward public PlayerFrozenCheck(playerid);

new Float: playersFrozenPosition[MAX_PLAYERS][4], playerFrozenTimer[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    playerFrozenTimer[playerid] = SetTimerEx("PlayerFrozenCheck", 200, 1, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    KillTimer(playerFrozenTimer[playerid]);
    return 1;
}

public PlayerFrozenCheck(playerid)
{
    if(playersFrozenPosition[playerid][0] != -65535)
    {
        SetPlayerPos(playerid, playersFrozenPosition[playerid][0], playersFrozenPosition[playerid][1], playersFrozenPosition[playerid][2]);
        SetPlayerFacingAngle(playerid, playersFrozenPosition[playerid][3]);
        SetCameraBehindPlayer(playerid);
    }

    return 1;
}

TogglePlayerFrozen(playerid, bool: toggle)
{
    if(toggle)
    {
        GetPlayerPos(playerid, playersFrozenPosition[playerid][0], playersFrozenPosition[playerid][1], playersFrozenPosition[playerid][2]);
        GetPlayerFacingAngle(playerid, playersFrozenPosition[playerid][3]);
    }
    else
    {
        playersFrozenPosition[playerid][0] = -65535;
    }
}



Re: Help is needed! - cnoopers - 26.12.2013

When you go, set velocity to 0.0 or clear animations.