Raised This Month: $ Target: $400
 0% 

View Test, some questions.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
caffeine
Member
Join Date: Apr 2008
Old 01-12-2009 , 13:23   View Test, some questions.
Reply With Quote #1

this is just an idea. i dont like to test it with heavy code.


useage:

"say /1" - Start record
"say /2" - Stop record
"say /view" - View record


PHP Code:
// VIEW TEST
// thx many ppl help me to achieve this effect @ alliedmods & xtreme-jumps & kzcn(ccser,simen,97club,xlm,kzfun...)
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#pragma semicolon 1
new booltimer_started[33]; // this is just a test value. in kz plugin, it means if have pressed Start button
new boolisView[33];
new 
Num[33]; // current frames
new AllNum// record frames
new Float:g_StartTime[33];
new Array: 
curPos[33];
new Array: 
curAngle[33];
 
public 
plugin_init()
{
 
register_forwardFM_PlayerPreThink"PreThink" );
 for( new 
i=1i<33i++ )
 {
  
curPos[i] = ArrayCreate(3,32);
  
curAngle[i] = ArrayCreate(3,32);
 }
 
register_clcmd"say /1""one" ); // Start record
 
register_clcmd"say /2""two" ); // End record
 
register_clcmd"say /view""view" ); // View record
}
 
public 
client_disconnect(id)
{
 
timer_started[id] = false;
 
isView[id] = false;
}
 
public 
one(id)
{
 
Num[id] = 0;
 
ArrayClearcurPos[id] );
 
ArrayClearcurAngle[id] );
 
g_StartTime[id] = get_gametime();
 
timer_started[id] = true;
 
client_printidprint_chat"Start!" );
 return 
PLUGIN_HANDLED;
}
 
public 
two(id)
{
 
timer_started[id] = false;
 
AllNum Num[id];
 
client_printidprint_chat"gTime: %.3f | arrSize: %d | AllNum: %d"get_gametime() - g_StartTime[id], ArraySizecurPos[id] ), AllNum );
 
client_printidprint_chat"Stop!" );
 return 
PLUGIN_HANDLED;
}
 
public 
PreThink(id)
{
 if( 
timer_started[id] )
 {
  static 
vOrigin[3], vAngle[3];
  
pevid,pev_originvOrigin );
  
pevid,pev_v_anglevAngle );
  
ArrayPushArraycurPos[id], vOrigin );
  
ArrayPushArraycurAngle[id], vAngle );
  
Num[id]++;
 }
 else if( 
isView[id] )
 {
  if( 
Num[id] < AllNum )
  {
   static 
vOriginView[3], vAngleView[3];
   
ArrayGetArraycurPos[id], Num[id], vOriginView );
   
ArrayGetArraycurAngle[id], Num[id], vAngleView );
   
set_pevidpev_originvOriginView );
   
set_pevidpev_anglesvAngleView ); // HERE if using "set_pev(..,pev_v_angle,..)" cant work, dont know why? i've spent lots of time on this fucked angle shit..
   
set_pevidpev_fixangle);
   
Num[id]++;
  }
  else
  {
   
view(id);
  }
 }
}
 
public 
view(id)
{
 if( !
is_user_alive(id) )
  
ExecuteHamHam_CS_RoundRespawnid );
 if( 
isView[id] )
 {
  
isView[id] = false;
  
ExecuteHamHam_CS_RoundRespawnid );
  
client_printidprint_chat"Exit !!" );
 }
 else if( 
AllNum )
 {
  
isView[id] = true;
  
timer_started[id] = false;
  
Num[id] = 0;
  
// copy someone's kz plugin code
  
set_pevidpev_movetypeMOVETYPE_NOCLIP );
  
set_pevidpev_solidSOLID_NOT );
  
set_pevidpev_effectsEF_NODRAW );
  
set_pevidpev_deadflagDEAD_RESPAWNABLE ); // DEAD -> DEAD_RESPAWNABLE (just modify this :D)
  
set_pevidpev_takedamageDAMAGE_NO );
  
fm_set_entity_flagsidFL_FROZEN);
  
client_printidprint_chat"Viewing ...." );
 }
 else
  
client_printidprint_chat"There's no record!" );
 return 
PLUGIN_HANDLED;
}
 
public 
Event_GameWillRestartIn()
{
 for( new 
id=1id<33id++ )
 {
  
timer_started[id] = false;
  
isView[id] = false;
 }


question:

1. if i use this on a cs server, it will take much cpu/memory or lag ?

2. if ArraySize = 360000 (1 hour) / or even more arrays, how about question 1 ? or even crash ?
Attached Files
File Type: sma Get Plugin or Get Source (viewtest.sma - 521 views - 3.2 KB)

Last edited by caffeine; 01-12-2009 at 13:36.
caffeine 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 01:48.


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