AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   CVAR ERROR (https://forums.alliedmods.net/showthread.php?t=135606)

totalcsscripting 08-17-2010 18:56

CVAR ERROR
 
Please someone help me with this!

PHP Code:

new test

public plugin_init()
{
test register_cvar("active","1")
register_concmd("mix""function"ADMIN_SLAY"")
}


public function(
id) {
    if(
test==1){
        
client_print(idprint_chat"Is 1"
    }
        if(
test==0){
        
client_print(idprint_chat"Is 0"
    }



totalcsscripting 08-17-2010 18:57

Re: CVAR ERROR
 
Obviously my problem is that it doesnĄt work

RedRobster 08-17-2010 19:03

Re: CVAR ERROR
 
PHP Code:

if(get_pcvar_num(test))
    
//it doesn't equal 0
if(!get_pcvar_num(test))
    
//it equals 0 


SpeeDeeR 08-17-2010 19:07

Re: CVAR ERROR
 
Its because it doesnt work that way.
PHP Code:

#include<amxmodx> //hope you did this part
new test

public plugin_init()
{
test register_cvar("active","1")
register_concmd("mix""function"ADMIN_SLAY"")
}


public function(
id) {
    if(
get_pcvar_num(test) == 1//get_pcvar_num is the command
    
{
        
client_print(idprint_chat"Its 1"
    }
        else if(
get_pcvar_num(test) == 1)  client_print(idprint_chat"Its 0"
//if you cant modify the cvar to a value 
//greater than 1 then set the this part to :
//else client_print(id, print_chat, "Its 0")




All times are GMT -4. The time now is 21:57.

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