Raised This Month: $ Target: $400
 0% 

native "cs_get_user_team" & native "cs_get_weapon_silen" - The complicated way


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-03-2018 , 15:30   Re: native "cs_get_user_team" & native "cs_get_weapon_silen" - The complicated way
Reply With Quote #7

is_user_alive already check if the player is connected, so you don't need to verify. Also, you need to check if weapon is a valid entity.

Code:
public SkinCheck(id) {     if(!is_user_alive(id))         return PLUGIN_HANDLED;         new Sil, WPName[32];     formatex(WPName, charsmax(WPName), DefaultModels[get_user_weapon(id)][1]);     new WPN = find_ent_by_owner(-1, DefaultModels[get_user_weapon(id)][1], id);         if (!is_valid_ent(WPN))         return PLUGIN_HANDLED;     if(get_user_weapon(id) == CSW_M4A1 || get_user_weapon(id) == CSW_USP)         Sil = cs_get_weapon_silen(WPN);             if(get_user_weapon(id) == CSW_AWP)         cs_set_user_zoom(id, 0, 0);         PlayAnimation(id, AnimationIDs[get_user_weapon(id)][Sil]);     return PLUGIN_HANDLED; }

Also, consider to use switch instead of a lot of "if"
__________________









Last edited by CrazY.; 07-03-2018 at 15:32.
CrazY. is offline
 



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 12:13.


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