how to put an "i" in an area
#1

I already have a job, but I need an "i" or an npc so that I can /getjob. Can anyone teach me how? If you guys suggest NPC, please let the player point to the NPC first then press "Y" in the keyboard in order for the player to get the job. Thanks to any help
Reply
#2

You can use actors, and detect with IsPlayerInRangeOfPoint if the player is near the actor

https://sampwiki.blast.hk/wiki/CreateActor

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#3

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
You can use actors, and detect with IsPlayerInRangeOfPoint if the player is near the actor

https://sampwiki.blast.hk/wiki/CreateActor

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
So, I have an actor and I already made the IsPlayerInRangeOfPoint function. All I need is for the player to aim at the actor and press "Y" in the keyboard for him to accept the job. Thanks
Reply
#4

Why he should aim to get the job lol, about Y you can use OnPlayerKeyStateChange

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

Also Y button is KEY_YES

https://sampwiki.blast.hk/wiki/Keys

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys & KEY_YES)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 10.0, actorX, actorY, actorZ))
		{
			// Get Job
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)