Raised This Month: $51 Target: $400
 12% 

need help with little plugin)))


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
S@ndel
Junior Member
Join Date: Mar 2005
Old 10-15-2007 , 00:03   need help with little plugin)))
Reply With Quote #1

Yesterday i decide to write little plugin, that change some value on clients, when there will connect to server...

My code )
Code:
new PLUGIN[]="changestset" 
new AUTHOR[]="S@ndel" 
new VERSION[]="1.4"
new check_st = 0


public plugin_init() 
{ 
    // Register plugin 
    register_plugin(PLUGIN, VERSION, AUTHOR) 
    return PLUGIN_CONTINUE  
} 

public client_connect(id)  
{
	
	query_client_cvar(id, "cl_updaterate","updaterate")

	query_client_cvar(id, "cl_cmdrate","cmdrate")

	query_client_cvar(id, "rate","rate")

	
	
	yaebu(id)
	
	// log section start
	//server_print("----------------")
	//server_print("Here [%d] check_st: %d",id,check_st)
	//server_print("%s | %s | %s",value_updaterate,value_cmdrate,value_rate)
	//server_print("----------------")
	
	// log section end
	
	
	/*if(check_st == 1)
	{
		client_print(id,print_console,"[AMXX]: Some values was changed in your settings...")
	} else {
		client_print(id,print_console,"[AMXX]: NO values was changed in your settings...")
	}*/
	
	
	return PLUGIN_HANDLED 
} 

public updaterate(id, const cvar[], const value_updaterate[]){
	
		if(!equali("66",value_updaterate)){
		client_cmd(id,"cl_updaterate 66")
		check_st = 1
		}
		
	
	server_print("OK! %s",value_updaterate)
	
}
public cmdrate(id, const cvar[], const value_cmdrate[]){
	
	if(!equali("66",value_cmdrate)){
		client_cmd(id,"cl_cmdrate 66")
		check_st = 1
		}
	server_print("OK! %s",value_cmdrate)
	
}
public rate(id, const cvar[], const value_rate[]){
	
	if(!equali("20000",value_rate)){
		client_cmd(id,"rate 20000")
		check_st = 1
		}
	server_print("OK! %s",value_rate)
	
}

public yaebu(id){
	server_print("Here [%d] check_st: %d",id,check_st)
if(check_st == 1)
	{
		client_print(id,print_console,"[AMXX]: Some values was changed in your settings...")
	} else {
		client_print(id,print_console,"[AMXX]: NO values was changed in your settings...")
	}
	
}
So, for example, client has rate 15000
... we got query_client_cvar(id, "rate","rate")
In this function
blablabla
check_st = 1
next we have yaebu(id) function )
There var check_st is 0 ... why??? :/
I can't understand...

sr for my english)
S@ndel is offline
Send a message via ICQ to S@ndel
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-15-2007 , 00:09   Re: need help with little plugin)))
Reply With Quote #2

Is that... a... slowhack??
__________________
M249-M4A1 is offline
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 10-15-2007 , 00:37   Re: need help with little plugin)))
Reply With Quote #3

mybad..

i suggest make that varable global for each player meaning check_st[33]
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME

Last edited by kp_uparrow; 10-16-2007 at 20:35.
kp_uparrow is offline
Ryu2877
Member
Join Date: Sep 2006
Location: China
Old 10-15-2007 , 01:04   Re: need help with little plugin)))
Reply With Quote #4

Maybe you can use "client_putinserver" forward to instead "client_connect".
Ryu2877 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-15-2007 , 01:05   Re: need help with little plugin)))
Reply With Quote #5

@kp_uparrow:

You're wrong.

They are called from query_client_cvar( id, const cvar[], const resultFunc[] );
__________________
Arkshine is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 10-15-2007 , 03:25   Re: need help with little plugin)))
Reply With Quote #6

Also, comparing the strings isn't the most effective way since it's actually an integer you're comparing.

Better to use

if( str_to_num(value_rate) != 66 )

If that still doesn't work, set check_st to str_to_num(value_rate) each time and see if you're even getting the value.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
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 13:01.


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