AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   amx_fire cvar for catching people on fire (https://forums.alliedmods.net/showthread.php?t=56170)

bmann_420 06-07-2007 23:05

amx_fire cvar for catching people on fire
 
I dont know where to add or how to add a cvar ( I tried) to make it where you can 1 = catch people on fire, 0 = you cant. Something like this:
Code:

public ignite_player(skIndex[])  {
        new kIndex = skIndex[0]

        if (is_user_alive(kIndex) && onfire[kIndex] )    {
                new korigin[3]
                new players[32], inum = 0
                new pOrigin[3]
                new kHeath = get_user_health(kIndex)
                get_user_origin(kIndex,korigin)

                //create some damage
                set_user_health(kIndex,kHeath - 10)
                message_begin(MSG_ONE, gmsgDamage, {0,0,0}, kIndex)
                write_byte(30) // dmg_save
                write_byte(30) // dmg_take
                write_long(1<<21) // visibleDamageBits
                write_coord(korigin[0]) // damageOrigin.x
                write_coord(korigin[1]) // damageOrigin.y
                write_coord(korigin[2]) // damageOrigin.z
                message_end()

                //create some sound
                emit_sound(kIndex,CHAN_ITEM, "ambience/flameburst1.wav", 0.6, ATTN_NORM, 0, PITCH_NORM)

                //Ignite Others
                get_players(players,inum,"a")
                for(new i = 0 ;i < inum; ++i)  {
                        get_user_origin(players[i],pOrigin)
                        if( get_distance(korigin,pOrigin) < 100  )  {
                                if( !onfire[players[i]] )  {
                                        new spIndex[2]
                                        spIndex[0] = players[i]
                                        new pName[32], kName[32]
                                        get_user_name(players[i],pName,31)
                                        get_user_name(kIndex,kName,31)
                                        emit_sound(players[i],CHAN_WEAPON ,"scientist/scream07.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
                                        client_print(0,3,"%L", LANG_PLAYER, "AMX_SUPER_FIRE_SPREAD",kName,pName)
                                        onfire[players[i]] =1
                                        ignite_player(players[i])
                                        ignite_effects(players[i])
                                }
                        }
                }

                players[0] = 0
                pOrigin[0] = 0
                korigin[0] = 0

                //Call Again in 2 seconds
                set_task(2.0, "ignite_player" , 0 , skIndex, 2)
        }
        return PLUGIN_CONTINUE
}


public admin_fire(id,level,cid) {
        if (!cmd_access(id,level,cid,2))
                return PLUGIN_HANDLED

        new arg[32]
        read_argv(1,arg,31)

        new victim = cmd_target(id,arg,7)
        if (!victim)
                return PLUGIN_HANDLED

        new skIndex[2]
        skIndex[0] = victim
        new name[32], victimauthid[36]
        get_user_name(victim,name,31)
        get_user_authid(victim,victimauthid,35)

        onfire[victim] = 1
        ignite_effects(skIndex)
        ignite_player(skIndex)

        new adminname[32], adminauthid[36]
        get_user_name(id,adminname,31)
        get_user_authid(id,adminauthid,35)

        switch(get_cvar_num("amx_show_activity"))  {

Tried
Code:

        //create some sound
                emit_sound(kIndex,CHAN_ITEM, "ambience/flameburst1.wav", 0.6, ATTN_NORM, 0, PITCH_NORM)

                //Ignite Others
                if(!get_pcvar_num(allowcatchfire) == 1)
                        return PLUGIN_CONTINUE
               
                get_players(players,inum,"a")
                for(new i = 0 ;i < inum; ++i)  {
                        get_user_origin(players[i],pOrigin)
                        if( get_distance(korigin,pOrigin) < 100  )  {
                                if( !onfire[players[i]] )  {
                                        new spIndex[2]
                                        spIndex[0] = players[i]
                                        new pName[32], kName[32]
                                        get_user_name(players[i],pName,31)
                                        get_user_name(kIndex,kName,31)
                                        emit_sound(players[i],CHAN_WEAPON ,"scientist/scream07.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
                                        client_print(0,3,"%L", LANG_PLAYER, "AMX_SUPER_FIRE_SPREAD",kName,pName)
                                        onfire[players[i]] =1
                                        ignite_player(players[i])
                                        ignite_effects(players[i])

I know its in the wrong spot, and it screws with everyhting else. So im lost and sorry if this was answered before, I also searched :D
(possibly turn it into a while loop?)

djmd378 06-07-2007 23:43

Re: amx_fire cvar for catching people on fire
 
I thought amx_fire already included a cvar to allow you to catch other people on fire or not. (I'm talking about the independent version, not the one included with amx_super)

bmann_420 06-07-2007 23:45

Re: amx_fire cvar for catching people on fire
 
THe one included in teh amx_super is the origional independant version by f117. Unless your refering to another version, which i would love to see.

djmd378 06-07-2007 23:56

Re: amx_fire cvar for catching people on fire
 
1 Attachment(s)
This should work. I didn't test it though.

CVAR:
amx_fire_others <1 = On/0 = off>

bmann_420 06-08-2007 00:05

Re: amx_fire cvar for catching people on fire
 
I just got it :D (I think not tested)
Code:

                //Ignite Others
                if ( get_pcvar_num(allowcatchfire)==1)    {     
                        get_players(players,inum,"a")
                       
                        for(new i = 0 ;i < inum; ++i)  {                           
                                get_user_origin(players[i],pOrigin)
                               
                                if( get_distance(korigin,pOrigin) < 100  )  {
                                       
                                        if( !onfire[players[i]] )  {
                                               
                                                new spIndex[2]
                                                spIndex[0] = players[i]
                                                new pName[32], kName[32]               
                                                get_user_name(players[i],pName,31)
                                                get_user_name(kIndex,kName,31)
                                                emit_sound(players[i],CHAN_WEAPON ,"scientist/scream07.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
                                                client_print(0,3,"* [AMX] OH! NO! %s has caught %s on fire!",kName,pName)
                                                onfire[players[i]] =1
                                                ignite_player(players[i])
                                                ignite_effects(players[i])   
                                        }               
                                }
                        }         
                        players[0] = 0
                        pOrigin[0] = 0               
                        korigin[0] = 0     
                }
                //Call Again in 2 seconds     
                set_task(2.0, "ignite_player" , 0 , skIndex, 2)     
        }   
       
        return PLUGIN_CONTINUE
}


bmann_420 06-08-2007 02:04

Re: amx_fire cvar for catching people on fire
 
THe one i posted only works if you have it enabled.

I'll try yours

Well yours is exactly the same except )) instead of )==1)

bmann_420 06-08-2007 02:14

Re: amx_fire cvar for catching people on fire
 
And that did it. THankx :D


All times are GMT -4. The time now is 10:30.

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