Raised This Month: $ Target: $400
 0% 

[SOLVED] [ENGINE] Invalid player 3 (not in-game)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edward0810
Member
Join Date: Mar 2009
Location: H.K.
Old 03-12-2010 , 10:28   [SOLVED] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #1

First I'll show the debugged plugin here:
PHP Code:
#include <amxmodx>
#include <engine>
new const pl_cm_class[] = "PlayerCamera"
new boolg_bCamera33 ] = false
new boolg_bCamera233 ] = false
public plugin_init()
{
 
register_plugin ("Camera""1.00""ot_207")
 
register_clcmd"say /cam""cmdCam" )
 
register_think(pl_cm_class,"Think_PlayerCamera")
 
register_event("ResetHUD""rhud_event""b")
}
public 
client_disconnect(id)
{
 
g_bCameraid ] = false
 g_bCamera2
id ] = false
}
public 
rhud_event(id)
{
 
g_bCamera2id ] = false
 
if (g_bCameraid ] == true)
 {
  
client_print(idprint_chat"[AMXX] To disable camera, say /cam.")
  
Create_PlayerCamera(id
 }
}
public 
cmdCam(id)
{
 if (
is_user_alive(id))
 {
  if (
g_bCameraid ] == false && g_bCamera2id ] == false)
  {
   
g_bCameraid ] = true
   client_print
(idprint_chat"[AMXX] Camera Enabled.")
   
Create_PlayerCamera(id
  }
  else if (
g_bCameraid ] == true && g_bCamera2id ] == false)
  {
   
g_bCameraid ] = false
   g_bCamera2
id ] = true
   client_print
(idprint_chat"[AMXX] Camera Disabled. Camera will be reset on your next respawn.")
   return 
