AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Delay script with 10 seconds (https://forums.alliedmods.net/showthread.php?t=187995)

erkz 06-20-2012 19:11

Delay script with 10 seconds
 
Is it possible to delay this script with 10 secons? It runs on the start of every rounds. I have Hide N' Seek plugin which drops/delete all weapons on the start of every round, so it doesn't work well together. Tips?

Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>

#define WAIT 0.1

new PLUG[] = "HNSExtras"
new VERS[] = "1.2"
new AUTH[] = "Stewie!"

new hnse_on;

new awp_on;
new fiveseven_on;
new deagle_on;
new scout_on;
new nade_on;

public plugin_init()
{
        register_plugin(PLUG, VERS, AUTH);
        register_cvar("HNSExtras", VERS, FCVAR_SERVER|FCVAR_UNLOGGED);
       
        register_logevent("round_start", 2, "1=Round_Start");
       
        register_forward(FM_ClientKill, "client_kill")
       
        hnse_on = register_cvar("hnse_on", "1");
       
        awp_on = register_cvar("hnse_awp_on", "1", ADMIN_ADMIN);
        fiveseven_on = register_cvar("hnse_fiveseven_on", "1", ADMIN_ADMIN);
        deagle_on = register_cvar("hnse_deagle_on", "1", ADMIN_ADMIN);
        scout_on = register_cvar("hnse_scout_on", "1", ADMIN_ADMIN);
        nade_on = register_cvar("hnse_nade_on", "1", ADMIN_ADMIN);
}

public round_start()
{
        set_task(WAIT, "strip")
}

public strip()
{
        if(get_pcvar_num(hnse_on))
        {
                new players[32], num;
                get_players(players, num, "ah");
                new player;
                for(new i = 0; i < num; i++)
                {
                        player = players[i];
                       
                        fm_strip_user_weapons(player);
                        cs_set_user_money(player, 0);
                        fm_give_item(player, "weapon_knife");
                }
        }
        set_task(WAIT, "weapon_chance");
}

public weapon_chance()
{
        new Players[32], playerCount, i, id;
        get_players(Players, playerCount, "ah");
        for(i=0; i<playerCount; i++)
        {
                id = Players[i];
               
                new number = random_num(0, 100);
               
                switch(number)
                {
                        case 1 .. 5:
                        {
                                if(get_pcvar_num(scout_on))
                                {
                                        new scout = fm_give_item(id, "weapon_scout");
                                        cs_set_user_bpammo(id, CSW_SCOUT, 0);
                                        cs_set_weapon_ammo(scout, 1);
                                        client_print(id, print_chat, "[5%%] You have been awarded a scout with 1 bullet!");
                                }
                        }
                        case 6 .. 15:
                        {
                                if(get_pcvar_num(deagle_on))
                                {
                                        new deagle = fm_give_item(id, "weapon_deagle");
                                        cs_set_user_bpammo(id, CSW_DEAGLE, 0);
                                        cs_set_weapon_ammo(deagle, 2);
                                        client_print(id, print_chat, "[10%%] You have been awarded a deagle with 2 bullets!");
                                }
                        }
                        case 16 .. 20:
                        {
                                if(get_pcvar_num(fiveseven_on))
                                {
                                        new fiveseven = fm_give_item(id, "weapon_fiveseven");
                                        cs_set_user_bpammo(id, CSW_FIVESEVEN, 0);
                                        cs_set_weapon_ammo(fiveseven, 3);
                                        client_print(id, print_chat, "[5%%] You have been awarded a fiveseven with 3 bullets!");
                                }
                        }
                        case 21 .. 22:
                        {
                                if(get_pcvar_num(awp_on))
                                {
                                        new awp = fm_give_item(id, "weapon_awp");
                                        cs_set_user_bpammo(id, CSW_AWP, 0);
                                        cs_set_weapon_ammo(awp, 1);
                                        client_print(id, print_chat, "[1%%] You have been awarded an awp with 1 bullet!");
                                }
                        }
                        case 23 .. 37:
                        {
                                if(get_pcvar_num(nade_on))
                                {
                                        new nade = fm_give_item(id, "weapon_hegrenade");
                                        cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
                                        cs_set_weapon_ammo(nade, 1);
                                        client_print(id, print_chat, "[15%%] You have been awarded a HE grenade!")
                                }
                        }
                        case 38 .. 100:
                        {
                                client_print(id, print_chat, "You have not been awarded any items");
                        }
                }
        }
}

public client_kill(id)
{
        if(is_user_alive(id))
        {
                console_print(id, "You cannot kill yourself at this moment in time!");
               
                return PLUGIN_HANDLED;
        }
        else
        {
                console_print(id, "You can only kill yourself when you are alive!")
               
                return PLUGIN_HANDLED;
        }
       
        return PLUGIN_CONTINUE;
}


YamiKaitou 06-20-2012 19:14

Re: Delay script with 10 seconds
 
Modify the time in the set_task

erkz 06-21-2012 11:21

Re: Delay script with 10 seconds
 
Can you please show me? :)

Exolent[jNr] 06-21-2012 11:36

Re: Delay script with 10 seconds
 
You're in Scripting Help. You should be able to change the time of a task.

If you do not know how to code, then the topic will be moved to Suggestions/Requests where you should post your topics from then on out.

Backstabnoob 06-21-2012 14:14

Re: Delay script with 10 seconds
 
A small hint:
Code:
#define WAIT 0.1

Waleed 06-21-2012 14:29

Re: Delay script with 10 seconds
 
Just change the set_task to 10 seconds I guess?? O_O
or

#Define wait 0.1 to 10.0

Check if it works

ConnorMcLeod 06-21-2012 14:36

Re: Delay script with 10 seconds
 
This code is terrible.


All times are GMT -4. The time now is 06:14.

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