AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:GO] -N- Arms Fix [2.0.3 | 2021-01-22] (https://forums.alliedmods.net/showthread.php?t=293295)

NomisCZ 01-28-2017 11:38

[CS:GO] -N- Arms Fix [2.0.3 | 2021-01-22]
 
[CS:GO] -N- Arms Fix

Latest version: 2.0.3


⚠️Operation Shattered Web (26.11.2019) changes:
⚠️Version 2.0.x changes:
  • ArmsFix_OnArmsSafe and ArmsFix_OnModelSafe is now N_ArmsFix_OnClientReady
  • Natives was renamed - see ⚡️ Developer API
  • Library name is now N_ArmsFix, so update name in your OnLibraryAdded/OnLibraryRemoved/OnAllPluginsLoaded/LibraryExists
  • Added N_ArmsFix_ProtectedMaps.txt config

≡ Info
  • -N- Arms Fix helps you to fix arms/gloves in your plugin.

≡ Installation
≡ Configuration
  • sm_arms_fix_autospawn - Enable auto spawn fix (automatically sets default gloves)?
    Default: "1"
  • sm_arms_fix_bots - Enable auto spawn fix for bots (automatically sets default gloves for bots)?
    Default: "1"
  • If you need to protect your custom map gamemodes_server settings, please add your map to addons\sourcemod\plugins\configs\N_ArmsFix_ProtectedMaps.txt
  • If you want to return to the original gamemodes.txt, just disable plugin and update & validate your server.

≡ Latest version
≡ GIT
≡ Plugin example
⚡️ Developer API
Spoiler


≡ Change log
Spoiler


≡ Thanks to

superblack4 01-28-2017 12:35

Re: [CS:GO] -N- Arms Fix
 
Quote:

Originally Posted by NomisCZ (Post 2490579)
≡ Info:
→ This plugin helps you to fix arms/gloves in first person (only!).

≡ Installation:
→ Copy & paste .smx file to addons\sourcemod\plugins\<>

≡ Download:
Here OR see attached files

≡ Compatible plugins:If you have problems, please first read FAQ, before you create new post/reply! https://github.com/NomisCZ/Arms-Fix#faq
→ GIT repo: https://github.com/NomisCZ/Arms-Fix

Please keep up the good work and compatible with Francisco glove plugin so i can put my zombie arms model :D

Franc1sco 01-28-2017 12:40

Re: [CS:GO] -N- Arms Fix
 
Finally! I will add this to my arms public plugins if really works well

good_live 01-28-2017 13:10

Re: [CS:GO] -N- Arms Fix
 
How exactly does this work?

NomisCZ 01-28-2017 13:21

Re: [CS:GO] -N- Arms Fix
 
Quote:

Originally Posted by good_live (Post 2490603)
How exactly does this work?

-N- Arms Fix:
Player Spawn -> Force set default model & arms

Eg. SM Skinchooser 4.2:
Player Spawn -> Wait 0.5s -> Set player arms/gloves -> Wait 2.0s -> Set player skin
PHP Code:

HookEvent("player_spawn"Event_PlayerSpawn);

public 
Action Event_PlayerSpawn(Handle event, const char[] namebool dontBroadcast) {
    
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
CreateTimer(0.5Timer_PostSpawnclient);
}
public 
Action Timer_PostSpawn(Handle timerany client) {
    
// First set player arms!
    
GiveArms(client);
// Set player model after 2 seconds
    
CreateTimer(2.0Timer_Spawnclient);
}

public 
void GiveArms(int client) {

// Only if player have default arms -> -N- Arms Fix
if(!isValidClient(client) || !hasDefaultArms(client)) return;
...
}

public 
Action Timer_Spawn(Handle timerint client) {
...



NomisCZ 01-28-2017 13:37

Re: [CS:GO] -N- Arms Fix
 
Quote:

Originally Posted by Franc1sco (Post 2490590)
Finally! I will add this to my arms public plugins if really works well

Just modify these code sections:
PHP Code:

// :: ADD THIS ::
char defaultArms[][] = { "models/weapons/ct_arms.mdl""models/weapons/t_arms.mdl" };
...

public 
Action PlayerSpawn(Event gEventHook, const char[] gEventNamebool iDontBroadcast) {
{
    
int client GetClientOfUserId(gEventHook.GetInt("userid"));
        
// :: ADD THIS ::
        
CreateTimer(0.5PlayerSpawn_Armsclient);
}
// :: ADD THIS ::
public Action PlayerSpawn_Arms(Handle timerint client) {
    
    
GiveArms(client);
}

public 
void GiveArms(int client)
{
    if (!
IsPlayerAlive(client))return;
    
    
int team;
    if(
GetFeatureStatus(FeatureType_Native"ZR_IsClientZombie") == FeatureStatus_Available)
    {
        if (
ZR_IsClientZombie(client))team 0;
        else 
team 1;
    }
    else
        
team GetClientTeam(client);
        
    if(
strlen(g_arms[1][team][client]) > && !StrEqual(g_arms[1][team][client], "none"false) && (FileExists(g_arms[1][team][client]) || FileExists(g_arms[1][team][client], true))) 
    {
        
// :: ADD THIS ::
        
if (StrEqual(g_arms[1][team][client], defaultArms[0]) || StrEqual(g_arms[1][team][client], defaultArms[1]))
            return;
        
SetEntPropString(clientProp_Send"m_szArmsModel"g_arms[1][team][client]);
        
CreateTimer(0.15RemoveItemTimerEntIndexToEntRef(client), TIMER_FLAG_NO_MAPCHANGE);
    }
    
//PrintToChat(client, "modelo arms de %s de %s", g_arms[0][team][client], g_arms[1][team][client]);


And configuration.txt:
PHP Code:

"CustomModels"
{
    
"Default CT Arms"
    
{
        
"model" "models/weapons/ct_arms.mdl"
        "team" "CT"
    
}
    
"Default T Arms"
    
{
        
"model" "models/weapons/t_arms.mdl"
        "team" "TT"
    
}
... 

Don't add -N- Arms Fix code directly into your plugin, because there are many other plugins with arms/gloves functions. So if everyone implement part of my code into its plugin. It can be problematic.

Franc1sco 01-28-2017 13:58

Re: [CS:GO] -N- Arms Fix
 
Quote:

Originally Posted by NomisCZ (Post 2490616)
Just modify these code sections:
PHP Code:

// :: ADD THIS ::
char defaultArms[][] = { "models/weapons/ct_arms.mdl""models/weapons/t_arms.mdl" };
...

public 
Action PlayerSpawn(Event gEventHook, const char[] gEventNamebool iDontBroadcast) {
{
    
int client GetClientOfUserId(gEventHook.GetInt("userid"));
        
// :: ADD THIS ::
        
CreateTimer(0.5PlayerSpawn_Armsclient);
}
// :: ADD THIS ::
public Action PlayerSpawn_Arms(Handle timerint client) {
    
    
GiveArms(client);
}

public 
void GiveArms(int client)
{
    if (!
IsPlayerAlive(client))return;
    
    
int team;
    if(
GetFeatureStatus(FeatureType_Native"ZR_IsClientZombie") == FeatureStatus_Available)
    {
        if (
ZR_IsClientZombie(client))team 0;
        else 
team 1;
    }
    else
        
team GetClientTeam(client);
        
    if(
strlen(g_arms[1][team][client]) > && !StrEqual(g_arms[1][team][client], "none"false) && (FileExists(g_arms[1][team][client]) || FileExists(g_arms[1][team][client], true))) 
    {
        
// :: ADD THIS ::
        
if (StrEqual(g_arms[1][team][client], defaultArms[0]) || StrEqual(g_arms[1][team][client], defaultArms[1]))
            return;
        
SetEntPropString(clientProp_Send"m_szArmsModel"g_arms[1][team][client]);
        
CreateTimer(0.15RemoveItemTimerEntIndexToEntRef(client), TIMER_FLAG_NO_MAPCHANGE);
    }
    
//PrintToChat(client, "modelo arms de %s de %s", g_arms[0][team][client], g_arms[1][team][client]);


And configuration.txt:
PHP Code:

"CustomModels"
{
    
"Default CT Arms"
    
{
        
"model" "models/weapons/ct_arms.mdl"
        "team" "CT"
    
}
    
"Default T Arms"
    
{
        
"model" "models/weapons/t_arms.mdl"
        "team" "TT"
    
}
... 

Don't add -N- Arms Fix code directly into your plugin, because there are many other plugins with arms/gloves functions. So if everyone implement part of my code into its plugin. It can be problematic.


You could add natives to your plugin for a better support in others plugins.

incizzle 01-29-2017 00:02

Re: [CS:GO] -N- Arms Fix
 
wow this is really cool and a good idea at that

headline 01-29-2017 01:08

Re: [CS:GO] -N- Arms Fix
 
Quote:

Originally Posted by Franc1sco (Post 2490619)
You could add natives to your plugin for a better support in others plugins.

I'd really like to echo this. Relying on timer delays is horrible, user proper natives/forwards to allow for developers to interact with your plugin in a way which makes sence

schwarz 01-29-2017 09:54

Re: [CS:GO] -N- Arms Fix
 
hey

good worker! but if you can make fix for store Zeph arms?

(https://forums.alliedmods.net/showthread.php?t=290075)

thanks


All times are GMT -4. The time now is 14:02.

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