SA-MP Forums Archive
Player Can't run - 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: Player Can't run (/showthread.php?tid=134695)



Player Can't run - misko28 - 17.03.2010

Is there any way to make player can't run?


Re: Player Can't run - adsy - 17.03.2010

it would take forever getting anywhere then!

Only thing i can think of that might help is using GetPlayerKeyState or something, sorry i cant help any more than this, im not even sure its possible. (someones bound to have a solution)


Re: Player Can't run - Mystique - 17.03.2010

You mean to freeze someone?


Re: Player Can't run - adsy - 17.03.2010

hold alt on the keyboard and you will walk

thats what he means


Re: Player Can't run - Jay_ - 17.03.2010

I'm not sure what you mean directly. However considering this is the scripting boards I'll presume you want to freeze a player, for which you can use TogglePlayerControllable.


Re: Player Can't run - Virtual1ty - 17.03.2010

I'm reckin' something like this would do, but although not tested!
pawn Код:
#include <a_samp>
#define FILTERSCRIPT

forward SetPlayerControllable(playerid);

// HOLDING(keys)
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))

// PRESSED(keys)
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
   
public OnFilterScriptInit() return 1;
public OnFilterScriptExit() return 1;

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
    if(HOLDING(KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT) & (PRESSED(KEY_SPRINT)))
    {
      TogglePlayerControllable(playerid, 0);
      SendClientMessage(playerid, 0xFFFFFFAA, "You are not able to run on this server!");
      SetTimerEx("SetPlayerControllable(playerid)", 2000, 0, "i", playerid);
    }
  }
    return 1;
}

public SetPlayerControllable(playerid)
{
    TogglePlayerControllable(playerid, 1);
}



Re: Player Can't run - misko28 - 17.03.2010

Thanks!!!

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  new tezina = Fishes[playerid][pWeight1] + Fishes[playerid][pWeight2] + Fishes[playerid][pWeight3] + Fishes[playerid][pWeight4] + Fishes[playerid][pWeight5];
	if(tezina > 5)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
		{
  		if(HOLDING(KEY_SPRINT))
  		{
  	  	TogglePlayerControllable(playerid, 0);
  	  	SendClientMessage(playerid, 0xFFFFFFAA, "You can't run with fishes on your neck !");
  	  	SetTimerEx("SetPlayerControllable", 500, 0, "i", playerid);
  		}
  	}
 }
	return 1;
}