Raised This Month: $ Target: $400
 0% 

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


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


Thread Tools
Display Modes

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