Raised This Month: $51 Target: $400
 12% 

very stupid question


Post New Thread Reply   
 
Thread Tools Display Modes
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 10-27-2017 , 03:09   Re: very stupid question
Reply With Quote #11

const is a type qualifier: a keyword applied to a data type that indicates that the data is read only. source
__________________
Relaxing is offline
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 10-27-2017 , 04:25   Re: very stupid question
Reply With Quote #12

Quote:
Originally Posted by Relaxing View Post
const is a type qualifier: a keyword applied to a data type that indicates that the data is read only. source

Hmm
So how I can replace that cvar ?
With #define ? Or how
I don’t want cvar
bakir123 is offline
Send a message via Skype™ to bakir123
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-27-2017 , 09:20   Re: very stupid question
Reply With Quote #13

To replace a cvar with a constant variable, simply replace all get_cvar or get_pcvar functions with your new variable. Then, define that variable at the top of your plugin.
__________________
fysiks is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 10-27-2017 , 09:57   Re: very stupid question
Reply With Quote #14

If you don't want to use cvars
Code:
if (g_DeathMatch == 2 || (g_DeathMatch == 3 && random_num(0, 1)) || (g_DeathMatch == 4 && fnGetZombies() < fnGetAlive()/2))             g_respawn_as_zombie[ID_SPAWN] = true
use this
Code:
if (random_num(0, 1)) && fnGetZombies() < fnGetAlive()/2))             g_respawn_as_zombie[ID_SPAWN] = true
- if you don't want to use cvars in this case it will always be a deathmatch zombie mode.
__________________

Last edited by Relaxing; 10-27-2017 at 09:59.
Relaxing is offline
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 10-27-2017 , 10:28   Re: very stupid question
Reply With Quote #15

Quote:
Originally Posted by Relaxing View Post
If you don't want to use cvars
Code:
if (g_DeathMatch == 2 || (g_DeathMatch == 3 && random_num(0, 1)) || (g_DeathMatch == 4 && fnGetZombies() < fnGetAlive()/2))             g_respawn_as_zombie[ID_SPAWN] = true
use this
Code:
if (random_num(0, 1)) && fnGetZombies() < fnGetAlive()/2))             g_respawn_as_zombie[ID_SPAWN] = true
- if you don't want to use cvars in this case it will always be a deathmatch zombie mode.
I already did that but not working
I added

PHP Code:
const g_DeathMatch 3
But not working !! Why !!
bakir123 is offline
Send a message via Skype™ to bakir123
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 10-27-2017 , 11:51   Re: very stupid question
Reply With Quote #16

You can clearly see that the code you're using won't never turn true... Well the statement checks if the var is equal to 2, 3 & 4.
Can't you imagine such thing?
It's even in english.
__________________
Relaxing is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 10-27-2017 , 13:28   Re: very stupid question
Reply With Quote #17

Quote:
Originally Posted by Relaxing View Post
If you don't want to use cvars
Code:
if (g_DeathMatch == 2 || (g_DeathMatch == 3 && random_num(0, 1)) || (g_DeathMatch == 4 && fnGetZombies() < fnGetAlive()/2))             g_respawn_as_zombie[ID_SPAWN] = true
use this
Code:
if (random_num(0, 1)) && fnGetZombies() < fnGetAlive()/2))             g_respawn_as_zombie[ID_SPAWN] = true
- if you don't want to use cvars in this case it will always be a deathmatch zombie mode.
OMG, this is totally wrong, it is like combining random and balance mode of that cvar.
Code:
zp_deathmatch 0						// Deathmatch mode, respawn as: [0-disabled // 1-human // 2-zombie // 3-randomly // 4-balance]
To according to what he needs, solution differs.

To author: I think this is a very stupid solution, why not just remove the amx_cvar command from your admins? You said earlier that your admins need to change mp_timelimit for example, it will be easier to write new plugin that allow to admins with certain flag to change desired cvars and there won't be need of amx_cvar. Also editing the zombie plague mod in this way, someday if you decide to change some of hardcoded cvars, you have to edit again the source code which I find a stupid.

Last edited by KiLLeR.; 10-27-2017 at 13:42.
KiLLeR. is offline
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 10-27-2017 , 14:32   Re: very stupid question
Reply With Quote #18

Quote:
Originally Posted by Relaxing View Post
You can clearly see that the code you're using won't never turn true... Well the statement checks if the var is equal to 2, 3 & 4.
Can't you imagine such thing?
It's even in english.
I’m weak with English language, well
But what I should do ! Cuz really I didn’t understand well
bakir123 is offline
Send a message via Skype™ to bakir123
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 10-27-2017 , 15:43   Re: very stupid question
Reply With Quote #19

Can you explain more what you want the code to do?
__________________
Relaxing is offline
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 10-27-2017 , 15:47   Re: very stupid question
Reply With Quote #20

Quote:
Originally Posted by Relaxing View Post
Can you explain more what you want the code to do?
well
i want to remove cvar, and use const, that all
as you show up, i have shared the code with g_DeathMatch (const)
and i added it like
PHP Code:
const g_DeathMatch 3
but not working, it's should do randomly deathmatch, but not working
so what do you think the soultion ?
bakir123 is offline
Send a message via Skype™ to bakir123
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 10:37.


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