AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   need help with little plugin))) (https://forums.alliedmods.net/showthread.php?t=61962)

S@ndel 10-15-2007 00:03

need help with little plugin)))
 
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)

M249-M4A1 10-15-2007 00:09

Re: need help with little plugin)))
 
Is that... a... slowhack??

kp_uparrow 10-15-2007 00:37

Re: need help with little plugin)))
 
mybad..

i suggest make that varable global for each player meaning check_st[33]

Ryu2877 10-15-2007 01:04

Re: need help with little plugin)))
 
Maybe you can use "client_putinserver" forward to instead "client_connect".

Arkshine 10-15-2007 01:05

Re: need help with little plugin)))
 
@kp_uparrow:

You're wrong.

They are called from query_client_cvar( id, const cvar[], const resultFunc[] );

Wilson [29th ID] 10-15-2007 03:25

Re: need help with little plugin)))
 
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.


All times are GMT -4. The time now is 20:54.

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