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

Setting models on the moment, not on next spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-14-2011 , 14:15   Setting models on the moment, not on next spawn
Reply With Quote #1

Hello, guys. So I have made myself an admin menu which I use to change player's models. But my problem is that when i choose one of the options the models don't change at exactly that moment. They change on next round and on round end they don't go back to the normal. I'm using cs_set_user_model. So my point is how can I make my menu to change the player's models immediately after I choose one of the options and at round start the models to reset back to normal. Can you help me?
dreamedward is offline
sader
Junior Member
Join Date: Aug 2011
Old 08-14-2011 , 14:31   Re: Setting models on the moment, not on next spawn
Reply With Quote #2

I am not 100% sure but I saw this function cs_reset_user_model(player) so I believe you must call it after you call cs_set_user_model
sader is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-14-2011 , 14:39   Re: Setting models on the moment, not on next spawn
Reply With Quote #3

It's the same function but sets the player model to (player). It's not what im asking for.
dreamedward is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2011 , 16:44   Re: Setting models on the moment, not on next spawn
Reply With Quote #4

Show your code.
__________________
fysiks is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-14-2011 , 17:21   Re: Setting models on the moment, not on next spawn
Reply With Quote #5

Here
PHP Code:
#include <amxmodx>
 #include <cstrike>
 
new bool:golb[33];
 new 
bool:smith[33];
 new 
bool:neo[33];
 
 public 
plugin_init()
 {
    
register_clcmd"/setmodels1","Menu");
    
register_event("ResetHUD","ModelReset","b")
 }
 public 
Menu(id)
 {
    new 
menu menu_create("\rSet Player's Models:""menu_handler");
    
menu_additem(menu"\wGolb""1"0);
    
menu_additem(menu"\wSmith""2"0);
    
menu_additem(menu"\wNeo""3"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
 }
 public 
menu_handler(idmenuitem)
 {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
    
golb[id] = true
        
}
        case 
2:
        {
            
smith[id] = true
        
}
        case 
3:
        {
            
neo[id] = true
        
}
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 }
 public 
resetModel(id)
 {
    if(
golb[id]) {
 
cs_set_user_model(id"golb")
    }
    
    if(
smith[id]) {
 
cs_set_user_model(id"smith")
    }  
    
    if(
neo[id]) {
 
cs_set_user_model(id"neo")
    }

I have precached the models in another plugin. They're ok.
dreamedward is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2011 , 17:56   Re: Setting models on the moment, not on next spawn
Reply With Quote #6

Quote:
Originally Posted by dreamedward View Post
But my problem is that when i choose one of the options the models don't change at exactly that moment. They change on next round and on round end they don't go back to the normal.
That's [almost] exactly how you have it coded. Set the user model when you want it to be set (and not in an event).

For setting it back you need to hook round end and loop through all players and reset their model.
__________________
fysiks is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-14-2011 , 18:20   Re: Setting models on the moment, not on next spawn
Reply With Quote #7

Ok, for the looping i can do it but how can i reset the models back?
dreamedward is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2011 , 18:27   Re: Setting models on the moment, not on next spawn
Reply With Quote #8

Quote:
Originally Posted by dreamedward View Post
Ok, for the looping i can do it but how can i reset the models back?
You search.

Are you sure they don't reset automatically?
__________________
fysiks is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-15-2011 , 05:17   Re: Setting models on the moment, not on next spawn
Reply With Quote #9

You're awesome!
dreamedward is offline
Reply


Thread Tools
Display Modes

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 08:04.


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