[AMXX-ECX]Respawn Dragonballs

New Member
✔️ HL Verified
🚂 Steam Linked
Discord Member
Joined
Dec 7, 2007
Messages
12
Best answers
0
Hi all, I decided to make a plugin that respawns the dragonballs (to use for example when a player throws them out of the map), I wrote this function:

PHP:
public respawn( id, level, cid )
{
	if( get_pcvar_num( CvarEnable ) )
	{

	     for( new i=0; i<=6; i++ )
            RemoveDragonball( i );

	     for( new i=0; i<=6; i++ )
	        CreateDragonball( i );
	       
         SpawnDragonballs( );
	}
	else
	   console_print( id, "SpawnDB is disabled!" )
	return PLUGIN_HANDLED
}
but the dragonballs are respawned in a "random" point of the map.
How do I set the point at which they should be respawned? This is my first plugin and I don't have much experience with this language.
I am sorry for my bad english
Thanks in advance :)
 
NOT IN THE MANGA™
★ Black Lounger ★
✔️ HL Verified
🚂 Steam Linked
💻 Oldtimer
Joined
Jan 5, 2008
Messages
3,276
Best answers
0
According to CCI CreateDragonball() returns entity ID, so you should be able to use it to teleport dragonballs to whereever you like. For that, use entity_set_origin().
PHP:
new entity = CreateDragonball(i);

// entity_set_origin(entity, Float:{x, y, z});
This will spawn 7 dragonballs right under the player:
PHP:
new Float:origin[3];
entity_get_vector(id, EV_VEC_origin, origin);

new i, ents[7];

for (; i < 7; i++)
{
	RemoveDragonball(i);

	ents[i] = CreateDragonball(i);
}

SpawnDragonballs();

i = 0;

for (new ent; i < 7; i++)
{
	ent = ents[i];

	entity_set_origin(ent, origin);
	drop_to_floor(ent);
}
 
Last edited:
New Member
✔️ HL Verified
🚂 Steam Linked
Discord Member
Joined
Dec 7, 2007
Messages
12
Best answers
0
Perfect, it works, it's just what I wanted. Thank you very much :)
 

Users who are viewing this thread

Top