AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]Problem with Ham (https://forums.alliedmods.net/showthread.php?t=223121)

Randomize 08-10-2013 02:39

[SOLVED]Problem with Ham
 
I'm trying to give all T C4 everytime they spawn using Ham_Spawn but it seems don't work at all, what's wrong? Also when all the T have C4, their C4 don't show on their back?

PHP Code:

public plugin_init()
{
    
register_clcmd("say /c4""give_c4")


PHP Code:

public give_c4(id)
{
    new 
players[32], playersnum
    get_players
(playersplayersnum"e""TERRORIST")
    
    new 
i
    
for (playersnum ; ++i)
    {
        new 
players[i]
        if (
is_user_alive(x))
        {
            
give_item(x"weapon_c4")
            
cs_set_user_plant(x11)
        }
    }


EDIT: SOLVED

ConnorMcLeod 08-10-2013 04:08

Re: [SOLVED]Problem with Ham
 
At new round, players drop their c4, so after you've just given them one.

Black Rose 08-10-2013 04:24

Re: [SOLVED]Problem with Ham
 
Quote:

Originally Posted by Randomize (Post 2009747)
EDIT: SOLVED

Please share the solution so that others can learn from it.

Quote:

Originally Posted by ConnorMcLeod (Post 2009792)
At new round, players drop their c4, so after you've just given them one.

I don't understand.

ConnorMcLeod 08-10-2013 04:30

Re: [SOLVED]Problem with Ham
 
At new round :

1 Players are respawned
2 Players who has a c4 weapon drop them (this is stopping your reloading process when you are reloading)
3 A terrorist is given a c4
4 Ground weapons are removed.

So, give a c4 at spawn has no effect, except for players who has just arrived on server and who spawn outside of the new round process.

Black Rose 08-10-2013 04:36

Re: [SOLVED]Problem with Ham
 
Thanks, now I understand.

Randomize 08-10-2013 05:13

Re: [SOLVED]Problem with Ham
 
Connor, okay thanks for the information, but I have one trouble left. The bot doesn't want to defuse it, they just stay where they stand.
Black Rose: I solve this like this:
PHP Code:

register_logevent("give_c4"2"1=Round_Start"

and

PHP Code:

public give_c4(id)
{
    new 
players[32], playersnum
    get_players
(playersplayersnum"ae""TERRORIST")
    
    for (new 
playersnum ; ++i)
    {
        new 
players[i]
        
give_item(x"weapon_c4")
        
cs_set_user_plant(x11)
        
set_pev(xpev_body1//this is for set the backpack
    
}




All times are GMT -4. The time now is 15:50.

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