Raised This Month: $51 Target: $400
 12% 

check user weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Closer456
Member
Join Date: May 2013
Old 06-11-2013 , 02:14   check user weapon
Reply With Quote #1

how do u check a player weapon model every x second?
Closer456 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-11-2013 , 02:53   Re: check user weapon
Reply With Quote #2

Checking a weapon model for what?

PHP Code:
#include amxmodx
#include fakemeta

const FloatSeconds_Interval 0.3;

new 
Floatg_LastStamp33 ];
new 
g_ClientWeaponModel33 ][ 128 ]; // v_*.mdl
new g_ClientWeaponPlayerModel33 ][ 128 ]; // p_*.mdl

public plugin_init( )
{
  
register_forwardFM_PlayerPreThink"OnClientFrame" );
}

public 
OnClientFrameClient )
{
  if( !
is_user_aliveClient )
  {
    return;
  }

  static 
Time;
  
Time get_gametime( );

  if( 
Time g_LastStampClient ] >= Seconds_Interval )
  {
    
RetrieveUserWeaponModelClient );

    
g_LastStampClient ] = Time;
  }
}

RetrieveUserWeaponModelClient )
{
  
// g_ClientWeaponModel[ Client ] may be for example "models/v_knife.mdl"
  
pevClientpev_viewmodel2g_ClientWeaponModelClient ], sizeofg_ClientWeaponModel[ ] ) - );

  
// g_ClientWeaponPlayerModel[ Client ] may be for example "models/p_knife.mdl"
  
pevClientpev_weaponmodel2g_ClientWeaponPlayerModelClient ], sizeofg_ClientWeaponModel[ ] ) - );

__________________

Last edited by claudiuhks; 06-11-2013 at 03:07.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
xPez
Member
Join Date: Apr 2013
Location: Sweden
Old 06-11-2013 , 02:54   Re: check user weapon
Reply With Quote #3

More information please.

Last edited by xPez; 06-11-2013 at 03:08.
xPez is offline
Send a message via Skype™ to xPez
Closer456
Member
Join Date: May 2013
Old 06-11-2013 , 03:03   Re: check user weapon
Reply With Quote #4

Quote:
Originally Posted by claudiuhks View Post
Checking a weapon model for what?
Well I have a custom plugin that changes the model but the model resets every time the round ends or restarts, So the player needs to switch their weapon everytime to see the model.
Closer456 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-11-2013 , 03:04   Re: check user weapon
Reply With Quote #5

Quote:
Originally Posted by Closer456 View Post
Well I have a custom plugin that changes the model but the model resets every time the round ends or restarts, So the player needs to switch their weapon everytime to see the model.
Then I updated my post.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Closer456
Member
Join Date: May 2013
Old 06-11-2013 , 03:16   Re: check user weapon
Reply With Quote #6

thanks
Closer456 is offline
Closer456
Member
Join Date: May 2013
Old 06-11-2013 , 03:47   Re: check user weapon
Reply With Quote #7

ehh its kinda hard to understand.

I get errors on compile..

Heres the original code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <Vexd_Utilities>

new model[32
public 
plugin_init()
{
    
register_event("CurWeapon""event_current_weapon""be""1=1")
    
register_event("ResetHUD""newSpawn""b")
}

public 
plugin_precache()
{
    
precache_model("models/cso/v_hegrenade_w.mdl")
    
precache_model("models/cso/v_trollnade.mdl")
}

public 
event_current_weapon(id)
{
    if (
read_data(2) == CSW_HEGRENADE)
    {
    
cs_get_user_model(idmodelcharsmax(model))
    if (
equal(model"AdminG") == || equal(model"AdminA") == || equal(model"Nee") == || equal(model"moon2") == || equal(model"moon1") == || equal(model"RRG") == 1)
    {
    
set_pev(idpev_viewmodel2"models/cso/v_hegrenade_w.mdl")
    }
    else{
    
set_pev(idpev_viewmodel2"models/cso/v_trollnade.mdl")
    }
}
    return 
PLUGIN_CONTINUE


Last edited by Closer456; 06-11-2013 at 11:50.
Closer456 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-11-2013 , 04:09   Re: check user weapon
Reply With Quote #8

Remove this line
Code:
#include <Vexd_Utilities>
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 05:32.


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