AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ]Plugin load on second round? (https://forums.alliedmods.net/showthread.php?t=306111)

Epiii 03-16-2018 14:10

[REQ]Plugin load on second round?
 
I need help with getting my plugin getting loaded on second round of the map, if its possible i would love the help and also if anybody have working weapon restriction of awp,scars,etc... with possibility of vip protect... all weapon restrict plugins crashes my server without any error log... thanks for help!

CookieCrumbler 03-17-2018 22:15

Re: [REQ]Plugin load on second round?
 
AMXX has a built in weapon restriction. You can configure from your amxmodmenu or you can set up a .cfg file with the designated restrictions. You can find out how to do this on the alliedmods wiki.

PHP Code:

#include <amxmodx>

#define PLUGIN "Second Round Load"
#define VERSION "0.1"
#define AUTHOR "AMXX"

new round_start_counter 0

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
}

public 
Event_HLTV_New_Round
{
    
round_start_counter++

    if (
round_start_counter >= 2)
        {
            
fuction_name()
        }
}

public 
function_name()
{
   
Start you plugins code base from here



Hartmann 03-22-2018 12:55

Re: [REQ]Plugin load on second round?
 
@CookieCrumbler

No need to set_task

Code:

function_name()

DjSoftero 03-22-2018 13:42

Re: [REQ]Plugin load on second round?
 
Quote:

Originally Posted by Hartmann (Post 2584182)
@CookieCrumbler

No need to set_task

Code:

function_name()

If i'm not mistaken, the set_task is crucial for some things like getting alive players and doing something to them, because players might not have been spawned in that time yet.

Hartmann 03-22-2018 14:13

Re: [REQ]Plugin load on second round?
 
Quote:

Originally Posted by DjSoftero (Post 2584189)
If i'm not mistaken, the set_task is crucial for some things like getting alive players and doing something to them, because players might not have been spawned in that time yet.

set_task only the time for which a command will be executed

Read:
https://www.amxmodx.org/api/amxmodx/set_task

CookieCrumbler 03-22-2018 19:19

Re: [REQ]Plugin load on second round?
 
yes and no depending on what your doing ...

I mean you can put code in the hltv round event but for structure you want to start your code base from the first function because from the first function you might want to go on to a 2nd , 3rd , 4th, 5th function depending on what your code is and you don't want to just cram all that into the round start event, you want structure

Hartmann 03-22-2018 19:48

Re: [REQ]Plugin load on second round?
 
Quote:

Originally Posted by CookieCrumbler (Post 2584234)
yes and no... i mean you can put all your code in the hltv round event but for simplicity and structure you can start your code base from the first function because from the first function you might want to go on to a 2nd , 3rd , 4th, 5th function depending on what your code is and you don't want to just cram all that into the round start event, you want structure.

I don't know if you understood me :)

I think:

PHP Code:

#include <amxmodx>

#define PLUGIN "Second Round Load"
#define VERSION "0.1"
#define AUTHOR "AMXX"

new round_start_counter 0

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
}

public 
Event_HLTV_New_Round() // <--  ()
{
    
round_start_counter++

    if (
round_start_counter == 2)
        {
            
/* set_task(0.1, "fuction_name") */
            // Use 1.0 task 
            
function_name()
        }
}

public 
function_name() // <--  () 
{
   
//Start you plugins code base from here



CookieCrumbler 03-22-2018 20:01

Re: [REQ]Plugin load on second round?
 
yes you can do that as well

also i updated second post to >= because == will only do it on the second round , i just noticed that


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

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