AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   tag mismatch 213 (https://forums.alliedmods.net/showthread.php?t=146448)

killergirl 12-28-2010 07:52

tag mismatch 213
 
PHP Code:

public make(id)
{
       if(!(
cs_get_user_team(id) == CS_TEAM_SPECTATOR))
       {
        
console_print(id"You don't have access!")
        return 
PLUGIN_HANDLED
       
}


What am I doing wrong?

crazy.cipry 12-28-2010 07:58

Re: tag mismatch 213
 
I don't get any tag mismatch :-?

You should use:
PHP Code:

if( cs_get_user_team(id) != CS_TEAM_SPECTATOR 


Exolent[jNr] 12-28-2010 13:16

Re: tag mismatch 213
 
@killergirl
Are you using the cstrike module or is cs_get_user_team() and the corresponding constants defined in your code?

Quote:

Originally Posted by crazy.cipry (Post 1380842)
You should use:
PHP Code:

if( cs_get_user_team(id) != CS_TEAM_SPECTATOR ) ) 


There is no difference.

GXLZPGX 12-28-2010 14:09

Re: tag mismatch 213
 
Quote:

Originally Posted by Exolent[jNr] (Post 1381043)
@killergirl
Are you using the cstrike module or is cs_get_user_team() and the corresponding constants defined in your code?



There is no difference.

Yeah there is. He screwed up the parentheses lol.

PHP Code:

if( cs_get_user_team(id) != CS_TEAM_SPECTATOR ) ) 

The way he wrote it, there's an odd number of parentheses.

Exolent[jNr] 12-28-2010 14:51

Re: tag mismatch 213
 
Quote:

Originally Posted by GXLZPGX (Post 1381092)
Yeah there is. He screwed up the parentheses lol.

PHP Code:

if( cs_get_user_team(id) != CS_TEAM_SPECTATOR ) ) 

The way he wrote it, there's an odd number of parentheses.

:roll: He was talking about the logic. I'm sure his post was just a typo.

killergirl 12-28-2010 15:48

Re: tag mismatch 213
 
Yes, I'm using cstrike module.


[IMG]http://img209.**************/img209/9240/36515520.png[/IMG]

Exolent[jNr] 12-28-2010 16:02

Re: tag mismatch 213
 
I still can't understand why it is like that.
Can you post the full code?

killergirl 12-28-2010 16:36

Re: tag mismatch 213
 
PHP Code:

/* http://forums.alliedmods.net/showthread.php?p=551999#post551999
*
* Changelog
* added cvar amx_inv_dead_percent <value>
*
*/

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#if AMXX_VERSION_NUM < 180
    #define charsmax(%1)    sizeof(%1) - 1
#endif

#define MAX_PLAYERS    32

#define DEAD_FLAG   (1<<0)

#define OFFSET_TEAM     114

enum {
     
CS_TEAM_UNASSIGNED,
     
CS_TEAM_T,
     
CS_TEAM_CT,
     
CS_TEAM_SPECTATOR
}

new 
bool:g_roundend
new pcvar_percent
new g_invisible[MAX_PLAYERS+1][2]
new 
gmsgScoreAttribgmsgTeamInfo

public plugin_init() {
    
register_plugin("Invisible Spectator""0.2""ConnorMcLeod")

    
pcvar_percent register_cvar("amx_inv_dead_percent""40")

    
register_clcmd("amx_spectate""make_invis")
    
register_clcmd("amx_spectator""make_invis")

    
gmsgScoreAttrib get_user_msgid("ScoreAttrib")
    
gmsgTeamInfo get_user_msgid("TeamInfo")

    
register_messagegmsgScoreAttrib"msg_ScoreAttrib")
    
register_messagegmsgTeamInfo"msg_TeamInfo")

    
register_event("HLTV""eNewRound""a""1=0""2=0")
    
register_logevent("eRoundEnd"2"1=Round_End")
    
register_event("ResetHUD""eResetHUD""be")
    
register_event("DeathMsg""eDeathMsg""a")
}

