AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Knife Models [XP System & Skills Support] (https://forums.alliedmods.net/showthread.php?t=293632)

xeloxded 07-03-2018 13:39

Re: Knife Models [XP System Support]
 
I got a bug, if you are CT then choose a custom knife and then you switch to TT, it will reset to your default CS knife but with your custom knife selected on menu

Edit: This does only happen because on Deathrun mode you only have a Knife as TT, it wont refresh, but if you give a TT a weapon it will give you your desired model.
Another suggestion is that Save selection has to be via Nick too, its useless if you are using your Rank System with Nick save.

Supergirl 07-03-2018 17:32

Re: Knife Models [XP System Support]
 
Quote:

Originally Posted by xeloxded (Post 2600793)
I got a bug, if you are CT then choose a custom knife and then you switch to TT, it will reset to your default CS knife but with your custom knife selected on menu

Edit: This does only happen because on Deathrun mode you only have a Knife as TT, it wont refresh, but if you give a TT a weapon it will give you your desired model.
Another suggestion is that Save selection has to be via Nick too, its useless if you are using your Rank System with Nick save.

The thing is (in my perspective): why would you want to save anything by nick? That doesn't make any sense to me. Isn't that even dangerous? I mean, anybody can join the server, pick your name and achieve the next rank or loose the current.

xeloxded 07-03-2018 17:43

Re: Knife Models [XP System Support]
 
Quote:

Originally Posted by Supergirl (Post 2600841)
The thing is (in my perspective): why would you want to save anything by nick? That doesn't make any sense to me. Isn't that even dangerous? I mean, anybody can join the server, pick your name and achieve the next rank or loose the current.


Ya, also SteamID is so easy to spoof on 2k18, IP is also risky, so yeah, it depends A LOT on each server, on my side, I have a pretty decent register system so yeah, Nick is secure for everyone.

OciXCrom 07-04-2018 08:36

Re: Knife Models [XP System Support]
 
Quote:

Originally Posted by Supergirl (Post 2600739)
Edit - Having some thoughts... why not having more than custom knives for both teams: why not having default knives for both teams (for this I mean when you enter the server instead of the "Default" knife, it will have 2 "Default" knives, one for TE and one for CT)? Is it possible to manage the plugin to do so?

Not sure how I'm going to do this, but I'll see what I can do. I feel like the plugin's code is going to get a lot complicated.

Quote:

Originally Posted by xeloxded (Post 2600793)
I got a bug, if you are CT then choose a custom knife and then you switch to TT, it will reset to your default CS knife but with your custom knife selected on menu

Edit: This does only happen because on Deathrun mode you only have a Knife as TT, it wont refresh, but if you give a TT a weapon it will give you your desired model.

Yup, just tested with a plugin that removes weapons on spawn, same thing happened. This is actually a bug from the hamsandwich module, looks like the function doesn't get called quickly enough to detect that the weapon was removed. Fixed (update the .sma file).

@HamletEagle - I'm switching back to using CurWeapon instead of Ham_Deploy because of this problem. I experienced something simillar in another plugin. I'll need to use a task in order to prevent it, but that doesn't feel right, so I prefer CurWeapon.

Quote:

Originally Posted by xeloxded (Post 2600793)
Another suggestion is that Save selection has to be via Nick too, its useless if you are using your Rank System with Nick save.

Better not mention that you're using a non-steam server here.

Supergirl 07-04-2018 22:01

Re: Knife Models [XP System Support]
 
Quote:

Originally Posted by OciXCrom (Post 2600944)
Not sure how I'm going to do this, but I'll see what I can do. I feel like the plugin's code is going to get a lot complicated.

No hurries, mate! :)

HamletEagle 07-07-2018 05:55

Re: Knife Models [XP System Support]
 
Quote:

Yup, just tested with a plugin that removes weapons on spawn, same thing happened. This is actually a bug from the hamsandwich module, looks like the function doesn't get called quickly enough to detect that the weapon was removed. Fixed (update the .sma file).

@HamletEagle - I'm switching back to using CurWeapon instead of Ham_Deploy because of this problem. I experienced something simillar in another plugin. I'll need to use a task in order to prevent it, but that doesn't feel right, so I prefer CurWeapon.
What bug are you talking about? Can you post a simple plugin that reproduces the said bug?
Also know that hamsandwich module can't have bugs, it just hooks functions from the game dll.

OciXCrom 07-07-2018 08:07

Re: Knife Models [XP System Support]
 
Actually, I just tested it again and I think the problem is from fakemeta, not hamsandwich. Here's the code that won't work:

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>

#if !defined m_pPlayer
    #define m_pPlayer 41
#endif

#define V_MODEL "models/iplaydr/v_knife20.mdl"
#define P_MODEL "models/iplaydr/p_knife20.mdl"

public plugin_init()
{
    
register_plugin("PluginName""1.0""OciXCrom")
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
    
RegisterHam(Ham_Item_Deploy"weapon_knife""OnKnifeDeploy"1)
    
//register_event("CurWeapon", "OnKnifeDeploy", "be", "1=1", "2=29")
}

public 
plugin_precache()
{
    
precache_model(V_MODEL)
    
precache_model(P_MODEL)
}

public 
OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
    }
}    

public 
OnKnifeDeploy(iEnt)
{
    new 
id pev(iEntpev_owner)
    
//new id = get_pdata_cbase(iEnt, 41, 5)
    
client_print(0print_chat"id is %i"id)
    
set_pev(idpev_viewmodel2V_MODEL)
    
set_pev(idpev_weaponmodel2P_MODEL)


This happens only if the weapons are removed on spawn.
The same code will work without problems if we use the CurWeapon event instead.

With the testing I just did, I found that using pev(iEnt, pev_owner) to get the player's id returns 0 which is why the models isn't set. It returns the correct id however if the weapons aren't removed on spawn.

Getting the id with get_pdata_cbase(iEnt, 41, 5) returns the correct value and the model is set.

HamletEagle 07-07-2018 13:29

Re: Knife Models [XP System Support]
 
Then there is no bug. pev_owner is not set at that point, this is why you must use m_pPlayer offset to retrieve the player index.
So please switch back to ItemDeploy and use m_pPlayer instead of pev_owner.

OciXCrom 07-07-2018 15:06

Re: Knife Models [XP System Support]
 
Quote:

Originally Posted by HamletEagle (Post 2601702)
Then there is no bug. pev_owner is not set at that point, this is why you must use m_pPlayer offset to retrieve the player index.
So please switch back to ItemDeploy and use m_pPlayer instead of pev_owner.

Done.

PS: if you want to have a look and approve this one as well, since it uses pretty much the same code.

CzechPeter 07-11-2018 12:17

Re: Knife Models [XP System Support]
 
Code:

"L 07/11/2018 - 18:15:16: [AMXX] Run time error 10: native error (native "clamp")
L 07/11/2018 - 18:15:16: [AMXX]    [0] yb983cxt.sma.p::use_vault (line 677)
L 07/11/2018 - 18:15:16: [AMXX]    [1] yb983cxt.sma.p::ReadData (line 452)
L 07/11/2018 - 18:15:16: [AMXX] Displaying debug trace (plugin "crx_ranksystem.amxx", version "unknown)"

Please help :(


All times are GMT -4. The time now is 07:37.

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