Raised This Month: $ Target: $400
 0% 

model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-06-2009 , 16:58   model
Reply With Quote #1

Is it possible to make (in this case shero) with model that will be defined trough cvar instead of being hardcoded?
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-06-2009 , 17:08   Re: model
Reply With Quote #2

#define MODEL_NAME "models/player/model_name"
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-06-2009 , 17:14   Re: model
Reply With Quote #3

wouldnt that make it hardcoded?

i want i to be compiled only once, but yet able to use different models by just changing the location and file name in cvars.
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-06-2009 , 17:19   Re: model
Reply With Quote #4

I think you can do it with a cvar?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-06-2009 , 18:00   Re: model
Reply With Quote #5

Quote:
Originally Posted by TitANious View Post
#define MODEL_NAME "models/player/model_name"
#define for a string isn't good idea.
Code:
new ModelPathCVar;   public plugin_init()         ModelPathCVar = register_cvar("amx_model", "models/model.mdl");   public SomeFunction() {         new ModelPath[64];         get_pcvar_string(ModelPathCVar, ModelPath, 63);           // ModelPath now contains the string that is in CVar }
__________________

Last edited by hleV; 06-06-2009 at 18:04.
hleV is offline
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-07-2009 , 17:56   Re: model
Reply With Quote #6

yeah i tried that and it did compile fine but my server wouldn't accept it, tells its a bad string or something, so i figure it wants that string is a constant. So what i need is a way of getting the cvar and then declaring the model variable as a constant. I tried something like that but compiler wouldnt let me do that.

As of that i have come to a question, can i pass that variable down to other methods without making it global?
Please give me an example as well as explanation.

In java it would look something like this.

Code:
class someclass
{
	public static void main(String[] args)
	{
		int someInt = 1;
		someMethod(someInt);
	}
	
	static void someMethod(int theInt)
	{
		System.out.println(theInt);
	}
}
So can i do something similar and how would i be doing it in this particular scenario?
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-07-2009 , 18:14   Re: model
Reply With Quote #7

You can
PHP Code:
new const MODEL_NAME [33] []
{
    
"models/player/model_name/"

__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-07-2009 , 18:28   Re: model
Reply With Quote #8

Ok how exactly would that work?
declaring a constant array named Model_Name then there is unexplained [] and then in curly braces you have the string it self.

Wouldnt that be the same as
new const MODEL_NAME [33] = {"models/player....."}
?
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
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:55.


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