AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Help With a Script (https://forums.alliedmods.net/showthread.php?t=100798)

deadman909 08-18-2009 03:32

Need Help With a Script
 
Error
http://www.crazyeffect.net/pictures/error.png
PHP Code:

    register_concmd("amx_clanvsall","allvsclan",ADMIN_MENU," Clan Vs. Everyone Else <Clan Tag> <Clan Team: CT or T> ")
    
register_concmd("amx_unclanvsall","allvsall",ADMIN_MENU," Allows People To Join Other Teams Again. ")

    
register_forward(FM_PlayerPreThink,"FM_PreThink")

    
MAXPLAYERS get_maxplayers()
    
    
SVC_SCREENFADE get_user_msgid"ScreenFade" )
    
SVC_SCREENSHAKE get_user_msgid"ScreenShake" )
    
WTF_DAMAGE get_user_msgid"Damage" )

    
g_MsgSync CreateHudSyncObj()

#if defined DAMAGE_RECIEVED
    
g_MsgSync2 CreateHudSyncObj()
#endif

    
new config_dir[80]
    
get_configsdir(config_dir,79)
    
format(file_name,127,"%s/%s",config_dir,CONFIG_FILE// store path/file in global 'file_name'
    
    
new text[256],name[33],steamid[33],txtLen,line_num=0
    
// parse config file if exists
    
if (file_exists(file_name)){
        
line_num=read_file(file_name,line_num,text,255,txtLen// read first line
        
while(line_num){
            
parse(text,steamid,32,name,32)
            if (
line_num<=MAX_USERS){ // stop caching if MAX_USERS reached
                
if (strlen(steamid) && strlen(name)){
                    
// cache (SteamID -> PlayerName) pairs
                    
format(steam_names[line_num-1][0],34,"%s",steamid)
                    
format(steam_names[line_num-1][1],34,"%s",name)
                    
num_users=line_num // update number of listed users
                
}
                
line_num=read_file(file_name,line_num,text,255,txtLen// read next line
            
}else line_num=// MAX_USERS reached stop parsing
        
}
    }
}

public 
allvsclan(id,level,cid)
{
    if(!
cmd_access(id,level,cid,3))
    {
        return 
PLUGIN_HANDLED
    
}

    new 
arg1[32]
    new 
arg2[32]
    
read_argv(1,arg1,31)
    
read_argv(2,arg2,31)

    if(
equali(arg2,"CT")) CT=true           //This are the 2 LINES where i get the Errors
    
else if(equali(arg2,"T")) CT=false      //This are the 2 LINES where i get the Errors
    
else
    {
        
console_print(id,"Invalid Team")
        return 
PLUGIN_HANDLED
    
}

    
format(tag,31,"%s",arg1


Bad_Bud 08-18-2009 03:59

Re: Need Help With a Script
 
Hi. The reason you're getting errors is not from this code segment, but probably from something before it that you haven't posted, like a bracket you forgot to open or close before this point. I copied and pasted the code into a plugin and it compiled fine. If you wouldn't mind, please post the entirety of the code, and we can try to find the syntactical error, wherever it is. One error will often lead to multiple errors in areas that are actually correct.

As well, I personally think you should have the result of your conditional statements be on the lines below the statement, because what you have is a little hard for me to read.

And finally, why have you tried to cover up that your Windows user name is "deadman"? It's not like that's not your forum account name...

xPaw 08-18-2009 04:14

Re: Need Help With a Script
 
more code plox

deadman909 08-18-2009 07:04

Re: Need Help With a Script
 
i put more of the Code up

xPaw 08-18-2009 08:59

Re: Need Help With a Script
 
Show where you create CT variable

Bad_Bud 08-18-2009 10:56

Re: Need Help With a Script
 
If you don't want to post the whole thing, and if you don't mind, you could send one of us the full script in a PM and we could probably find the error for you. The snippets aren't long enough.

On a second note, what you did post this time I still managed to compile, after creating all of the variables for it.

deadman909 08-18-2009 12:19

Re: Need Help With a Script
 
Ive decided not to Put it in the Plugin to much Trouble. But thanks for the Help


All times are GMT -4. The time now is 15:14.

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