AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Changing models & skins (https://forums.alliedmods.net/showthread.php?t=188451)

Waleed 06-26-2012 12:46

Changing models & skins
 
Hey there,I wanna ask how can I change the model of weapons using client command.
For Example: If clients types in "/giveme" then he would get few stuff + there weapon models or skins will also be changed with my precached skins ?
Is it possible?
I have used "cs_set_user_model" //I know it changes user model,Just checking :D
But it didn't worked.Any guesses?

Aooka 06-26-2012 12:56

Re: Changing models & skins
 
Can you give your code please.

Waleed 06-26-2012 13:05

Re: Changing models & skins
 
Here you go,
PHP Code:

#include <amxmodx>

new CustomWeaponHere[] = "models/CustomWeaponHere.mdl"

public plugin_precache()
{
    
precache_model(CustomWeaponHere)
}

public 
plugin_init()
{
    
register_plugin("Beast Mod","1.0","Waleed")
    
register_clcmd("say /giveme","cmd_giveme")    

}

public 
cmd_giveme(id)
{
    
// I want to set user weapon model here
    
    



Backstabnoob 06-26-2012 16:48

Re: Changing models & skins
 
hook FM_SetModel.

Waleed 06-26-2012 16:57

Re: Changing models & skins
 
I found this on wiki,How can I hook this ?
PHP Code:

FM_SetModel,            // void )    (ent, const szModel[]) 

I tried this:

PHP Code:

FM_SetModel(ent,"MyModel"

It gave me following error:

Error: Invalid function call, not a valid address on line 20
Error: Undefined symbol "ent" on line 20
Warning: Expression has no effect on line 20
Error: Expected token: ";", but found ")" on line 20
Error: Too many error messages on one line on line 20

I know I am doing this wrong :D
Whats the correct way?

Backstabnoob 06-26-2012 17:31

Re: Changing models & skins
 
PHP Code:


new g_Model[ ] = "models/new/v_weapon.mdl"

public plugin_init( )
     
register_forwardFM_SetModel"_FM_SetModel" )

public 
_FM_SetModelentmodel[ ] )
{
     new 
id peventpev_owner )

     if( 
is_user_aliveid ) && equalimodel"models/v_myweapon.mdl" ) )
          
set_pevidpev_viewmodelg_Model 


Waleed 06-26-2012 17:42

Re: Changing models & skins
 
Can I use fw_FM_SetModel instead of _FM_SetModel o_O?
What is pev and equali o_O? Where can I use them?

Backstabnoob 06-26-2012 17:45

Re: Changing models & skins
 
1) you can use whatever you want
2) search the forums for examples

pokemonmaster 06-26-2012 17:50

Re: Changing models & skins
 
I really you think read some tutorials (as me :D), I'm still learning fakemeta whom Backstabnoob gave you an example about it.

If you never read a pawn tutorial, here is a good one that helped me A LOT: Pawn Picture Tutorial
Here is one for fakemeta: Fakemeta General usage

This is a link for Useful Tutorials, Guides, Snippets, and References

Waleed 06-26-2012 18:02

Re: Changing models & skins
 
I have read Pawn Picture Tutorial many times.
But,Thanks for the Fakemeta General Usage tutorial,Let see What I learn from that o_O :D


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

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