CreateExplosion problem...
#1

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
Reply
#2

Maybe you are getting your position and placing the explosion at the same one.
Reply
#3

Try like this:
pawn Код:
new Float: x, y, z;
GetPlayerPos(playerid, x, y, z)
CreateExplosion(x, y+5, z, 1, 10.0);
Reply
#4

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
Reply
#5

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..?
Reply
#6

Use either GetXYInFrontOfPlayer or GetPlayerCameraFrontVector.
Reply
#7

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?
Reply
#8

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);
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)