[Include] Arrows
#6

I am going to suggest you add some more features this is actually a good idea for a system but could be a lot better.

- You can attach objects to objects that have special properties (rotating objects) and there may be others with interesting effects (styles)
- Create update functions to set position / color / style
- Update to use iterators
Код:
         for(new i = 0; i < MAX_ARROWS;i++)
         if(DoesArrowExist(i))
- Either add an option or always to do it when teleporting https://sampwiki.blast.hk/wiki/SetCameraBehindPlayer
- An arrow editor (dialogs/admin only)
- Save created arrows to file (loadable) leave option to create them with code as well
- Why on earth would you create anything in a destroy function?
Код:
I_ARROW[arrowid][arw_areaid] = CreateDynamicSphere(-9999, -9999, -9999, -9999);
- You can safely remove all of this code it does nothing
Код:
     I_ARROW[arrowid][arw_posx] = -9999;
     I_ARROW[arrowid][arw_posy] = -9999;
     I_ARROW[arrowid][arw_posz] = -9999;
     I_ARROW[arrowid][arw_interior] = -1;
     I_ARROW[arrowid][arw_virtual_world] = -1;
- Your create function is written with a fatal flaw
Код:
stock CreateArrow(arrowid, playerid = -1, ARROW_COLOR, Float:x, Float:y, Float:z, interior = 0, virtual_world = 0, Float:tox, Float:toy, Float:toz, tointerior = 0, tovirtual_world = 0, Float:stream_distance)
{
     if(DoesArrowExist(arrowid)) return printf("Arrow.inc: Arrow exist.");
- Do it like this DoesArrowExist() is a bad choice
Код:
stock CreateArrow(playerid = -1, ARROW_COLOR, Float:x, Float:y, Float:z, interior = 0, virtual_world = 0, Float:tox, Float:toy, Float:toz, tointerior = 0, tovirtual_world = 0, Float:stream_distance)
{
	new index;
	for(index = 0; index < MAX_ARROWS; index++)
	{
	    if(!I_ARROW[index][arw_exist])
	        break;
	}
- Or better yet!
Код:
stock CreateArrow(playerid = -1, ARROW_COLOR, Float:x, Float:y, Float:z, interior = 0, virtual_world = 0, Float:tox, Float:toy, Float:toz, tointerior = 0, tovirtual_world = 0, Float:stream_distance)
{
	new index;
	index = Iter_Free(Arrow_Iter);
	if(index > -1)
	{
		Iter_Add(Arrow_Iter, index);
		// Code Here
		return index;
	}
	printf("ERROR::CreateArrow()::Array Full");
	return -1;
}
If you take the time to make the changes I suggest I will have no choice but to give 5-stars as it stands now though this isn't any better that a 2-Star piece of work.
Reply


Messages In This Thread
Arrows - by Whatname - 17.06.2017, 13:04
Re: Arrows - by Nominal - 17.06.2017, 13:21
Re: Arrows - by Whatname - 17.06.2017, 13:28
Re: Arrows - by ghostbalkan - 17.06.2017, 13:46
Re: Arrows - by Whatname - 17.06.2017, 13:48
Re: Arrows - by Pottus - 17.06.2017, 14:03
Re: Arrows - by Pottus - 17.06.2017, 16:43
Re: Arrows - by IllidanS4 - 18.06.2017, 11:35
Re: Arrows - by Whatname - 18.06.2017, 14:42

Forum Jump:


Users browsing this thread: 3 Guest(s)