Raised This Month: $ Target: $400
 0% 

Cvar setting problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Melisko
Senior Member
Join Date: Feb 2010
Old 06-16-2011 , 10:00   Cvar setting problem
Reply With Quote #1

Hi , I need help with setting some cvars . Here is the part of a plugin:

public svm_item_on( iPlayer, iItemIndex, bool:iPluginON) {

Quote:
if( g_iItemIndex == iItemIndex ) {

if(iPluginON) { get_cvar_string
client_cmd(player_id,";alias bhop_auto")

client_print( iPlayer , print_chat, "Bunny Hop je Zapnuty!")


}
else { client_cmd(player_id,"bhop_auto 0")
client_cmd(player_id,";alias bhop_auto")

client_print( iPlayer , print_chat, "Bunny Hop je Vypnuty!")

}
}

//return if needed here
}
I want to set the cvar bhop_auto like this : if(iPluginON) bhop_auto 1

and this : else bhop_auto 0

Thanks 4 help


////(My script can be find at the bottom of the plugin)////
Attached Files
File Type: sma Get Plugin or Get Source (amx_bhop.sma - 488 views - 6.0 KB)

Last edited by Melisko; 06-16-2011 at 10:16. Reason: full plugin if needed
Melisko is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-16-2011 , 10:36   Re: Cvar setting problem
Reply With Quote #2

Try to use set_pcvar_num( ).

Code:
if( iPluginON ) {      set_pcvar_num( g_pcvarAutoBhop , 1 ) }
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Melisko
Senior Member
Join Date: Feb 2010
Old 06-16-2011 , 11:06   Re: Cvar setting problem
Reply With Quote #3

Quote:
Originally Posted by Devil259 View Post
Try to use set_pcvar_num( ).

Code:
if( iPluginON ) { set_pcvar_num( g_pcvarAutoBhop , 1 ) }
Thanks , this help me alot , but is it possible to set the cvar only for 1 player??? , Im making a VIP plugin , so the vips can choose if they want bunny hop or not , normal players can have bhop too , but they cant disable it (thats my plan). When I used this , it changed the server cvar and it disabled bhop to all players on the server....
Melisko is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-16-2011 , 11:09   Re: Cvar setting problem
Reply With Quote #4

Quote:
amx_autobhop <nick|#userid> <0|1>
Give autojump ability to a player (when bhop_auto is 0)
from ConnorMcLeod's post (see Bunny Hop Abilities v0.5.2 plugin).

So, use server_cmd( ).
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Melisko
Senior Member
Join Date: Feb 2010
Old 06-16-2011 , 11:13   Re: Cvar setting problem
Reply With Quote #5

Quote:
Originally Posted by Devil259 View Post
from ConnorMcLeod's post (see Bunny Hop Abilities v0.5.2 plugin).

So, use server_cmd( ).
I think I wrote my last post wrong... I mean , enable/disable cvar bhop_auto only for player , that choose it in vip menu..... Im not rly good at scripting.....

Is it possbile that each player can have enable different cvar???

Last edited by Melisko; 06-16-2011 at 11:15. Reason: etc....
Melisko is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-16-2011 , 11:20   Re: Cvar setting problem
Reply With Quote #6

Code:
if( iPluginON ) {      server_cmd( "amx_autobhop %d 1" , get_user_userid( id ) ) }

Try this.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Melisko
Senior Member
Join Date: Feb 2010
Old 06-16-2011 , 18:07   Re: Cvar setting problem
Reply With Quote #7

.....
Melisko is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-16-2011 , 19:47   Re: Cvar setting problem
Reply With Quote #8

There is no way to set a single cvar (on/off cvar) for a single player. You would need to rewrite the plugin of interest to handle per-player settings.
__________________
fysiks is online now
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-17-2011 , 04:53   Re: Cvar setting problem
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
There is no way to set a single cvar (on/off cvar) for a single player. You would need to rewrite the plugin of interest to handle per-player settings.
So, you could use amx_autobhop #userid 0/1.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2011 , 16:23   Re: Cvar setting problem
Reply With Quote #10

Quote:
Originally Posted by Devil259 View Post
So, you could use amx_autobhop #userid 0/1.
Only if you make a command called amx_autobhop that functions that way.
__________________
fysiks 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 23:28.


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