public 
make_invis(id) {
    if( !(
get_user_flags(id) & ADMIN_KICK) )
        return 
PLUGIN_CONTINUE
    
    
//aaa
    
    
if(!(cs_get_user_team(id) == CS_TEAM_SPECTATOR))
    {
        
client_print(idprint_console"You need to be spectator to use the command!")
        return 
PLUGIN_HANDLED
    
}
    else
    {
    
    if(
g_invisible[id][0])
    {
        
client_print(idprint_console"You are visible!")
        
g_invisible[id][0] = 0
        
return PLUGIN_HANDLED
    
}
        
    if( 
is_user_alive(id) )
    {
        
client_print(idprint_console"You need to be dead to use the command!")
        return 
PLUGIN_HANDLED
    
}

    
g_invisible[id][0] = 1
    client_print
(idprint_console"You become invisible!")

    new 
team get_pdata_int(idOFFSET_TEAM)
    if( 
CS_TEAM_T <= team <= CS_TEAM_CT )
    {
        
g_invisible[id][1] = team
        set_pdata_int
(idOFFSET_TEAMCS_TEAM_SPECTATOR)
    }
    else
    {
        new 
players[MAX_PLAYERS], tnumctnum
        get_players
(playerstnum"e""TERRORIST")
        
get_players(playersctnum"e""CT")
        
g_invisible[id][1] = ctnum tnum 2
    
}

    
send_ScoreAttrib(id0)

    new 
teamname[12]
    switch( 
g_invisible[id][1] )
    {
        case 
1:formatex(teamnamecharsmax(teamname), "TERRORIST")
        case 
2:formatex(teamnamecharsmax(teamname), "CT")
    }
    
send_TeamInfo(idteamname)

    return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
eDeathMsg() {
    if(
g_roundend)
        return

    new 
players[MAX_PLAYERS], deadinumplayerFloat:percent get_pcvar_float(pcvar_percent) / 100.0
    get_players
(playersdead"bh")
    
get_players(playersinum"h")

    if( 
float(dead) / float(inum) < percent
        return

    for(new 
iinumi++)
    {
        
player players[i]
        if( 
g_invisible[player][0] )
            
send_ScoreAttrib(playerDEAD_FLAG)
    }
}

public 
eNewRound() {
    
g_roundend false
    
new players[MAX_PLAYERS], inumplayer
    get_players
(playersinum)
    for(new 
iinumi++)
    {
        
player players[i]
        if( 
g_invisible[player][0] )
            
send_ScoreAttrib(player0)
    }
}

public 
eRoundEnd() {
    
g_roundend true
    
new players[MAX_PLAYERS], inumplayer
    get_players
(playersinum)
    for(new 
iinumi++)
    {
        
player players[i]
        if( 
g_invisible[player][0] )
            
send_ScoreAttrib(playerDEAD_FLAG)
    }
}

public 
eResetHUD(id) {
    if( 
g_invisible[id][0] )
        
g_invisible[id][0] = 0
}

// Doesn't seem to work so set flag to 0 at NewRound event.
public msg_ScoreAttrib(msg_typemsg_desttarget) {
    if(!
g_invisible[get_msg_arg_int(1)][0])
        return 
PLUGIN_CONTINUE

    
new flags get_msg_arg_int(2)
    if(
flags DEAD_FLAG)
        
set_msg_arg_int(20flags & ~DEAD_FLAG)

    return 
PLUGIN_CONTINUE 
}

public 
msg_TeamInfo(msg_typemsg_desttarget) {
    new 
id get_msg_arg_int(1)
    if(!
g_invisible[id][0])
        return 
PLUGIN_CONTINUE

    
new teamname[12]
    
get_msg_arg_string(2teamnamecharsmax(teamname))
    if( 
g_invisible[id][1] == CS_TEAM_T && strcmp(teamname"TERRORIST") != )
        
set_msg_arg_string(2"TERRORIST")
    else if( 
g_invisible[id][1] == CS_TEAM_CT && strcmp(teamname"CT") != )
        
set_msg_arg_string(2"CT")

    return 
PLUGIN_CONTINUE
}

send_ScoreAttrib(idflags)
{
    
message_begin(MSG_ALLgmsgScoreAttrib_0)
    
write_byte(id)
    
write_byte(flags)
    
message_end()
}

send_TeamInfo(idteamname[])
{
    
message_begin(MSG_ALLgmsgTeamInfo_0)
    
write_byte(id)
    
write_string(teamname)
    
message_end()



Exolent[jNr] 12-28-2010 16:58

Re: tag mismatch 213
 
I asked if you had defined the CS_TEAM_* constants and you just said you were using the cstrike module.

Change this:
Code:
    if(!(cs_get_user_team(id) == CS_TEAM_SPECTATOR))
to this:
Code:
    if(!(_:cs_get_user_team(id) == CS_TEAM_SPECTATOR))
or:
Code:
    if(!(cs_get_user_team(id) == CsTeams:CS_TEAM_SPECTATOR))

killergirl 12-28-2010 17:53

Re: tag mismatch 213
 
Thank you, now it's working!

Quote:

I asked if you had defined the CS_TEAM_* constants and you just said you were using the cstrike module.
Sorry, it was my fault, because i rushed up.


All times are GMT -4. The time now is 02:13.

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