AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   SetViewEntityBody (https://forums.alliedmods.net/showthread.php?t=287754)

Hanna 09-13-2016 22:01

SetViewEntityBody
 
3 Attachment(s)
http://s01.geekpic.net/di-C5KBP1.png
Version: Release 1.7
Requirements: latest AmxModX 1.8.3

Description:

The main function of this plugin is changing the viewmodel bodygroup.
It doesn't matter how high is player latency/ping, low fps count - the player will see only bodygroup you pointed without bugs. The custom weapons are also supported.
Also this plugin comes with custom v_ models, you don't need to replace original, just put them into cstrike/models/weapons. The default v_ models are removed from precache.
As you know, Counter-Strike Online uses two hands bodygroup in v_ models. So let's make it now work in Counter-Strike 1.6!

Some functions are still need to do.

1. Spectators support - DONE (Release 1.0)
2. Remove trace attack and use default cs decals - TODO

There is three native functions:

Main:
native SetViewEntityBody(pPlayer, iValue); //pPlayer - player index, iValue - bodygroup number

Secondary:
native SetUserSex(pPlayer, iValue); //pPlayer - player index, iValue /1 - MALE, 2 - FEMALE
native GetUserSex(pPlayer); //pPlayer - player index /Getting the player sex


Usage example:

Code:


#define MALE 0
#define FEMALE 1

public client_connect(id)
{
SetUserSex(id, MALE);    //Making it male at connect for example
SetViewEntityBody(id, 0);    //Setting viewmodel bodygroup to zero for example
}

public HamF_Item_Deploy_Post(iEnt)
{
static id, iWeaponName[24]; 
id = get_pdata_cbase(iEnt, m_pPlayer, 4);

switch(GetUserSex(id))
{
case FEMALE: set_pev(id, pev_viewmodel2, FEMALE_KNIFE);
default: set_pev(id, pev_viewmodel2, MALE_KNIFE);

return HAM_IGNORED;   
}

You can uncomment DEBUG and lookout for switch_sex command function.

14/9/16: First Beta release

Update 15/9/16: Release 1.0, added Spectator support, redefined MALE, FEMALE, added sex checks into deploy, fixed dead player bodies non disappear.

Update 15/9/16: Release 1.1, some bugfix.


Update 15/9/16: Release 1.2, removed value msg check

Update 15/9/16: Release 1.3, i've made one big mistake while setting the spectating target anim, so it's now fixed. The spectator target body now will be fine.

Update 15/9/16: Release 1.4, while playing online, i've seen a bug with spectators hands, so i decided to lookout what's the problem. Instead of using SpecHealth, i've replaced it with StatusValue. Why? The first player who killed us in previous version always was bugged. Now it's fixed. The attack bug is also fixed.
Also... I randomized the connected players hand body. Look at:

Code:

//test functions only
public client_connect(id)
{
//testing, was good. Comment nearby both if you want to uncomment and test this randomize
switch(random_num(1,10))
{
case 1..5:
{
SetUserSex(id, MALE);    //Making it male, to make our nearby func work
SetViewEntityBody(id, MALE);    //Set Viewbody           
}
case 6..10
{
SetUserSex(id, FEMALE);    //Making this female
SetViewEntityBody(id, FEMALE);    //Set Viewbody           
}       
}
/*SetUserSex(id, MALE);    //Making it male, to make our nearby func work
SetViewEntityBody(id, MALE);    //Reset Viewbody*/
}

Update 15/9/16: Release 1.5, some bugfix, the observer is done.
P.S. Enough for today.

Update 15/9/16: Release 1.6, again bugfix.

Update 16/9/16: Release 1.7, bugfixes. Now i started to lookout for attack system. I have 2 ideas currently and one of them is replacing atk system with custom trace, but the way it can be done - with Orpheu. Need some time to think. P.S: download both include and source again.

Craxor 09-14-2016 02:32

Re: SetViewEntityBody
 
Screens?

Hanna 09-14-2016 04:01

Re: SetViewEntityBody
 
Later i'll upload video.

I forgot to fix dead player bodies disappear.

Just replace Playback forward function with this:

Code:

public Forward_PlaybackEvent(iFlags, id, iEvent)
{
    //TODO
    if(is_user_alive(id))
    {   
        return FMRES_SUPERCEDE;
    }
    return FMRES_IGNORED;   
}

The Spectators support i'll do next.
The attack i dunno, maybe replace using custom trace and ham damage.

Syturi0 09-14-2016 06:35

Re: SetViewEntityBody
 
Quote:

Requirements: latest AmxModX 1.8.3
Why?
Most people use 1.8.2
Cant you make it work on it?

PRoSToTeM@ 09-14-2016 10:25

Re: SetViewEntityBody
 
Don't use .7z, u should use .zip.

Hanna 09-14-2016 16:41

Re: SetViewEntityBody
 
Gonna reupload resources a bit later.

NiHiLaNTh 09-15-2016 03:38

Re: SetViewEntityBody
 
You can delete your older posts, there's no need of bumping this thread each hour I guess.

Hanna 09-15-2016 03:46

Re: SetViewEntityBody
 
Update: Release 1.6 - bugfixes while spectating and the target died at the moment we are tried to look him from first person.
Redownload both include and source.

Hanna 09-15-2016 03:47

Re: SetViewEntityBody
 
Quote:

Originally Posted by NiHiLaNTh (Post 2454101)
You can delete your older posts, there's no need of bumping this thread each hour I guess.

xD, yes. But how i can do it? Can't find any delete button or edit oO.

Edit: found LOL.

frk_14 09-15-2016 23:08

Re: SetViewEntityBody
 
insane job

Hanna 09-16-2016 05:09

Re: SetViewEntityBody
 
Update 16/9/16: Release 1.7, bugfixes. Now i started to lookout for attack system. I have 2 ideas currently and one of them is replacing atk system with custom trace, but the way it can be done - with Orpheu. Need some time to think.

Craxor 09-16-2016 22:20

Re: SetViewEntityBody
 
Can you make a special stock if someone is "Female" and i'm "Male" ... in register_touch if i'm touching an female to use your stock and make a baby :o !

Hanna 09-16-2016 23:27

Re: SetViewEntityBody
 
Quote:

Originally Posted by Craxor (Post 2454543)
Can you make a special stock if someone is "Female" and i'm "Male" ... in register_touch if i'm touching an female to use your stock and make a baby :o !

Wtf man, xD. Some kinda of trolling.

joropito 09-19-2016 16:11

Re: SetViewEntityBody
 
Quote:

Originally Posted by Hanna (Post 2454337)
I have 2 ideas currently and one of them is replacing atk system with custom trace, but the way it can be done - with Orpheu. Need some time to think.[/B]

Please expand your idea. Maybe you can get help on that.

Also please upload images and videos.

Hanna 09-20-2016 08:26

Re: SetViewEntityBody
 
Quote:

Originally Posted by joropito (Post 2455309)
Please expand your idea. Maybe you can get help on that.

Also please upload images and videos.

Well, the idea is removing the Execute Ham Primary Attack call from attack forward to apply custom attack.
You want the way? Here, this is i'm currently using and will include it in next update:

Code:

#include <xs>
#include <orpheu>
#include <orpheu_stocks>

new OrpheuFunction:handleApplyMultiDamage;
new OrpheuFunction:handleClearMultiDamage;

public plugin_init()
{
handleApplyMultiDamage = OrpheuGetFunction("ApplyMultiDamage");
handleClearMultiDamage = OrpheuGetFunction("ClearMultiDamage");

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_glock18", "HamF_Weapon_PrimaryAttack");
}

public HamF_Weapon_PrimaryAttack(iEnt)
{
static id;
id = get_pdata_cbase(iEnt, m_pPlayer, 4);

//Starting now calculate our custom attack
new Float: vecSrc[3], Float: vecForward[3], Float:vecViewOfs[3];

pev(id, pev_origin, vecSrc);
pev(id, pev_view_ofs, vecViewOfs);
xs_vec_add(vecSrc, vecViewOfs, vecSrc);

FireBullets(vecSrc, vecForward, 8192.0, 3, 30.0/*<<<damage*/, id);
return HAM_SUPERCEDE;
}

stock FireBullets(Float:vecSrc[3], Float:vecDir[3], Float:flDistance, iPenetration, Float:flDamage, pevAttacker)
{
new Float:vecEnd[3], Float:vecEndPos[3], Float:vecForward[3];
new tr = create_tr2();
new Float:flFraction, Float:flCurrentDistance;
xs_vec_mul_scalar(vecDir, flDistance, vecForward);
xs_vec_add(vecSrc, vecForward, vecEnd);
while (iPenetration != 0)
{
OrpheuCall(handleClearMultiDamage);

engfunc(EngFunc_TraceLine, vecSrc, vecEnd, DONT_IGNORE_MONSTERS, pevAttacker, tr);
get_tr2(tr, TR_flFraction, flFraction);
if (flFraction != 1.0)
{
new pEntity = get_tr2(tr, TR_pHit);
if (pEntity < 0)
{   
return;
}
iPenetration--;
flCurrentDistance = flFraction * flDistance;
get_tr2(tr, TR_vecEndPos, vecEndPos);
xs_vec_mul_scalar(vecDir, 42.0, vecForward);
xs_vec_add(vecEndPos, vecForward, vecSrc);
flDistance = (flDistance - flCurrentDistance) * 0.75;
xs_vec_mul_scalar(vecDir, flDistance, vecForward);
xs_vec_add(vecSrc, vecForward, vecEnd);
ExecuteHamB(Ham_TraceAttack, pEntity, pevAttacker, flDamage, vecDir, tr, DMG_BULLET | DMG_NEVERGIB);
}
else
{
iPenetration = 0;
}

OrpheuCall(handleApplyMultiDamage, pevAttacker, pevAttacker);
}
}


Also not only this. Ok, later gonna go now.

Hanna 09-20-2016 08:29

Re: SetViewEntityBody
 
Oh, forgot. Maybe if you don't have signatures

Code:

{
    "name"      : "ApplyMultiDamage",
    "library"  : "mod",
    "arguments" :
    [
        {
            "type"  : "entvars_s *",
            "info"  : "pevInflictor"
        },
        {
            "type"  : "entvars_s *",
            "info"  : "pevAttacker"
        }
    ],
    "identifiers":
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : [0x90,0x8B,0x0D,"*","*","*","*",0x85,0xC9,0x74,"*",0x8B,0x15,"*","*","*","*",0x8B],
            "displacement" : 1
        },
        {
            "os"    : "linux",
            "mod"  : "cstrike",
            "value" : "ApplyMultiDamage__FP9entvars_sT0"
        }
    ]
}

