Raised This Month: $ Target: $400
 0% 

cmd check


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KamiN
Senior Member
Join Date: Jun 2011
Old 11-24-2011 , 10:26   cmd check
Reply With Quote #1

How to check if cl_weather is already 3?

Code:
public snowon(id) 
{ 
    client_cmd(id, "cl_weather 3");
    client_print(id, print_chat, "You'v turned on the snow.")
    return PLUGIN_HANDLED;
}
If theres already cl_weather 3 i'd like to type a diffrenet text, like "Its already snowing".
KamiN is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-24-2011 , 10:54   Re: cmd check
Reply With Quote #2

query_client_cvar ( ) ?
Korxu is offline
KamiN
Senior Member
Join Date: Jun 2011
Old 11-24-2011 , 12:56   Re: cmd check
Reply With Quote #3

could u give me an example with cl_weather?
KamiN is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-24-2011 , 13:12   Re: cmd check
Reply With Quote #4

PHP Code:
// Your function.
public snowon index )
{
     
query_client_cvar index"cl_weather""check_cvar_value" )
}

public 
check_cvar_value indexcvar [ ], value [ ] )
{
     
// If the value is different of '3', change it to '3'.
     
if ( value ] != '3' )
     {
          
client_cmd index"cl_weather 3" )
     }

     
// And show the message.
     
client_print indexprint_chat"You have turned on the snow." )


Last edited by Korxu; 11-24-2011 at 16:45.
Korxu is offline
KamiN
Senior Member
Join Date: Jun 2011
Old 11-24-2011 , 15:49   Re: cmd check
Reply With Quote #5

Code:
index
is the same as
Code:
id
? ^_^
KamiN is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 11-24-2011 , 16:15   Re: cmd check
Reply With Quote #6

Quote:
Originally Posted by KamiN View Post
Code:
index
is the same as
Code:
id
? ^_^
Well yes but you cannot simply put client_print( id ... or something like that in those functions,
cuz' index is the created parameter for your function. If you were to replace:
PHP Code:
public snowon index 
with this:
PHP Code:
public snowon id 
id would be the created parameter then you'd be able to do client_print(id...
but not client_print( index...
Erox902 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-24-2011 , 19:19   Re: cmd check
Reply With Quote #7

Quote:
Originally Posted by KamiN View Post
Code:
index
is the same as
Code:
id
? ^_^
Index or id are just variable names. You can name them whatever you want.
id is most used to hold a player index.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 08:34.


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