AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   weapon_c4 at round start (https://forums.alliedmods.net/showthread.php?t=164324)

katna 08-10-2011 05:31

weapon_c4 at round start
 
i'm trying to save the c4 entity id in a global variable but when the round start, instead of getting one "weapon_c4", i got 2 entity of c4 bombs... my question is, why do i get 2 of them ( at any map ) and which one is the real one...

at round start event. the code is only for checking why do i get 2
gBomb is returning the first c4 id but why there are 2 weapon_c4
Code:

gBomb = engfunc(EngFunc_FindEntityByString, -1, "classname", "weapon_c4")
        if (!gBomb)       
                return

Code:

        new EntClass[32]
        new Entity
        new Float:fOrigin[3]
        pev(1, pev_origin, fOrigin)
        while((Entity = engfunc (EngFunc_FindEntityInSphere, Entity, fOrigin, -1)))
        {
                pev(Entity, pev_classname, EntClass, 31)
                ColorChat(0, "Entity id: %d, Entity class: %s", Entity, EntClass)
        }


Arkshine 08-10-2011 05:51

Re: weapon_c4 at round start
 
Start to explain what you want to do exactly.

katna 08-10-2011 06:30

Re: weapon_c4 at round start
 
i just need the c4 entity id at every round start. but instead of getting one weapon_c4 entity as it should be ( i suppose ), i got 2 of them

Hunter-Digital 08-10-2011 07:54

Re: weapon_c4 at round start
 
He meant what you really want to do with that c4 entity, why do you need it ?

Because the c4 is tricky and you might go at this all wrong... for example, the placed c4 has "grenade" classname.

katna 08-10-2011 08:00

Re: weapon_c4 at round start
 
no, the c4 isn't going to be planted at all. i just need the c4 id because, of a few thing

- Glow c4 ( i know i don't need his specific id to glow it )
- Give a specifi player the c4 if it is dropped on the floor.

And i need the c4 id in a global var for later uses

Doc-Holiday 08-10-2011 08:03

Re: weapon_c4 at round start
 
Have you looked at any of this??

https://forums.alliedmods.net/showth...highlight=bomb

katna 08-10-2011 08:10

Re: weapon_c4 at round start
 
Quote:

Originally Posted by Doc-Holiday (Post 1529502)

yes, my problem is when i'm using this at round start event

Code:

new bomb = fm_find_ent_by_class(-1, "weapon_c4")
i get 2 weapon_c4 instead of one

Doc-Holiday 08-10-2011 08:14

Re: weapon_c4 at round start
 
Have you tried doing it at playerspawn??
and you can use
PHP Code:

#define fm_find_ent_by_class(%1,%2) engfunc( EngFunc_FindEntityByString, %1, "classname", %2 ) 

instead of the fakemeta_util i was told its very slow.

katna 08-10-2011 08:39

Re: weapon_c4 at round start
 
i think i got a solution but, can i use
Code:

fm_transfer_user_gun(0, id, CSW_C4)
to give the c4 to a player from the ground?

Doc-Holiday 08-10-2011 08:46

Re: weapon_c4 at round start
 
Quote:

Originally Posted by katna (Post 1529524)
i think i got a solution but, can i use
Code:

fm_transfer_user_gun(0, id, CSW_C4)
to give the c4 to a player from the ground?

You can find who has the c4 using fm util and make the person switch and drop it.


All times are GMT -4. The time now is 03:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.