Posts: 512
Threads: 121
Joined: Sep 2013
I was wondering if this is possible?
Create a cannon object (might be a customized heat-seeker rocket or minigun) when player press F key (or ALT key). He will attached to that object and cannot be moved (Only the cursor or mouse will work to target the enemy) just like a anti-aircraft.
EDIT: I know there is an anti-aircraft but it's a missile. and I was referring to cannon that explodes in the air.
Posts: 512
Threads: 121
Joined: Sep 2013
thanks but not this. OR maybe i'm not good enough to make a script similar to this.
Posts: 1,534
Threads: 129
Joined: Jan 2012
Reputation:
0
Yes, it is possible with GetPlayerCameraFrontVector
Posts: 512
Threads: 121
Joined: Sep 2013
Quote:
Originally Posted by newbienoob
Yes, it is possible with GetPlayerCameraFrontVector
|
thanks I think it's becoming clear now. So I found this on sa-mp wiki. So how about if I will change the hydra missile to explosion. How do I do that? Also from left of the football field to right before the explosion.
Код:
// A simple command to manipulate this vector using the
// positions from GetPlayerCameraPos. This command will create
// a hydra missile in the direction of where the player is looking.
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/test camera vector"))
{
new
Float:fPX, Float:fPY, Float:fPZ,
Float:fVX, Float:fVY, Float:fVZ,
Float:object_x, Float:object_y, Float:object_z;
// Change me to change the scale you want. A larger scale increases the distance from the camera.
// A negative scale will inverse the vectors and make them face in the opposite direction.
const
Float:fScale = 5.0;
GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
object_x = fPX + floatmul(fVX, fScale);
object_y = fPY + floatmul(fVY, fScale);
object_z = fPZ + floatmul(fVZ, fScale);
CreateObject(345, object_x, object_y, object_z, 0.0, 0.0, 0.0);
return 1;
}
return 0;
}
Posts: 512
Threads: 121
Joined: Sep 2013
Can you please give me idea or a simple script demo on how to do this?
A player who is able to use his mouse cursor to aim the enemy while he is standing with the cannon?
Posts: 512
Threads: 121
Joined: Sep 2013
Thanks Rajat but actually i'm not doing a rocket that follows the airlcrafts. What I suppose to do is a FLAK CANNON. I would probably using GetPlayerCameraFrontVector for this.
Do you know how do I get the distance of a player above the clouds?
For sure i'm going to use CreateExplosion as my flak cannon explosion.