Raised This Month: $ Target: $400
 0% 

Help about check...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 10-11-2010 , 14:02   Help about check...
Reply With Quote #1

Code:
new_2.sma(55) : warning 213: tag mismatch
new_2.sma(59) : warning 213: tag mismatch
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define TIME 10.0
#define ACCESS ADMIN_RESERVATION

new Float:player_origin[33][3];

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"player""e_Spawn"1);
}
 
public 
e_Spawn(id)
{
    
remove_task(id)
    if(
is_user_alive(id))
    {
        
set_task(0.8"get_spawn"id);
    }
    return 
HAM_IGNORED;
}

public 
get_spawn(id)
{
    
pev(idpev_originplayer_origin[id]);
    
set_task(TIME"check_afk"id);
}
 
public 
check_afk(id)
{
    if(
is_user_alive(id))
    {
        if(
same_origin(id))
        {
            
user_silentkill(id);
            
cs_set_user_team(id,CS_TEAM_SPECTATOR);
            new 
name[33];
            
get_user_name(idname32);
            
client_print(0print_chat,  "[AMXX] %s was killed and moved: AFK!"name);
            
set_task(70.0,"check_afk_spec",id);
        }
    }    
}

public 
check_afk_spec(id)
{
    if(
is_user_alive(id))
    {
        if(
same_origin(id))
        {
            if(!
get_user_flags(id) & ACCESS){
                return 
PLUGIN_HANDLED
                    
}
                    else{
                        if(!
cs_get_user_team(id) == CS_TEAM_SPECTATOR){
                            new 
name[32]
                            
get_user_name(idname31)
                            
server_cmd("kick %s AFK!"name)
                            
client_print(0print_chat"[AMXX] %s was kicked: AFK!"name)
                            }
                        }
        }
    }
    return 
PLUGIN_CONTINUE
}
 
public 
same_origin(id)
{
    new 
Float:origin[3];
    
pev(idpev_originorigin);
    for(new 
03i++)
        if(
origin[i] != player_origin[id][i])
            return 
0;
    return 
1;

I don't know why I getting this warning, what I did wrong? (also, the script wasn't checked)
killergirl is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 10-11-2010 , 14:22   Re: Help about check...
Reply With Quote #2

PHP Code:
 if(!cs_get_user_team(id) == CS_TEAM_SPECTATOR){ 
This line doesn't mean "if player team is different to CS_TEAM_SPECTATOR". This line get the user team and it denies. If team = 3, 2, or 1 returns 0, if 0 returns 1.
The correct form to do this is:
PHP Code:
 if(cs_get_user_team(id) != CS_TEAM_SPECTATOR){ 
And this other:
PHP Code:
if(!get_user_flags(id) & ACCESS){ 
With this code you are obtaining the id's flags and denying it.
The correct way: using brackets.
PHP Code:
if(! (get_user_flags(id) & ACCESS) ){ 
Mxnn is offline
Old 10-11-2010, 14:24
nikhilgupta345
This message has been deleted by nikhilgupta345. Reason: beat me to it
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 10:26.


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