[Tutorial] [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry]
#23

Some things are useless tho. The timer, ShotFire, for example isn't needed because you can do this:

pawn Code:
public OnObjectMoved(objectid)
{
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(objectid == gRocketObj[i])
        {
            new
                Float:x,
                Float:y,
                Float:z;

            GetObjectPos(gRocketObj[i], x, y, z);
            CreateExplosion(x, y, z, 11, 3.0);
            DestroyObject(gRocketObj[i]);
            FireShot[i] = 0;
        }
    }
}
Or even better .. You don't need "FireShot". All what you need to check is if the object of the player exists. One less variable then If the player fired the laser, then the object is valid right ?

So you could delete these lines:
pawn Code:
new FireShot[MAX_PLAYERS];

FireShot[playerid] = 1;
SetTimerEx("ShotFire", 1000, 0, "i", playerid);

forward ShotFire(playerid);
public ShotFire(playerid)
{
        FireShot[playerid] = 0;
        return 1;
}
... and it should still work.
Reply


Messages In This Thread
[TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 23.10.2014, 14:52
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Onfroi - 23.10.2014, 16:26
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 23.10.2014, 16:30
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by IDarkness - 23.10.2014, 18:42
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by jamjamnewbie - 24.10.2014, 00:13
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by JaKe Elite - 24.10.2014, 00:18
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 24.10.2014, 09:47
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by GamingPro - 25.10.2014, 13:16
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by ExtremeHostOwner - 25.10.2014, 13:21
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Glossy42O - 25.10.2014, 14:35
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 25.10.2014, 14:58
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by ExtremeHostOwner - 25.10.2014, 15:46
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Slaughters - 25.10.2014, 16:13
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by serdar189 - 25.10.2014, 16:34
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 25.10.2014, 16:44
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Quickie - 26.10.2014, 08:49
AW: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Flori - 26.10.2014, 09:02
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 26.10.2014, 16:48
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Alex Magaсa - 30.10.2014, 14:14
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by iPrivate - 01.11.2014, 17:49
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 01.11.2014, 18:00
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by BornHuman - 02.11.2014, 17:44
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Michael@Belgium - 02.11.2014, 20:50
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 03.11.2014, 05:53
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Arastair - 03.11.2014, 07:37
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Arxalan - 02.01.2015, 03:45
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 02.01.2015, 13:33
Respuesta: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Gryphus One - 17.01.2015, 21:25
Re: Respuesta: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 29.01.2015, 13:50
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Arastair - 29.01.2015, 13:58
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 29.01.2015, 14:34
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Vince - 29.01.2015, 14:50
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 30.01.2015, 14:55
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by lanix - 30.01.2015, 16:51
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by ZcvDev - 31.01.2015, 11:09
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 01.02.2015, 15:54
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by shadowstorm - 05.04.2015, 02:42
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by Rudy_ - 10.04.2015, 08:17
Re: [TuT]How to create a Vehicle Shooting (laser) + Some [Trigonometry] - by ItzRbj - 03.07.2015, 09:45

Forum Jump:


Users browsing this thread: 12 Guest(s)