Raised This Month: $51 Target: $400
 12% 

SetModel


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 08-02-2018 , 11:21   SetModel
Reply With Quote #1

Trying to set w_ models on weapons and I'm succesful but there's one thing that annoys me.

So basically this is what happens: I drop weapon for the first time and it sets w_ model but if you pick that dropped weapon and drop again, w_ model isn't set.

How do I call SetModel every time I drop weapon?
Airkish is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-02-2018 , 16:47   Re: SetModel
Reply With Quote #2

Show the code.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 08-02-2018 , 17:12   Re: SetModel
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
Show the code.
PHP Code:
public SetModel(entitymodel[])
{
    if(!
pev_valid(entity))
        return 
FMRES_IGNORED;

    static 
Classname[32]; pev(entitypev_classnameClassnamesizeof(Classname));

    if(!
equal(Classname"weaponbox"))
        return 
FMRES_IGNORED;

    static 
iOwneriOwner pev(entitypev_owner);
    static 
iWeaponiWeapon get_user_weapon(iOwner__);
    static 
weaponweapon find_ent_by_owner(-1nWeapon[iWeapon], entity);

    if(
g_bUsingGuns[iOwner][iWeapon] && !pev(weaponpev_impulse))
    {
        if(!
pev_valid(weapon))
            return 
FMRES_IGNORED;

        
set_pev(weaponpev_impulseg_bUsingGuns[iOwner][iWeapon]);
        

        if(
iWeapon == 28) {
            
entity_set_model(entitywak47);

            return 
FMRES_SUPERCEDE;
        }
        return 
FMRES_IGNORED;
    }

    return 
FMRES_IGNORED;

I tested with client_print, it's being called only once (when u first time drop item after pick/buy etc.)
Airkish is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-02-2018 , 22:53   Re: SetModel
Reply With Quote #4

Check if the sec parameter model is equal to the old weapon model then change it.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 13:34.


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