Code:

{
    "name"        : "ClearMultiDamage",
    "library"    : "mod",
    "identifiers" :
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : [0x90,0x33,0xC0,0xA3,"*","*","*","*",0xA3,"*","*","*","*",0xA3],
            "displacement" : 1
        },
        {
            "os"    : "linux",
            "mod"  : "cstrike",
            "value" : "ClearMultiDamage__Fv"
        }
    ]
}


PRoSToTeM@ 09-24-2016 02:28

Re: SetViewEntityBody
 
@Hanna you can use rg_fire_bullets3 with ReAPI.

HamletEagle 09-24-2016 04:30

Re: SetViewEntityBody
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2456484)
@Hanna you can use rg_fire_bullets3 with ReAPI.

You do realize that this community is primary supporting the official version of hlds, don't you? It's okay to add support for reapi, but IMO plugin should be working in valve's hlds too. It's strange and wrong to have plugins working only on custom dll's.

Hanna 09-25-2016 05:49

Re: SetViewEntityBody
 
And yes, using another libary is breaking the the official licence from Valve.
There is too many pirate servers around and supporting it is not good. IMO.
Using custom library maybe just for testing only purposes.

Celena Luna 10-24-2016 12:48

Re: SetViewEntityBody
 
If I use another weapon plugins which have a model with 2 hands (male and female ofc). Does this plugins actually work with them?

