Object hit a player giving 2 reps
#1

Hey,i am making a system,but i need help,i want to make an object,when i click on Z it throws a ball ,how can i make the ball keep moving forward till it hit a player,and when it hit a player it grts destroyed,like when i click on Z it makes an object and moves it forward with the same float Z,just moves forward and destroys when it hit a player,how to detect if it hits a player?
Giving 2 reps
Reply
#2

Well...
1) get the player's coords
2) create a ball object at those coords that moves towards the direction you are facing
3) create a timer that checks the area around the ball, if another player is in that area the ball disappears

It sounds difficult, but I think you get the point.
Reply
#3

how could i get the direction i am facing ,i mean how to let it move forward?
Reply
#4

GetXYInFrontOfPlayer(playerid, &Float, &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


Forum Jump:


Users browsing this thread: 1 Guest(s)