Raised This Month: $32 Target: $400
 8% 

[REQ]Plugin load on second round?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Epiii
New Member
Join Date: May 2017
Old 03-16-2018 , 14:10   [REQ]Plugin load on second round?
Reply With Quote #1

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!
Epiii is offline
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 03-17-2018 , 22:15   Re: [REQ]Plugin load on second round?
Reply With Quote #2

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

__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me

Last edited by CookieCrumbler; 03-23-2018 at 01:06.
CookieCrumbler is offline
Hartmann
Senior Member
Join Date: Nov 2014
Old 03-22-2018 , 12:55   Re: [REQ]Plugin load on second round?
Reply With Quote #3

@CookieCrumbler

No need to set_task

Code:
function_name()
__________________

RETAKES v1.0
github.com/alghtryer/retakes

Contact : [email protected]

BTC Donate: 1QAh1NLmeHy81LF9r8PaeGjYqHL2BBcJTx

Hartmann is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 03-22-2018 , 13:42   Re: [REQ]Plugin load on second round?
Reply With Quote #4

Quote:
Originally Posted by Hartmann View Post
@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.
__________________
retired chump
DjSoftero is offline
Hartmann
Senior Member
Join Date: Nov 2014
Old 03-22-2018 , 14:13   Re: [REQ]Plugin load on second round?
Reply With Quote #5

Quote:
Originally Posted by DjSoftero View Post
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
__________________

RETAKES v1.0
github.com/alghtryer/retakes

Contact : [email protected]

BTC Donate: 1QAh1NLmeHy81LF9r8PaeGjYqHL2BBcJTx

Hartmann is offline
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 03-22-2018 , 19:19   Re: [REQ]Plugin load on second round?
Reply With Quote #6

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
__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me

Last edited by CookieCrumbler; 03-22-2018 at 19:55.
CookieCrumbler is offline
Hartmann
Senior Member
Join Date: Nov 2014
Old 03-22-2018 , 19:48   Re: [REQ]Plugin load on second round?
Reply With Quote #7

Quote:
Originally Posted by CookieCrumbler View Post
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

__________________

RETAKES v1.0
github.com/alghtryer/retakes

Contact : [email protected]

BTC Donate: 1QAh1NLmeHy81LF9r8PaeGjYqHL2BBcJTx

Hartmann is offline
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 03-22-2018 , 20:01   Re: [REQ]Plugin load on second round?
Reply With Quote #8

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
__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me
CookieCrumbler is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:44.


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