[Include] OnPlayerShootPos
#4

Quote:
Originally Posted by Sublime
Посмотреть сообщение
Does it work for vehicle objects? (Not models)
Not sure, but I believe there's an include released for that already.

Quote:
Originally Posted by newbie scripter
Посмотреть сообщение
Nice and awesome, i wanted an include like this, But i don't know how to make one...
It's pretty easy, IMO. You just need to know some basic maths and PAWN knowledge.

Anyways, here's some small code (using this include) that destroys objects upon shooting them:

pawn Код:
public OnPlayerShootPos(playerid, Float:x, Float:y, Float:z, Float:distance)
{
    new Float:fObjectPos[3];

    for (new i = 0; i < MAX_OBJECTS; i ++)
    {
        if (!IsValidObject(i))
            continue;
           
        GetObjectPos(i, fObjectPos[0], fObjectPos[1], fObjectPos[2]);
       
        fObjectPos[0] -= x;
        fObjectPos[1] -= y;
        fObjectPos[2] -= z;

        if ((fObjectPos[0] * fObjectPos[0]) + (fObjectPos[1] * fObjectPos[1]) + (fObjectPos[2] * fObjectPos[2]) < 40.0)
        {
            DestroyObject(i);
            break;
        }
    }
    return 1;
}
Reply


Messages In This Thread
OnPlayerShootPos - by Emmet_ - 01.12.2013, 06:31
Re: OnPlayerShootPos - by newbie scripter - 01.12.2013, 06:37
Re: OnPlayerShootPos - by Sublime - 01.12.2013, 06:42
Re: OnPlayerShootPos - by Emmet_ - 01.12.2013, 06:46
Re: OnPlayerShootPos - by iZN - 01.12.2013, 06:46
Re: OnPlayerShootPos - by Pottus - 01.12.2013, 06:52
Re: OnPlayerShootPos - by Emmet_ - 01.12.2013, 06:57
Re: OnPlayerShootPos - by Pottus - 01.12.2013, 07:00
Re: OnPlayerShootPos - by Gen3i - 01.12.2013, 07:05
Re: OnPlayerShootPos - by Voxel - 01.12.2013, 07:33

Forum Jump:


Users browsing this thread: 1 Guest(s)