AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Sideweapon v3 (https://forums.alliedmods.net/showthread.php?t=339262)

SoulWeaver16 08-28-2022 19:14

Sideweapon v3
 
2 Attachment(s)
Hello everyone, I need a hand, could you adapt the code so that I can use the pistols and the knife?
I just made the model quickly
I comment the submodels that it uses:
HTML Code:

0 Blank
1 Knife
2 Deagle
3 Elites
4 FiveSeven
5 Glock
6 P228
7 USP
8 USP NoSil

That the "blank" part that would be used originally, since if you don't have pistols, yes or if you will have the knife in hand
Quote:

Originally Posted by ConnorMcLeod (Post 1303330)
New version, should support m4 without silencer, model set by .ini file.

Config file :

bw_model : model to use, "models/backweapons2.mdl" by default

bw_nosil : 0/1, use nosil or not, only models backweapons2_ns.mdl and backweapons2_css_ns.mdl supported

bw_maxweapons : max weapons you can see in a player's back (in case your server allow multiple weapons, 1 by default.


Would be usefull if someone could make condition-zero models.


19 feb 2013 : updated to v0.0.5, fixed a bug preventing plugin from working.
g_iMaxPlayers was set under the TEST_3RD define scope.


kww 08-29-2022 17:32

Re: Sideweapon v3
 
I didn't test it, so feel free to blame me if it's not working
It should work, but I'm not sure

SoulWeaver16 08-29-2022 17:47

Re: Sideweapon v3
 
Quote:

Originally Posted by kww (Post 2787690)
I didn't test it, so feel free to blame me if it's not working
It should work, but I'm not sure

Thanks for your quick reply, I'll give it a try.
I even tried if the model works, but we'll see how it goes

Edit:
Code:

//// sideweapon3.sma
//
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\sideweapon3.sma(148) : error 088: number of arguments does not match definition
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\sideweapon3.sma(158) : error 088: number of arguments does not match definition
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\sideweapon3.sma(108) : warning 204: symbol is assigned a value that is never used: "g_iMaxPlayers"
//
// 2 Errors.
// Could not locate output file compiled\sideweapon3.amx (compile failed).
//
// Compilation Time: 0,34 sec
// ----------------------------------------


kww 08-29-2022 18:01

Re: Sideweapon v3
 
2 Attachment(s)
Now it compiles... Sry

SoulWeaver16 08-29-2022 18:42

Re: Sideweapon v3
 
Quote:

Originally Posted by kww (Post 2787695)
Now it compiles... Sry

It compiles well and doesn't give errors, nor does it log, but it doesn't work, maybe it's the model I made?
I'll take a closer look and see if I can fix anything.

kww 08-29-2022 18:51

Re: Sideweapon v3
 
Quote:

Originally Posted by SoulWeaver16 (Post 2787699)
It compiles well and doesn't give errors, nor does it log, but it doesn't work, maybe it's the model I made?
I'll take a closer look and see if I can fix anything.

If u dl'd src before I edited my last post, please redownload it, I made a mistype there

SoulWeaver16 08-29-2022 19:16

Re: Sideweapon v3
 
Quote:

Originally Posted by kww (Post 2787700)
If u dl'd src before I edited my last post, please redownload it, I made a mistype there

This works o: Really thanks
https://i.imgur.com/1YbI45w.png
https://i.imgur.com/Suzpkva.png
But the version with a knife, it closes the game, I thought it was my model, but it works fine.
Maybe something should be corrected there.
Edit:Then I will fix the model, to correct the position, it is that I made it approximate without reference haha

kww 08-29-2022 19:18

Re: Sideweapon v3
 
Quote:

Originally Posted by SoulWeaver16 (Post 2787701)
This works o: Really thanks
https://i.imgur.com/1YbI45w.png
https://i.imgur.com/Suzpkva.png
But the version with a knife, it closes the game, I thought it was my model, but it works fine.
Maybe something should be corrected there.

Yeah, I had no idea how to handle that case correctly, so here I can't help you, sorry
Edit: try to add iWeapon = -1 at the end of last while. It crashes because of infinite 'while' (didn't notice that thing)
Or, simply, replace last function (CheckWeapons) with this fixed version:
PHP Code:

CheckWeapons(idiSkipEnt FM_NULLENT)
{
    static 
iMaxWeaponsiMaxWeapons g_iMaxWeapons
    
static iWeaponiWeapon get_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[SECONDARY])
    
    while(
iWeapon 0)
    {
        if(
iWeapon == iSkipEnt || iMaxWeapons <= 0)
        {
            
set_pev(iWeaponpev_effectsEF_NODRAW)
        }
        else
        {
            if(
get_pdata_int(iWeaponm_iIdXO_CBASEPLAYERITEM) == CSW_USP)
            {
                if(
get_pdata_int(iWeaponm_fWeaponStateXO_CBASEPLAYERWEAPON) & WEAPONSTATE_USP_SILENCED)
                {
                    
set_pev(iWeaponpev_bodyUSP)
                }
                else
                {
                    
set_pev(iWeaponpev_bodyUSP_NoSil)
                }
            }

            
set_pev(iWeaponpev_effects0)
            
            --
iMaxWeapons
        
}

        
iWeapon get_pdata_cbase(iWeaponm_pNextXO_CBASEPLAYERITEM)
    }

    
// Sure, this move is so stupid...
    
iWeapon get_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[KNIFE])

    while(
iWeapon 0// Player can have no knife...
    
{
        if(
iWeapon == iSkipEnt)
        {
            
set_pev(iWeaponpev_effectsEF_NODRAW)
        }

        
// Not sure if we need to loop thru knives if player can have only one
        //iWeapon = get_pdata_cbase(iWeapon, m_pNext, XO_CBASEPLAYERITEM)

        
iWeapon 0
    
}


If knives won't work then I can't help you

SoulWeaver16 08-29-2022 19:50

Re: Sideweapon v3
 
Quote:

Originally Posted by kww (Post 2787702)
Yeah, I had no idea how to handle that case correctly, so here I can't help you, sorry
Edit: try to add iWeapon = -1 at the end of last while. It crashes because of infinite 'while' (didn't notice that thing)
Or, simply, replace last function (CheckWeapons) with this fixed version:
PHP Code:

CheckWeapons(idiSkipEnt FM_NULLENT)
{
    static 
iMaxWeaponsiMaxWeapons g_iMaxWeapons
    
static iWeaponiWeapon get_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[SECONDARY])
    
    while(
iWeapon 0)
    {
        if(
iWeapon == iSkipEnt || iMaxWeapons <= 0)
        {
            
set_pev(iWeaponpev_effectsEF_NODRAW)
        }
        else
        {
            if(
get_pdata_int(iWeaponm_iIdXO_CBASEPLAYERITEM) == CSW_USP)
            {
                if(
get_pdata_int(iWeaponm_fWeaponStateXO_CBASEPLAYERWEAPON) & WEAPONSTATE_USP_SILENCED)
                {
                    
set_pev(iWeaponpev_bodyUSP)
                }
                else
                {
                    
set_pev(iWeaponpev_bodyUSP_NoSil)
                }
            }

            
set_pev(iWeaponpev_effects0)
            
            --
iMaxWeapons
        
}

        
iWeapon get_pdata_cbase(iWeaponm_pNextXO_CBASEPLAYERITEM)
    }

    
// Sure, this move is so stupid...
    
iWeapon get_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[KNIFE])

    while(
iWeapon 0// Player can have no knife...
    
{
        if(
iWeapon == iSkipEnt)
        {
            
set_pev(iWeaponpev_effectsEF_NODRAW)
        }

        
// Not sure if we need to loop thru knives if player can have only one
        //iWeapon = get_pdata_cbase(iWeapon, m_pNext, XO_CBASEPLAYERITEM)

        
iWeapon 0
    
}


If knives won't work then I can't help you

Perhaps instead of using the knife trigger, use it like this:
If a pistol is selected, make it default instead of blanking, the knife can't be thrown anyway


All times are GMT -4. The time now is 15:39.

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