Raised This Month: $ Target: $400
 0% 

need a little help with an "if else" statement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 15:14   need a little help with an "if else" statement
Reply With Quote #1

cansomeone throw me a quick line on an if else statement where

Code:
public plugin_precache() if(get_cvar_num("sv_blah is one") {     spritethingy = precache_model("some sprite");     return PLUGIN_HANDLED } else {     spritethingy = precache_model("some other sprite");     return PLUGIN_CONTINUE; }

thanx.

so If sv_blah is set to one in server then it should precache and use sprite x otherwise sprite y.
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 07-03-2004 , 15:35   Re: need a little help with an "if else" statemen
Reply With Quote #2

Code:
public plugin_precache()[{     if(get_cvar_num("sv_blah is one") {         spritethingy = precache_model("some sprite");         return PLUGIN_HANDLED     }else{         spritethingy = precache_model("some other sprite");         return PLUGIN_CONTINUE;     }   }

Try that.
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 15:50  
Reply With Quote #3

hmm thanx but I stil get the same error that I was able to work it down to :
Code:
warning 209: function "plugin_precache" should return a value
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 07-03-2004 , 16:01  
Reply With Quote #4

Code:
public plugin_precache()[{     if(get_cvar_num(sv_blah == "1") {         spritethingy = precache_model("some sprite");         return PLUGIN_HANDLED     }else{         spritethingy = precache_model("some other sprite");         return PLUGIN_CONTINUE;     }     }
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 16:11  
Reply With Quote #5

Quote:
Originally Posted by Dygear
Code:
public plugin_precache()[{     if(get_cvar_num(sv_blah<b> == "1"</b>) {         spritethingy = precache_model("some sprite");         return PLUGIN_HANDLED     }else{         spritethingy = precache_model("some other sprite");         return PLUGIN_CONTINUE;     }     }
damnit gotta stop forgetting some stuff.... was fogetting the == "1" part.
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 07-03-2004 , 16:14  
Reply With Quote #6

LOL, so it worked.
I helped, im happy!

Quote:
Originally Posted by kingpin
hmm thanx but I stil get the same error that I was able to work it down to :
Code:
warning 209: function "plugin_precache" should return a value
Really, that code should of fixed an error, you wear missing a set of curly brackets.
This code wll now fix the rest of that, you can not say "sv_blah is one" it must be "sv_blah == "1""
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 16:16  
Reply With Quote #7

thanx dy
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 07-03-2004 , 16:16  
Reply With Quote #8

Glad I could help, even tho I am a noobie.

*edit made both I caped*
*edit added these edits*
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
kingpin
Veteran Member
Join Date: Apr 2004
Location: kpsforum.com
Old 07-03-2004 , 16:17  
Reply With Quote #9

lmao yeah ofcourse... u noob lol now goto sleep already before u fall over.
__________________
kingpin is offline
Send a message via ICQ to kingpin Send a message via AIM to kingpin Send a message via MSN to kingpin Send a message via Yahoo to kingpin Send a message via Skype™ to kingpin
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 07-03-2004 , 16:18  
Reply With Quote #10

actualy does this help move my rank up, from like noobie to like better-then-your-average-noob ?
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
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 14:45.


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