CreateExplosion problem... -
CesarLT - 05.10.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
Re: CreateExplosion problem... -
x96664 - 05.10.2013
Maybe you are getting your position and placing the explosion at the same one.
Re: CreateExplosion problem... -
Areax - 05.10.2013
Try like this:
pawn Код:
new Float: x, y, z;
GetPlayerPos(playerid, x, y, z)
CreateExplosion(x, y+5, z, 1, 10.0);
Re: CreateExplosion problem... -
CesarLT - 05.10.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
Re: CreateExplosion problem... -
CesarLT - 05.10.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..?
Re: CreateExplosion problem... -
Vince - 05.10.2013
Use either GetXYInFrontOfPlayer or GetPlayerCameraFrontVector.
Re: CreateExplosion problem... -
CesarLT - 05.10.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?
Re: CreateExplosion problem... -
Konstantinos - 05.10.2013
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);
Re: CreateExplosion problem... -
CesarLT - 05.10.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.