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

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


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ZEDD_Intensity
Senior Member
Join Date: Jun 2016
Old 07-02-2018 , 18:41   native "cs_get_user_team" & native "cs_get_weapon_silen" - The complicated way
Reply With Quote #1

Greetings,

Hope everybody is having a great time here.

Had to post this after a lot of searching and fixing didn't help.

Error :
PHP Code:
L 07/01/2018 22:26:11Start of error session.
L 07/01/2018 22:26:11Info (map "css_dust2") (file "addons/amxmodx/logs/error_20180701.log")
L 07/01/2018 22:26:11: [CSTRIKEInvalid player 3
L 07
/01/2018 22:26:11: [AMXXDisplaying debug trace (plugin "x_216.amxx"version "2.16")
L 07/01/2018 22:26:11: [AMXXRun time error 10native error (native "cs_get_user_team")
L 07/01/2018 22:26:11: [AMXX]    [0x_216.sma::HandleSay (line 517
Code extracts :
PHP Code:
public HandleSay(id)
{
    new 
Message[192], None[2][32], Chat[192], Alive[16];
    
    
read_args(Message191);
    
remove_quotes(Message);

    
formatex(None[0], 31"");
    
formatex(None[1], 31" ");
    
    if(
Message[0] == '@' || Message[0] == '!' || equal (Message""))
        return 
PLUGIN_HANDLED;
    
    if(!
is_user_alive(id))
        
Alive "*DEAD* ";
    else
        
Alive "";
        
    if(!
equali(MessageNone[0]) && !equali(MessageNone[1]))
    {
        if(
Logined[id])
        {
            
formatex(Chat191"^1%s^4[%s] ^3%s^1 : %s"AliveRanks[CurrentRank[id]], Name[id], Message);
        }
        else
        {
            
formatex(Chat191"^1%s^4[Unranked] ^3%s^1 : %s"AliveName[id], Message);
        }
        
//////// Line 517 Below ////////
        
switch(cs_get_user_team(id)) // Line 517 Here
        //////// Line 517 Above ///////
        
{
            case 
CS_TEAM_TColorChat(0REDChat);
            case 
CS_TEAM_CTColorChat(0BLUEChat);
            case 
CS_TEAM_SPECTATORColorChat(0GREYChat);
        }
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;

Tried adding a check : Failed.
PHP Code:
    if(!is_user_connected(id))
    { 
Checking is_user_alive didn't make sense to me, and still for the 'sake of science', I tried it and it made the code wildly malfunction and blocked chat messages, as expected.

I'd love to get a fixed code and also learn how to fix these type of errors, especially with SayHandlers.

Lemme know if you need any additional information.
Kind Regards,
ZEDD
__________________

Last edited by ZEDD_Intensity; 07-03-2018 at 15:12. Reason: better SEO, lol
ZEDD_Intensity 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 17:38.


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