SA-MP Forums Archive
disable the enter key - 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: disable the enter key (/showthread.php?tid=65473)



disable the enter key - Martin_Smith - 13.02.2009

hey can i make it so that the 'Enter' key is disabled inside a Interior

this is for a casino and i dont want gambling, so please help. lol


Re: disable the enter key - Lazarus - 13.02.2009

I don't think GetPlayerKeys (or OnPlayerKeyStateChange) detects the enter key. Try just putting an object over the gambling machine, so they cant see it, or reach if it they do press enter.


Re: disable the enter key - playdead - 13.02.2009

I suggest you not to use casino interior. Use something else for it, for example make interior like horse racing.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/enter", cmdtext, true, 6) == 0)
	{
		SetPlayerInterior(playerid, interiorid);
		SetPlayerPos(playerid, horse racing interior);
		return 1;
	}
	return 0;
}
I suggest you do it that way


Re: disable the enter key - kazimieras - 13.02.2009

Yes it's possible...

Try this:

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys & KEY_SECONDARY_ATTACK)
	{
		if(!(GetPlayerInterior(playerid) == teh_casino_interior_id)) return 1;
		
		new Float:tmp[3];
		GetPlayerPos(playerid,tmp[0],tmp[1],tmp[2]);
        SetPlayerPos(playerid,tmp[0],tmp[1],tmp[2]);
	}
	return 1;
}
May have typos, untested.


Re: disable the enter key - Martin_Smith - 14.02.2009

Quote:
Originally Posted by KANiS6111
Yes it's possible...

Try this:

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys & KEY_SECONDARY_ATTACK)
	{
		if(!(GetPlayerInterior(playerid) == teh_casino_interior_id)) return 1;
		
		new Float:tmp[3];
		GetPlayerPos(playerid,tmp[0],tmp[1],tmp[2]);
        SetPlayerPos(playerid,tmp[0],tmp[1],tmp[2]);
	}
	return 1;
}
May have typos, untested.
IS "if(newkeys & KEY_SECONDARY_ATTACK)" Line perfect? or do i need to change it?


Re: disable the enter key - beckzy - 14.02.2009

I duno if OnPlayerKeyStateChange is called before or after the key has been pressed. Maybe you could try returning 0 and seeing if it stops the key from being used.


Re: disable the enter key - smallo - 18.02.2009

this wont work. Some of the casinos share the same ID as certain other interiors which have vending machines in it. So the player would get punished for being in those to. There not actually interior ID's there universe ID's and its annoying.


Re: disable the enter key - Norn - 18.02.2009

Quote:
Originally Posted by Martin_Smith
hey can i make it so that the 'Enter' key is disabled inside a Interior

this is for a casino and i dont want gambling, so please help. lol
Use serverside money, then a timer than checks if the serverside money is that of the clientside money, if not then resetplayermoney.

Thus making casino-play impossible.