Hanna 11-01-2016 09:30

Re: SetViewEntityBody
 
Quote:

Originally Posted by Celena Luna (Post 2464607)
If I use another weapon plugins which have a model with 2 hands (male and female ofc). Does this plugins actually work with them?

Yes. Should work with little weapon attack code change.

Celena Luna 11-17-2016 06:31

Re: SetViewEntityBody
 
Quote:

Originally Posted by Hanna (Post 2466830)
Yes. Should work with little weapon attack code change.

Which part to change actually. Usually I am using this to play animation:
PHP Code:

stock set_weapon_anim(idanim)
{
    if(!
is_user_alive(id))
        return
        
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM_id)
    
write_byte(anim)
    
write_byte(get_pev(idpev_body))
    
message_end()    



Hanna 11-22-2016 07:58

Re: SetViewEntityBody
 
if(!is_user_alive(id))
return

not needed cause this function will skip for dead players

MSG_ONE_UNRELIABLE - should be MSG_ONE, not unreliable or at low or high ping you'll see hand bug.

Attack - Primary attack hook with Ham and write your own attack.

All other anims just can be switched with set_pev(wepon_entity, pev_body, value) - you just need check weapon ent in anims forwards or make it simply like in this plugin through SendWeaponAnim forward.

Celena Luna 12-01-2016 10:51

