[Include] Arrows
#1

Hello everyone iv'e created Arrows.inc basically what it does it created an arrow like gta sa default interior yellow arrow but in this this include you can create arrow in other color

1. RED
2. GREEN
3. BLUE

you can create them anywhere at any interior and at any virtual world.

Functions:
CreateArrow(arrowid, playerid = -1, ARROW_COLOR, Float:х, Float:y, Float:z, interior = 0, virtual_world = 0, Float:tox, Float:toy, Float:toz, tointerior = 0, tovirtual_world = 0, Floattream_distance); creating arrow can be created for specific players and can be created for all players


DoesArrowExist(arrowid); checks if arrow exist

DestroyArrow(arrowid); destroying specific arrow

DestroyAllArrows(); destroying all arrows



Arrow color types:

ARROW_RED arrow color red

ARROW_GREEN arrow color green

ARROW_BLUE arrow color blue





CallBack:
Arrow_OnPlayerTeleport(playerid, arrowid) used when player teleported


Video: http://www.youtube.com/watch?v=r-EMKVGHPA4


Pastebin (Inc): https://pastebin.com/fgUzQDmi

Pastebin (example fs): https://pastebin.com/MFeDRdur

Pastebin (example fs 2): https://pastebin.com/dhKDK9B9



Credits to:

WhatName(me) for Arrows

Incognito for streamer

SA-MP TEAM for a_samp
Reply
#2

Useless
Reply
#3

maybe for you, some may like it
Reply
#4

Nice It can be used for his purpose
Reply
#5

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

Good to know that makes a lot more sense!
Reply
#8

It would be cool if the arrows moved like in singleplayer.
Reply
#9

@pottus
Код:
I_ARROW[arrowid][arw_areaid] = CreateDynamicSphere(-9999, -9999, -9999, -9999);
ohhh sorry so stupid of me and thx for the suggestions i will work on it
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)