Posts: 716
Threads: 92
Joined: May 2018
I have a drug system, but needs some tweaks. Actually players can plant even in air, how to resolve this?
pawn Код:
CMD:plant(playerid, params[])
{
Plant_Create(playerid, 1);
return 1;
}
Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
For a simple solution use GetPlayerVelocity and calculate the velocity vector using VectorSize.
It's extremely unlikely that someone is mid-air without any velocity, as they will fall or at least move.
Furthermore only allow planting on-foot.
For a better and reliable solution use MapAndreas or ColAndreas, this also lets you adjust the plant's position so that it's always perfectly on the ground (even with rotation, if using CA).
Posts: 716
Threads: 92
Joined: May 2018
Do you mind giving me some example code?
Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
For what exactly? The velocity or MapAndreas/ColAndreas?
Posts: 716
Threads: 92
Joined: May 2018
The velocity, to check if player is in air.
Posts: 716
Threads: 92
Joined: May 2018
Thank you both! I hope to resolve this problem.