Help with Dynamic Pickups and OnPlayerPickUpDynamicPickup
#1

So, I currently have a system for my Greek SAMP Server where an admin can create doors, how am I supposed to make it on OnPlayerPickUpDynamicPickup to check the coordinates of the door that he picked up? Any simple tutorial maybe? Just something quick with a few lines, I might get it. If I make it with OnPlayerInRangeOfPoint and check which door is nearby he will enter there but once he exits he will enter back into the building cause the player spawns at the same location.
Reply
#2

You could use ID's for each door instead of checking the positions, that way you can simply check at what door id they are and get the position of the door id
Reply
#3

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
You could use ID's for each door instead of checking the positions, that way you can simply check at what door id they are and get the position of the door id
So it could be pickupid == DoorInfo[x][dPickup], it worked this way but there's a little problem, when you exit it teleports you back, is there any way to prevent such a thing? I was thinking to add something like +2 to a certain position but that may bug the player in certain places so I would like to avoid that.
Reply
#4

Quote:
Originally Posted by dionisak0s
Посмотреть сообщение
So it could be pickupid == DoorInfo[x][dPickup], it worked this way but there's a little problem, when you exit it teleports you back, is there any way to prevent such a thing? I was thinking to add something like +2 to a certain position but that may bug the player in certain places so I would like to avoid that.
Teleports you back? Do you immediately set the player's position once the pickup has been picked up? If so you could try getting XY infront of the pickup (GetXYInfrontOfPlayer while making the pickup) And set the exit position to the position infront of the pickup.

Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);
	if (GetPlayerVehicleID(playerid))
	{
	  GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	}
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
}
Reply
#5

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Teleports you back? Do you immediately set the player's position once the pickup has been picked up? If so you could try getting XY infront of the pickup (GetXYInfrontOfPlayer while making the pickup) And set the exit position to the position infront of the pickup.

Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);
	if (GetPlayerVehicleID(playerid))
	{
	  GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	}
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
}
Let's hope this is going to work, and yes the interior and the exterior are where the pickups are located cause they are dynamic used by /enter and /exit currently but I want to make it easier for players to enter/exit interiors without typing any command.
Reply
#6

Quote:
Originally Posted by dionisak0s
Посмотреть сообщение
Let's this is going to work, and yes the interior and the exterior are where the pickups are located cause they are dynamic used by /enter and /exit currently but I want to make it easier for players to enter/exit interiors without typing any command.
If you want to make it easier for players, try adding a keybind to it. I myself use "H" as a /enter and /exit bind, though I keep the actual commands still there in case others prefer typing it/ use their own key binds

You don't have to use what I wrote, but if you want I could help you with your code if you write your door creating/finishing command here.
Reply
#7

It all depends on your door system, I use a dialog to select an option, and with the enter/exit position I use /finish, that's where the position of the door is set, what type of system do you have?
Reply
#8

Alright so I made this little drawing (bear in mind im on a phone)
Orange with red indicates a building, red indicates stairs, yellow is a door pickup and green is you, arrow is the direction youre facing

(its crap, i know)

Lets say you make the door at that yellow dot, and want people to exit at the green dot(you), you have to face the door, getxyinfront of player BUT with a distance of minus two(or 1,3 r w/e) and set that to the exit position.

So after you've got the position, make it like this

Код:
GetPlayerPos(playerid, x, y, z);
GetXYInfrontOfPlayer(playerid, x, y, -2);
DoorInfo[doorid][ExitPosx] = x;
and so on
Reply
#9

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Alright so I made this little drawing (bear in mind im on a phone)
Orange with red indicates a building, red indicates stairs, yellow is a door pickup and green is you, arrow is the direction youre facing

(its crap, i know)

Lets say you make the door at that yellow dot, and want people to exit at the green dot(you), you have to face the door, getxyinfront of player BUT with a distance of minus two(or 1,3 r w/e) and set that to the exit position.

So after you've got the position, make it like this

Код:
GetPlayerPos(playerid, x, y, z);
GetXYInfrontOfPlayer(playerid, x, y, -2);
DoorInfo[doorid][ExitPosx] = x;
and so on
I didn't get it, if I do such a thing it will then save the pickup at the green dot and that means the pickup will be there, I just want to use GetXYInfrontOfPlayer when a player enters/exits a building and just move them just 2-3 meters forward
Reply
#10

Quote:
Originally Posted by dionisak0s
Посмотреть сообщение
I didn't get it, if I do such a thing it will then save the pickup at the green dot and that means the pickup will be there, I just want to use GetXYInfrontOfPlayer when a player enters/exits a building and just move them just 2-3 meters forward
That can do, basically what I said was move the position that players get tped to when they exit back a little using getxyinfrontofplayer
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)