Raised This Month: $1951 Target: $400
 487% 

Solved ZombieBasebuilder.ini


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Supremache
Senior Member
Join Date: Sep 2019
Old 07-11-2020 , 17:17   ZombieBasebuilder.ini
Reply With Quote #1

Hello guys,
I making zombie base builder configuration setting file and i have stopped in some codes.
I stopped in section mod cvars, i want to add all mode cvars to .ini file because all cvars are released on public plugin precache() and if i moved them to public plugin_init() the mod will disable.

Base Builder Cvars
PHP Code:
g_pcvar_buildtime register_cvar("bb_buildtime""150"//Build Time
    
g_iBuildTime clamp(get_pcvar_num(g_pcvar_buildtime), 30300)
    
g_pcvar_preptime register_cvar("bb_preptime""30"//Prep Time
    
g_iPrepTime clamp(get_pcvar_num(g_pcvar_preptime), 060)
    
g_pcvar_zombietime register_cvar("bb_zombie_respawn_delay""3"//Zombie Respawn Delay
    
g_iZombieTime clamp(get_pcvar_num(g_pcvar_zombietime), 130)
    
g_pcvar_infecttime register_cvar("bb_infection_respawn""5"//Survivor Respawn Infection Delay
    
g_iInfectTime clamp(get_pcvar_num(g_pcvar_infecttime), 030)
    
g_pcvar_showmovers register_cvar("bb_showmovers""1"//Show Movers
    
g_iShowMovers clamp(get_pcvar_num(g_pcvar_showmovers), 01)
    
g_pcvar_lockblocks register_cvar("bb_lockblocks""1"//Lock blocks
    
g_iLockBlocks clamp(get_pcvar_num(g_pcvar_lockblocks), 01)
    
g_pcvar_lockmax register_cvar("bb_lockmax""10"//Lock max
    
g_iLockMax clamp(get_pcvar_num(g_pcvar_lockmax), 050)
    
g_pcvar_colormode register_cvar("bb_colormode""1"//Color mode <0/1/2> Menu, one color per player, random
    
g_iColorMode clamp(get_pcvar_num(g_pcvar_colormode), 02)
    
g_pcvar_entmaxdist register_cvar("bb_max_move_dist""768"//Push ceiling
    
g_fEntMaxDist get_pcvar_float(g_pcvar_entmaxdist)
    
g_pcvar_entmindist register_cvar("bb_min_move_dist""32"//Pull floor
    
g_fEntMinDist get_pcvar_float(g_pcvar_entmindist)
    
g_pcvar_entsetdist register_cvar("bb_min_dist_set""64"//Grab set
    
g_fEntSetDist get_pcvar_float(g_pcvar_entsetdist)
    
g_pcvar_resetent register_cvar("bb_resetblocks""1"//Reset blocks on new round
    
g_iResetEnt clamp(get_pcvar_num(g_pcvar_resetent), 01)
    
g_pcvar_supercut register_cvar("bb_zombie_supercut""0"//One hit kill for zombies
    
g_iSupercut clamp(get_pcvar_num(g_pcvar_supercut), 01)
    
g_pcvar_gunsmenu register_cvar("bb_gunsmenu""1"//Use the internal guns menu
    
g_iGunsMenu clamp(get_pcvar_num(g_pcvar_gunsmenu), 01)
    
    
g_pcvar_givenades register_cvar("bb_roundnades","h"//Grenades
    
g_pcvar_allowedweps register_cvar("bb_weapons","abcdeghijlmnqrstuvwx"

I did it but when i open the game to test it the game get automaticly closed so i think there's a problem in those codes

PHP Code:
case SECTION_MOD_CVARS:
            {
                if (
equal(key"MOD ENABLE/DISABLE"))
                    
g_pcvar_enabled str_to_num(value)
                if (
equal(key"BUILD TIME"))
                    
g_pcvar_buildtime str_to_num(value)
                if (
equal(key"PREP TIME"))
                    
g_pcvar_preptime str_to_num(value)
                if (
equal(key"ZOMBIE RESPAWN DELAY"))
                    
g_pcvar_zombietime str_to_num(value)
                if (
equal(key"SURVIVOR RESPAWN INFECTION DELAY"))
                    
g_pcvar_infecttime str_to_num(value)
                if (
equal(key"SHOW MOVERS"))
                    
g_pcvar_showmovers str_to_num(value)
                if (
equal(key"LOCK BLOCKS"))
                    
g_pcvar_lockblocks str_to_num(value)
                if (
equal(key"LOCK MAX"))
                    
g_pcvar_lockmax str_to_num(value)
                if (
equal(key"COLOR MOD <0/1/2>"))
                    
g_pcvar_colormode str_to_num(value)
                if (
equal(key"PUSH CEILING"))
                    
g_pcvar_entmaxdist str_to_num(value)
                if (
equal(key"PULL FLOOR"))
                    
g_pcvar_entmindist str_to_num(value)
                if (
equal(key"GRAB SET"))
                    
g_pcvar_entsetdist str_to_num(value)
                if (
equal(key"RESET BLOCKS ON NEW ROUND"))
                    
g_pcvar_resetent str_to_num(value)
                if (
equal(key"ONE HIT KILL FOR ZOMBIES"))
                    
g_pcvar_supercut str_to_num(value)
                if (
equal(key"GUNS MENU"))
                    
g_pcvar_gunsmenu str_to_num(value)
                if (
equal(key"GRENADES"))
                    
g_pcvar_givenades str_to_num(value)
                if (
equal(key"ALLOWED WEAPONS"))
                    
g_pcvar_allowedweps str_to_num(value)        
            } 
Where's the problem in those codes or all of that are wrong?

Last edited by Supremache; 07-26-2020 at 18:44.
Supremache is online now
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-11-2020 , 18:34   Re: ZombieBasebuilder.ini
Reply With Quote #2

Show full code.
__________________

Last edited by OciXCrom; 07-11-2020 at 18:34.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-11-2020 , 18:55   Re: ZombieBasebuilder.ini
Reply With Quote #3

Why are you changing the cvar pointers value ? It's unchangeable unless you re re -registering the same cvar more than one time. Which had never happened.
__________________
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Supremache
Senior Member
Join Date: Sep 2019
Old 07-11-2020 , 19:56   Re: ZombieBasebuilder.ini
Reply With Quote #4

@ OciXCrom
PHP Code:
new const BB_CUSTOMIZATION_FILE[] = "ZombieBasebuilder.ini"
// Customization file sections
enum
{
    
SECTION_NONE 0,
    
SECTION_ACCESS_FLAGS,
    
SECTION_MOD_CVARS
}

// Access flags
enum
{
    
ACCESS_ENABLE_MOD 0,
    
ACCESS_GIVEAP,
    
ACCESS_TAKEAP,
    
ACCESS_SWAP,
    
ACCESS_REVIVE,
    
ACCESS_GUNS,
    
ACCESS_RELEASE,
    
ACCESS_BUILD,
    
ACCESS_OVERRIDE,
    
ACCESS_LOCKAFTER,
    
ACCESS_LOCK,
    
ACCESS_BUILDBAN,
    
MAX_ACCESS_FLAGS
}

load_customization_from_files()
{
    
// Build customization file path
    
new path[64]
    
get_configsdir(pathcharsmax(path))
    
format(pathcharsmax(path), "%s/%s"pathBB_CUSTOMIZATION_FILE)
    
    
// File not present
    
if (!file_exists(path))
    {
        new 
error[100]
        
formatex(errorcharsmax(error), "Cannot load customization file %s!"path)
        
set_fail_state(error)
        return;
    }
    
    
// Set up some vars to hold parsing info
    
new linedata[1024], key[64], value[960], sectionteams
    
    
// Open customization file for reading
    
new file fopen(path"rt")
    
    while (
file && !feof(file))
    {
        
// Read one line at a time
        
fgets(filelinedatacharsmax(linedata))
        
        
// Replace newlines with a null character to prevent headaches
        
replace(linedatacharsmax(linedata), "^n""")
        
        
// Blank line or comment
        
if (!linedata[0] || linedata[0] == ';') continue;
        
        
// New section starting
        
if (linedata[0] == '[')
        {
            
section++
            continue;
        }
        
        
// Get key and value(s)
        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
        
        
// Trim spaces
        
trim(key)
        
trim(value)
        
        switch (
section)
        {
            case 
SECTION_ACCESS_FLAGS:
            {
                if (
equal(key"ENABLE/DISABLE MOD"))
                    
g_access_flag[ACCESS_ENABLE_MOD] = read_flags(value)
                else if (
equal(key"GIVE AMMO"))
                    
g_access_flag[ACCESS_GIVEAP] = read_flags(value)
                else if (
equal(key"TAKE AMMO"))
                    
g_access_flag[ACCESS_TAKEAP] = read_flags(value)
                else if (
equal(key"SWAP A PLAYERS TEAM"))
                    
g_access_flag[ACCESS_SWAP] = read_flags(value)
                else if (
equal(key"RESPAWN A PLAYER"))
                    
g_access_flag[ACCESS_REVIVE] = read_flags(value)
                else if (
equal(key"REOPEN GUNS MENU FOR PLAYER"))
                    
g_access_flag[ACCESS_GUNS] = read_flags(value)
                else if (
equal(key"RELEASE ZOMBIE'S MANUALLY"))
                    
g_access_flag[ACCESS_RELEASE] = read_flags(value)
                else if (
equal(key"BUILD AFTER BUILD TIME"))
                    
g_access_flag[ACCESS_BUILD] = read_flags(value)
                else if (
equal(key"FOR ADMIN OF ADMINS"))
                    
g_access_flag[ACCESS_OVERRIDE] = read_flags(value)
                else if (
equal(key"LOCK/UNLOCK BLOCKS AFTER BUILD TIME"))
                    
g_access_flag[ACCESS_LOCKAFTER] = read_flags(value)
                else if (
equal(key"LOCK/UNLOCK BLOCKS"))
                    
g_access_flag[ACCESS_LOCK] = read_flags(value)
                else if (
equal(key"BAN PLAYERS FROM BUILDING"))
                    
g_access_flag[ACCESS_BUILDBAN] = read_flags(value)    
            }
            case 
SECTION_MOD_CVARS:
            {
                if (
equal(key"MOD ENABLE/DISABLE"))
                    
g_pcvar_enabled str_to_num(value)
                if (
equal(key"BUILD TIME"))
                    
g_pcvar_buildtime str_to_num(value)
                if (
equal(key"PREP TIME"))
                    
g_pcvar_preptime str_to_num(value)
                if (
equal(key"ZOMBIE RESPAWN DELAY"))
                    
g_pcvar_zombietime str_to_num(value)
                if (
equal(key"SURVIVOR RESPAWN INFECTION DELAY"))
                    
g_pcvar_infecttime str_to_num(value)
                if (
equal(key"SHOW MOVERS"))
                    
g_pcvar_showmovers str_to_num(value)
                if (
equal(key"LOCK BLOCKS"))
                    
g_pcvar_lockblocks str_to_num(value)
                if (
equal(key"LOCK MAX"))
                    
g_pcvar_lockmax str_to_num(value)
                if (
equal(key"COLOR MOD <0/1/2>"))
                    
g_pcvar_colormode str_to_num(value)
                if (
equal(key"PUSH CEILING"))
                    
g_pcvar_entmaxdist str_to_num(value)
                if (
equal(key"PULL FLOOR"))
                    
g_pcvar_entmindist str_to_num(value)
                if (
equal(key"GRAB SET"))
                    
g_pcvar_entsetdist str_to_num(value)
                if (
equal(key"RESET BLOCKS ON NEW ROUND"))
                    
g_pcvar_resetent str_to_num(value)
                if (
equal(key"ONE HIT KILL FOR ZOMBIES"))
                    
g_pcvar_supercut str_to_num(value)
                if (
equal(key"GUNS MENU"))
                    
g_pcvar_gunsmenu str_to_num(value)
                if (
equal(key"GRENADES"))
                    
g_pcvar_givenades str_to_num(value)
                if (
equal(key"ALLOWED WEAPONS"))
                    
g_pcvar_allowedweps str_to_num(value)        
            }
        }
    }
    if (
filefclose(file
@ Natsheh - So how i do it ?
Supremache is online now
Supremache
Senior Member
Join Date: Sep 2019
Old 07-12-2020 , 13:02   Re: ZombieBasebuilder.ini
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
Why are you changing the cvar pointers value ? It's unchangeable unless you re re -registering the same cvar more than one time. Which had never happened.
Do you meen change it from g_pcvar_zombietime to get_pcvar_num(g_pcvar_zombietime) ?
Supremache is online now
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-12-2020 , 13:32   Re: ZombieBasebuilder.ini
Reply With Quote #6

you're changing the cvars variables pointers to their cvars values. think of what youre writing.
__________________
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Supremache
Senior Member
Join Date: Sep 2019
Old 07-12-2020 , 13:57   Re: ZombieBasebuilder.ini
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
you're changing the cvars variables pointers to their cvars values. think of what youre writing.
Bro I'm dont have expriance about .ini codes file but i'm learning so fast just exmple me how to do it with one cvar and i will contnue

Last edited by Supremache; 07-12-2020 at 13:57.
Supremache is online now
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-12-2020 , 13:59   Re: ZombieBasebuilder.ini
Reply With Quote #8

Quote:
Originally Posted by Supremache View Post
PHP Code:
            case SECTION_MOD_CVARS:
            {
                if (
equal(key"MOD ENABLE/DISABLE"))
                    
g_pcvar_enabled str_to_num(value)
                if (
equal(key"BUILD TIME"))
                    
g_pcvar_buildtime str_to_num(value)
                if (
equal(key"PREP TIME"))
                    
g_pcvar_preptime str_to_num(value)
                if (
equal(key"ZOMBIE RESPAWN DELAY"))
                    
g_pcvar_zombietime str_to_num(value)
                if (
equal(key"SURVIVOR RESPAWN INFECTION DELAY"))
                    
g_pcvar_infecttime str_to_num(value)
                if (
equal(key"SHOW MOVERS"))
                    
g_pcvar_showmovers str_to_num(value)
                if (
equal(key"LOCK BLOCKS"))
                    
g_pcvar_lockblocks str_to_num(value)
                if (
equal(key"LOCK MAX"))
                    
g_pcvar_lockmax str_to_num(value)
                if (
equal(key"COLOR MOD <0/1/2>"))
                    
g_pcvar_colormode str_to_num(value)
                if (
equal(key"PUSH CEILING"))
                    
g_pcvar_entmaxdist str_to_num(value)
                if (
equal(key"PULL FLOOR"))
                    
g_pcvar_entmindist str_to_num(value)
                if (
equal(key"GRAB SET"))
                    
g_pcvar_entsetdist str_to_num(value)
                if (
equal(key"RESET BLOCKS ON NEW ROUND"))
                    
g_pcvar_resetent str_to_num(value)
                if (
equal(key"ONE HIT KILL FOR ZOMBIES"))
                    
g_pcvar_supercut str_to_num(value)
                if (
equal(key"GUNS MENU"))
                    
g_pcvar_gunsmenu str_to_num(value)
                if (
equal(key"GRENADES"))
                    
g_pcvar_givenades str_to_num(value)
                if (
equal(key"ALLOWED WEAPONS"))
                    
g_pcvar_allowedweps str_to_num(value)        
            }
        }
    }
    if (
filefclose(file
@ Natsheh - So how i do it ?

here why're you changing the pointer variables value....????
__________________
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Supremache
Senior Member
Join Date: Sep 2019
Old 07-12-2020 , 14:27   Re: ZombieBasebuilder.ini
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
here why're you changing the pointer variables value....????
What do you mean about pointer variables value i don't understand is and what did i changed

read_flags(value) for access flag and i think str_to_num(value) for somethings like cvar
PHP Code:
case SECTION_ACCESS_FLAGS:
            {
                if (
equal(key"ENABLE/DISABLE MOD"))
                    
g_access_flag[ACCESS_ENABLE_MOD] = read_flags(value)
                else if (
equal(key"GIVE AMMO"))
                    
g_access_flag[ACCESS_GIVEAP] = read_flags(value)
                else if (
equal(key"TAKE AMMO"))
                    
g_access_flag[ACCESS_TAKEAP] = read_flags(value)
                else if (
equal(key"SWAP A PLAYERS TEAM"))
                    
g_access_flag[ACCESS_SWAP] = read_flags(value)
                else if (
equal(key"RESPAWN A PLAYER"))
                    
g_access_flag[ACCESS_REVIVE] = read_flags(value)
                else if (
equal(key"REOPEN GUNS MENU FOR PLAYER"))
                    
g_access_flag[ACCESS_GUNS] = read_flags(value)
                else if (
equal(key"RELEASE ZOMBIE'S MANUALLY"))
                    
g_access_flag[ACCESS_RELEASE] = read_flags(value)
                else if (
equal(key"BUILD AFTER BUILD TIME"))
                    
g_access_flag[ACCESS_BUILD] = read_flags(value)
                else if (
equal(key"FOR ADMIN OF ADMINS"))
                    
g_access_flag[ACCESS_OVERRIDE] = read_flags(value)
                else if (
equal(key"LOCK/UNLOCK BLOCKS AFTER BUILD TIME"))
                    
g_access_flag[ACCESS_LOCKAFTER] = read_flags(value)
                else if (
equal(key"LOCK/UNLOCK BLOCKS"))
                    
g_access_flag[ACCESS_LOCK] = read_flags(value)
                else if (
equal(key"BAN PLAYERS FROM BUILDING"))
                    
g_access_flag[ACCESS_BUILDBAN] = read_flags(value
Supremache is online now
Supremache
Senior Member
Join Date: Sep 2019
Old 07-12-2020 , 17:32   Re: ZombieBasebuilder.ini
Reply With Quote #10

Guys pls I can't wait, I transformeing zombie plague to base build I want to make everything's without any problems so Pls I need who can answer me for how to code cvars to. Ini file
Supremache is online now
Reply


Thread Tools
Display Modes

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:02.


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