Raised This Month: $ Target: $400
 0% 

pcvar help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sphott
Member
Join Date: May 2010
Old 07-21-2010 , 08:48   pcvar help
Reply With Quote #1

I have created a plugin and a guy sad use pcvar etc...
and I tried use pcvar first and i don't know my work is ok, or dont.
if you have some time, plz check it out
I dont know when I use global and local variables too.
its complicated for me at first time, how to use string and others
I dont want to create crap
ty
Attached Files
File Type: sma Get Plugin or Get Source (reportcheater.sma - 704 views - 16.8 KB)
__________________

SilenceGaming.com - [HUN] Neptune 79.172.211.29:27019
AIM/FFA CSDM




sphott is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-21-2010 , 10:15   Re: pcvar help
Reply With Quote #2

pcvars work like this.

PHP Code:
#include <amxmodx>

new cvar_on // Make a global var to store your cvar

public plugin_init()
{
    
cvar_on register_cvar("amx_stuff""1"); // Register your cvar and store it in cvar_on
    // Do your other stuff
}

public 
client_connect(id)
{
    if(
get_pcvar_num(cvar_on)) // If your cvar is on
    
{
        
// do stuff
    
}

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
sphott
Member
Join Date: May 2010
Old 07-21-2010 , 12:37   Re: pcvar help
Reply With Quote #3

Quote:
Originally Posted by drekes View Post
pcvars work like this.

PHP Code:
#include <amxmodx>

new cvar_on // Make a global var to store your cvar

public plugin_init()
{
    
cvar_on register_cvar("amx_stuff""1"); 
}

public 
client_connect(id)
{
    if(
get_pcvar_num(cvar_on)) // If your cvar is on
    
{
        
// do stuff
    
}

Its ok, but most of my cvars are string and I don't know how to use string pcvars. What is the optimal store of string in global or in local variable.
I think the local, but what is the number of local equal a global cpu usage.
in your example:
PHP Code:
#include <amxmodx>

new cvar_on // Make a global var to store your cvar

public plugin_init()
{
    
cvar_on register_cvar("amx_stuff""doh"); // Register your cvar and store it in cvar_on
    // Do your other stuff
}

public 
dob1(id)
{
   new 
string[3]
   
string get_pcvar_string(cvar_on,string,3)
    
client_print....
}
public 
dob2(id)
{
   new 
string[3]
   
string get_pcvar_string(cvar_on,string,3)
   
client_print....
}
...
...
public 
dobx(id)
{
   new 
string[3]
   
string get_pcvar_string(cvar_on,string,3)
   
client_print....

And why is this solution works better with string, than cvar. Or is another way?
__________________

SilenceGaming.com - [HUN] Neptune 79.172.211.29:27019
AIM/FFA CSDM




sphott is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-21-2010 , 13:02   Re: pcvar help
Reply With Quote #4

PHP Code:
public dob1(id

   new 
string[3
   
string get_pcvar_string(cvar_on,string,3
   
client_print.... 

-->

PHP Code:
public dob1(id

   new 
string[3
   
get_pcvar_string(cvar_on,string,3
   
client_print(idprint_chat"string: %s"string);

__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-21-2010 , 13:55   Re: pcvar help
Reply With Quote #5

Quote:
Originally Posted by Alucard^ View Post
PHP Code:
public dob1(id

   new 
string[3
   
string get_pcvar_string(cvar_on,string,3
   
client_print.... 

-->

PHP Code:
public dob1(id

   new 
string[3
   
get_pcvar_string(cvar_on,string,3
   
client_print(idprint_chat"string: %s"string);



PHP Code:
public dob1(id

   new 
string[3
   
get_pcvar_string(cvar_on,string,charsmax(string)) 
   
client_print(idprint_chat"string: %s"string);

__________________
fysiks is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-21-2010 , 14:28   Re: pcvar help
Reply With Quote #6

Oh, didn't paid attention to the 3, sry.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
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 07:16.


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