AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Anti-Frost question (https://forums.alliedmods.net/showthread.php?t=195731)

malec321 09-10-2012 21:01

[HELP] Anti-Frost question
 
Code:

                                case 6: // anti frost
                {
                        if( !is_user_alive( id ) )
                        {
                                return PLUGIN_HANDLED;
                        }
                        if(userantifrost[id] > 0)
                        {
                                return PLUGIN_HANDLED;
                        }
                        new money = cs_get_user_money( id )
                        new cost = get_pcvar_num( antifrost )
                        if ( money >= cost )
                        {
                                cs_set_user_money( id, money - cost )
                                add_user_immune(id)
                                userantifrost[id]++;
                        }
                        else
                        {
                                client_print_color( id, Green, "[Shop] You need more money to buy this item!" );                        }

Okay so as of now judging by the looks of it, I have the anti frost working when bought, adds the immune which are natives which are put at the top of the code.

My problem is that I want to reset it on death and round end to remove_user_immune(id)

Any help would be highly appreciated!

Thanks!

EDIT:

Code:

                        if(userantifrost[id] > 0)
                        {
                                return PLUGIN_HANDLED;
                        }

If I added the remove_user_immunity(id); before the return PLUGIN_HANDLED; would that do the trick?
EDIT 2: NVM just realized how stupid that sounds ^

Code:

public client_connect( id )
{
        userantifrost[id]                =0;
}

public client_disconnect( id )
{
        userantifrost[id]                =0;
}

public eDeath( id )
{
        new victim = read_data(2);

        userantifrost[victim]                =0;
}


malec321 09-11-2012 17:11

Re: [HELP] Anti-Frost question
 
Wow lmao nvm, its not as hard as I thought it was -_-


All times are GMT -4. The time now is 08:21.

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