Posts: 265
Threads: 59
Joined: Sep 2013
Hello everyone, I am willing to make a system, that if the player hits the fire button, there will be create explosion infront of him, I succeed creating an exlosion, but it explodes myself. And I got no idea how to make that explode infront of me. :O
Posts: 591
Threads: 70
Joined: Jun 2009
Reputation:
0
Maybe you are getting your position and placing the explosion at the same one.
Posts: 265
Threads: 59
Joined: Sep 2013
Quote:
Originally Posted by x96664
Maybe you are getting your position and placing the explosion at the same one.
|
I am but that's a different thing, I am asking how to make a new function which will create the explosion in front of me
Posts: 265
Threads: 59
Joined: Sep 2013
Quote:
Originally Posted by Areax
Try like this:
pawn Код:
new Float: x, y, z; GetPlayerPos(playerid, x, y, z) CreateExplosion(x, y+5, z, 1, 10.0);
|
pawn Код:
if(newkeys & KEY_FIRE)
{
new Float: x, y, z;
GetPlayerPos(playerid, x, y, z);
CreateExplosion(x, y+5, z, 1, 10.0);
}
I am getting a tag mismatch warning at the GetPlayerPos, I don't know why..?
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Use either GetXYInFrontOfPlayer or GetPlayerCameraFrontVector.
Posts: 265
Threads: 59
Joined: Sep 2013
Quote:
Originally Posted by Vince
Use either GetXYInFrontOfPlayer or GetPlayerCameraFrontVector.
|
0.0 wut?
I forgot to mention that I am new to scripting, could you give me a quick guide through it, or show me the usage please?
Posts: 265
Threads: 59
Joined: Sep 2013
Quote:
Originally Posted by Konstantinos
You can ****** it, I'm sure you're going to find many results.
pawn Код:
stock 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)); }
Example:
pawn Код:
new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); GetXYInFrontOfPlayer(playerid, x, y, 5.0); CreateExplosion(x, y, z, 1, 10.0);
|
Thanks I checked ****** and I saw the stock, I just didn't understand the usage.