disable the enter key
#1

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
Reply
#2

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.
Reply
#3

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
Reply
#4

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.
Reply
#5

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?
Reply
#6

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.
Reply
#7

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.
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)