Re: SetViewEntityBody
 
Quote:

Originally Posted by Hanna (Post 2471883)
if(!is_user_alive(id))
return

not needed cause this function will skip for dead players

MSG_ONE_UNRELIABLE - should be MSG_ONE, not unreliable or at low or high ping you'll see hand bug.

Attack - Primary attack hook with Ham and write your own attack.

All other anims just can be switched with set_pev(wepon_entity, pev_body, value) - you just need check weapon ent in anims forwards or make it simply like in this plugin through SendWeaponAnim forward.

I get it now :3
btw, do you plan to make a version for AMX 1.8.2 ?

Hanna 12-14-2016 08:25

Re: SetViewEntityBody
 
Quote:

Originally Posted by Celena Luna (Post 2474288)
I get it now :3
btw, do you plan to make a version for AMX 1.8.2 ?

Bit later.

georgik57 01-31-2017 09:56

Re: SetViewEntityBody
 
Gonna have to test this. Good job. Also, please make for 1.8.2 and lower.

Celena Luna 09-29-2017 09:18

Re: SetViewEntityBody
 
It have been awhile and I have played around this but after all I can't use this with any other weapon than default (without effect) because:
- It block at the PrimaryAttack => PrimaryAttack_Post never exists => can't set some info like recoil or accuracy
- Some weapon need to be Supercede at FM_PlaybackEvent but if do that, the submode will be set to 0 again.

Syturi0 09-29-2017 14:23

Re: SetViewEntityBody
 
Its been a year, no updates on 1.8.2 and bugfixes?

ConorCC 01-07-2018 10:06

Re: SetViewEntityBody
 
When I tryed on windows the plugin was right. But on my linux server something is wrong.

Animations and weapon sounds on bad enitites. If I hit with knife it make decals on wall and all weapon shoot sounds are replaced with P250 pistol shoots.

Same metamod, same amxmodx version and only your plugin can be found on both server.

ConorCC 02-17-2018 05:52

Re: SetViewEntityBody
 
The problem is the different pdata int on windows and linux. You can fix it just replace all WEAPON_ENT to cs_get_weapon_id and include cstrike.inc. Then the plugin work right.

There is an another problem. In the options the modells has been set on the right hand but the plugin display them on the left hand. The weapons sparkle still on the original hand. Is there any idea to change it to normal? Both on one side.

1xAero 02-17-2018 12:00

Re: SetViewEntityBody
 
It's fixed in my build. I've used another trick without disabling client weapons (cl_lw set to 0 always breaks models position) https://forums.alliedmods.net/showthread.php?t=305150


All times are GMT -4. The time now is 06:09.

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