[Help] Shark Attack
#1

Hi, i have a little script for sharks attack, but this dont work. I dont view the shark, why?

The code is this:
pawn Код:
#include <a_samp>

forward tiburon();
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward ObjectToPoint(Float:radi, tibu, Float:x, Float:y, Float:z);

new CheckTibu;
new tibu1;
new Float:px, Float:py, Float:pz,Float:tx, Float:ty, Float:tz;
new bool: AttackShark[MAX_PLAYERS];

public OnGameModeInit()
{
    tibu1 = CreateObject(1608,2933.6648,-2369.7048,-0.1378,0,0,0);
    CheckTibu = SetTimer("tiburon", 1000, 1);
    return 1;
}

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
public ObjectToPoint(Float:radi, tibu, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetObjectPos(tibu, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
public tiburon()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
      //tiburon 1
        GetObjectPos(tibu1, tx, ty, tz);
        GetPlayerPos(tibu1, px, py, pz);
        if(PlayerToPoint(1.0, i,tx, ty, tz)&& AttackShark[i] == false)
        {
            AttackShark[i] = true;
            SetPlayerHealth(i,0.0);
            MoveObject(tibu1, px, py, pz, 4.0);
        }
        else if(PlayerToPoint(10.0, i,tx, ty, tz)&& AttackShark[i] == false)
        {
          AttackShark[i] = false;
            MoveObject(tibu1, px, py, pz, 4.0);
        }
        else if(ObjectToPoint(1, tibu1, 1481.7092,3031.3877,-5.5186))
        {
            MoveObject(tibu1, 1476.9131,3014.5708,-1.0782, 4.0);
        }
        else if(ObjectToPoint(1, tibu1,1476.9131,3014.5708,-1.0782))
        {
            MoveObject(tibu1, 1481.7092,3031.3877,-5.5186, 4.0);
        }
        //end tiburon 1
    }
}
And other question, how know if player is in sea or not?

Thanx
Reply
#2

bout if player in on sea dunno if theres a state of player swimming, if not you have to create playerinrangeofpoint all over the sea xD
Reply
#3

Quote:
Originally Posted by patchkinson
bout if player in on sea dunno if theres a state of player swimming, if not you have to create playerinrangeofpoint all over the sea xD
How do this? What is the state of "swimming"?

And why i dont view the shark? I put the script in filterscript folder and call, but i dont view the object shark.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)