Raised This Month: $ Target: $400
 0% 

Spectator Mode Delayed Process


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asdian
Member
Join Date: Sep 2016
Location: Indonesia
Old 03-13-2022 , 22:12   Spectator Mode Delayed Process
Reply With Quote #1

Hello there

So i have a problem as title wrote. I'm making a plugin when spectating player, will change v_model's body. Apparently it works, but delayed for few seconds. E.g. when spectating [BOT] Zach, his hands is using body 2 then after like 3s it will changed to body 3 which is what it should be. How to make it 'instantly' updated ?

*edit
Sometimes need to cycle through other players and switching spectator mode first to make it updated

*edit2
I'm using module called metadrawer for changing model body

PHP Code:
public plugin_init() 

    
// Register New Addon 
    
register_plugin(ADDON_NAMEADDON_VERSIONADDON_AUTHOR);

    
register_event("StatusValue","SpecTo_Target","bd","1=2")
    
register_event("SpecHealth2","SpecTo_Target","bd")
    
register_event("TextMsg","Spec_GetMode","b","2&#Spec_Mode")
}

public 
SpecTo_Target(id)
{
    if (
id 0)
    {
        new 
target read_data(2)
        if (
target && spec[id] > 0
        {
            new 
szMdl[64], classid
            cs_get_user_model
(targetszMdl63)
            
classid GetIDFromList(szMdl)
            
            new 
hand g_mdl_hand[classid]

            
// Change body, delayed
            
md_setviewentitybody(idhand - (floatround(float(hand 10), floatround_tozero) * 10))
        }
    }
}

public 
Spec_GetMode(id)
{
    
// discover if in first_person_view
    
new specMode[12]
    
read_data(2specMode11)
    
    if(
equal(specMode"#Spec_Mode4")) spec[id] = 1
    
else spec[id] = 0

I have tried searching for spectator related and this is the closest one to fulfill my desire but this issue. I'm still learing about spectator stuff, so bear with me :')

Thanks in advance !

Last edited by asdian; 03-13-2022 at 22:31.
asdian 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 12:33.


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