PLUGIN_HANDLED
  
}
  else
  {
   
client_print(idprint_chat"[AMXX] You need to wait for the next respawn to enable camera.")
   return 
PLUGIN_HANDLED
  
}
 }
 else
 {
  
client_print(idprint_chat"[AMXX] You can't enable or disable camera while dead.")
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
Create_PlayerCamera(id

 new 
ent = -
 
while ((ent find_ent_by_class(ent,pl_cm_class)) != 0
 { 
  if (
entity_get_edict(ent,EV_ENT_owner) == id
  { 
   
attach_view(id ent
   return 
  } 
 } 
 
ent create_entity("info_target"
 if( !
ent 
 return; 
 
 
entity_set_string(entEV_SZ_classnamepl_cm_class
 
 
entity_set_model(ent"models/w_usp.mdl"
 
 
entity_set_byte(entEV_INT_solidSOLID_TRIGGER
 
entity_set_int(entEV_INT_movetypeMOVETYPE_FLYMISSILE
 
 
entity_set_edict(entEV_ENT_ownerid
 
 
entity_set_int(ent,EV_INT_rendermodekRenderTransTexture
 
entity_set_float(entEV_FL_renderamt0.0 
 
 
attach_view(id,ent
 
entity_set_float(entEV_FL_nextthinkget_gametime()) 

public 
Think_PlayerCamera(ent

 static 
owner 
 owner 
entity_get_edict(ent,EV_ENT_owner
 
/*
 static iButtons; 
 iButtons = entity_get_int(owner, EV_INT_button) 
 */
 
if(/* iButtons & IN_USE  || */!is_user_alive(owner)) 
 { 
  
attach_view(owner,owner
  
remove_entity(ent
  return 
PLUGIN_CONTINUE
 } 
 
 
 static 
Float:origin[3], Float:fAngle[3],Float:origin2[3]; 
 
entity_get_vector(owner,EV_VEC_origin,origin
 
entity_get_vector(owner,EV_VEC_v_angle,fAngle
 
 
origin2[0] = origin[0
 
origin2[1] = origin[1
 
origin2[2] = origin[2
 
 static 
Float:fVBack[3]; 
 
angle_vectorfAngleANGLEVECTOR_FORWARDfVBack ); 
 
 
origin[2] += 20.0
 
 
origin[0] += ( -fVBack[0] * 150.0 ); 
 
origin[1] += ( -fVBack[1] * 150.0 ); 
 
origin[2] += ( -fVBack[2] * 150.0 ); 
 
 
trace_line(owner,origin2,origin,origin
 
 
entity_set_vector(ent,EV_VEC_origin,origin
 
 
entity_get_vector(owner,EV_VEC_velocity,origin2
 
entity_set_vector(ent,EV_VEC_velocity,origin2
 
 
entity_set_vector(ent,EV_VEC_angles,fAngle
 
entity_set_float(entEV_FL_nextthinkget_gametime()) 
 
 return 
PLUGIN_CONTINUE

It works with no problem during game.
But, when i disconnect with camera enabled,
it shows me this error:
Code:
L 03/12/2010 - 23:19:00: Start of error session.
L 03/12/2010 - 23:19:00: Info (map "de_dust") (file "addons/amxmodx/logs/error_20100312.log")
L 03/12/2010 - 23:19:00: [ENGINE] Invalid player 3 (not in-game)
L 03/12/2010 - 23:19:00: [AMXX] Displaying debug trace (plugin "camera.amxx")
L 03/12/2010 - 23:19:00: [AMXX] Run time error 10: native error (native "attach_view")
L 03/12/2010 - 23:19:00: [AMXX]    [0] camera.sma::Think_PlayerCamera (line 103)
Why does this occur? Can someone fix this? Thanks A lot.

PS. 1 extra question. How to make the model alpha'd when camera is enabled for you only?
NO SET_VIEW.
__________________
I am a newbie. Don't blame for my stupid question

Last edited by edward0810; 03-27-2010 at 12:58.
edward0810 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-12-2010 , 10:31   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #2

use set_view
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-12-2010 , 10:32   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #3

Quote:
[ENGINE] Invalid player 3 (not in-game)
It means you try to execute a native (attach_view) on a player who is already disconnected. You should check if player is connected before. (is_user_connected)
__________________
Arkshine is offline
edward0810
Member
Join Date: Mar 2009
Location: H.K.
Old 03-12-2010 , 10:36   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
It means you try to execute a native (attach_view) on a player who is already disconnected. You should check if player is connected before. (is_user_connected)
I have no idea where I can insert the "is_user_connected" check.
Where should I put it?
__________________
I am a newbie. Don't blame for my stupid question
edward0810 is offline
edward0810
Member
Join Date: Mar 2009
Location: H.K.
Old 03-27-2010 , 02:09   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #5

bump...
__________________
I am a newbie. Don't blame for my stupid question
edward0810 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-27-2010 , 09:54   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #6

That error tells you exactly where you need the is_user_connected check (line 103). Also, please learn to properly indent your code.

PHP Code:
    if(/* iButtons & IN_USE  || */ is_user_connected(owner) && !is_user_alive(owner)) 
__________________

Last edited by Bugsy; 03-27-2010 at 09:57.
Bugsy is offline
edward0810
Member
Join Date: Mar 2009
Location: H.K.
Old 03-27-2010 , 12:08   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
That error tells you exactly where you need the is_user_connected check (line 103). Also, please learn to properly indent your code.

PHP Code:
    if(/* iButtons & IN_USE  || */ is_user_connected(owner) && !is_user_alive(owner)) 
First thanks for your reply.
i indented my code in pawn tudio but when pasting here a bunch of things appear.
__________________
I am a newbie. Don't blame for my stupid question
edward0810 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-27-2010 , 12:43   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
Also, please learn to properly indent your code.
Quote:
Originally Posted by edward0810 View Post
i indented my code in pawn tudio but when pasting here a bunch of things appear.
That happens only when you are using the WYSIWYG when posting threads. This is why I do not use it on this forum. You can change it in your profile settings.
__________________
fysiks is offline
edward0810
Member
Join Date: Mar 2009
Location: H.K.
Old 03-27-2010 , 12:52   Re: [HELP] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
That happens only when you are using the WYSIWYG when posting threads. This is why I do not use it on this forum. You can change it in your profile settings.
So I'm testing now CM:It looks too long o_o
PHP Code:
/* AMX Mod X
*   Teleport Menu Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>
#include <amxmisc>
#include <fun>

new g_menuPosition[33]
new 
g_menuPlayers[33][32]
new 
g_menuPlayersNum[33]
new 
g_menuOption[33] = {-1, ...}
new 
g_menuOrgin[33][3]
new 
g_coloredMenus

public plugin_init()
{
    
register_plugin("Teleport Menu"AMXX_VERSION_STR"AMXX Dev Team")
    
register_dictionary("telemenu.txt")
    
register_dictionary("common.txt")
    
register_clcmd("amx_teleportmenu""cmdTelMenu"ADMIN_CFG"- displays teleport menu")
    
register_menucmd(register_menuid("Teleport Menu"), 1023"actionTelMenu")
    
    
g_coloredMenus colored_menus()
}

public 
actionTelMenu(idkey)
{
    switch (
key)
    {
        case 
6:
        {
            
g_menuOption[id] = g_menuOption[id]
            
displayTelMenu(idg_menuPosition[id])
        }
        case 
7:
        {
            if (
g_menuOption[id] < 0)    /* unlocking position for the first time */
                
g_menuOption[id] = 0
            
            get_user_origin
(idg_menuOrgin[id])
            
displayTelMenu(idg_menuPosition[id])
        }
        case 
8displayTelMenu(id, ++g_menuPosition[id])
        case 
9displayTelMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
name2[32]
            
            
get_user_name(playername231)
            
            if (!
is_user_alive(player))
            {
                
client_print(idprint_chat"%L"id"CANT_PERF_DEAD"name2)
                
displayTelMenu(idg_menuPosition[id])
                return 
PLUGIN_HANDLED
            
}
            
            if (
g_menuOption[id] > 0)
            {
                
set_user_origin(playerg_menuOrgin[id])
            } else {
                new 
origin[3]
                
                
get_user_origin(idorigin)
                
set_user_origin(playerorigin)
            }
            
            new 
authid[32], authid2[32], name[32]
            
            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)
            
            
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^""nameget_user_userid(id), authidname2get_user_userid(player), authid2)
            
            
show_activity_key("ADMIN_TELEPORT_1""ADMIN_TELEPORT_2"namename2);
            
            
displayTelMenu(idg_menuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

displayTelMenu(idpos)

    if (
pos 0)
        return
    
    
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
    
    new 
menuBody[512]
    new 
0
    
new i
    
new name[32]
    new 
start pos 6
    
new bool:blockMenu = (is_user_alive(id) && g_menuOption[id] < 1) ? true false
    
    
if (start >= g_menuPlayersNum[id])
        
start pos g_menuPosition[id] = 0
    
    
new len format(menuBody511g_coloredMenus "\y%L\R%d/%d^n\w^n" "%L %d/%d^n^n"id"TELE_MENU"pos 1, (g_menuPlayersNum[id] / + ((g_menuPlayersNum[id] % 6) ? 0)))
    new 
end start 6
    
new keys MENU_KEY_0|MENU_KEY_8
    
    
if (end g_menuPlayersNum[id])
        
end g_menuPlayersNum[id]
    
    for (new 
startend; ++a)
    {
        
g_menuPlayers[id][a]
        
get_user_name(iname31)
        
        if (
blockMenu || !is_user_alive(i) || (id != && get_user_flags(i) & ADMIN_IMMUNITY))
        {
            ++
b
            
            
if (g_coloredMenus)
                
len += format(menuBody[len], 511-len"\d%d. %s^n\w"bname)
            else
                
len += format(menuBody[len], 511-len"#. %s^n"name)
        } else {
            
keys |= (1<<b)
            
            if (
is_user_admin(i))
                
len += format(menuBody[len], 511-leng_coloredMenus "%d. %s \r*^n\w" "%d. %s *^n", ++bname)
            else
                
len += format(menuBody[len], 511-len"%d. %s^n", ++bname)
        }
    }
    
    if (
g_menuOption[id] > 0)    // 1
    
{
        
keys |= MENU_KEY_7
        len 
+= format(menuBody[len], 511-len"^n7. To location: %d %d %d^n"g_menuOrgin[id][0], g_menuOrgin[id][1], g_menuOrgin[id][2])
    }
    else if (
g_menuOption[id])    // -1
    
{
        if (
g_coloredMenus)
            
len += format(menuBody[len], 511-len"^n\d7. %L^n\w"id"CUR_LOC")
        else
            
len += format(menuBody[len], 511-len"^n#. %L^n"id"CUR_LOC")
    } else {                    
// 0
        
keys |= MENU_KEY_7
        len 
+= format(menuBody[len], 511-len"^n7. %L^n"id"CUR_LOC")
    }
    
    
len += format(menuBody[len], 511-len"8. %L^n"id"SAVE_LOC")
    
    if (
end != g_menuPlayersNum[id])
    {
        
format(menuBody[len], 511-len"^n9. %L...^n0. %L"id"MORE"idpos "BACK" "EXIT")
        
keys |= MENU_KEY_9
    
}
    else
        
format(menuBody[len], 511-len"^n0. %L"idpos "BACK" "EXIT")
    
    
show_menu(idkeysmenuBody, -1"Teleport Menu")
}

public 
cmdTelMenu(idlevelcid)
{
    if (
cmd_access(idlevelcid1))
        
displayTelMenu(idg_menuPosition[id] = 0)
    
    return 
PLUGIN_HANDLED

__________________
I am a newbie. Don't blame for my stupid question

Last edited by edward0810; 03-28-2010 at 03:40. Reason: changed format
edward0810 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-27-2010 , 13:42   Re: [SOLVED] [ENGINE] Invalid player 3 (not in-game)
Reply With Quote #10

Use [php][/php]
__________________
fysiks is offline
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 08:40.


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