Raised This Month: $ Target: $400
 0% 

[HELP] What am I doing wrong here?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-19-2018 , 20:03   Re: [HELP] What am I doing wrong here?
Reply With Quote #1

You're totally wrong. Let me explain every single thing that you did wrong:

1. You don't need to create a global array in this situation, same as the integers. You should just create them in the function itself.
2. You're setting the hud's parameters in the init, wtf? Do it in the function, same as 1.
3. The tag mismatch, is because you're using get_user_team() native which returns numbers with CS_TEAM_T/CS_TEAM_CT. You should use 1/2 or change to cs_get_user_team().
4. You don't need to decrease the number in the death msg because get_players() has "a" flag which returns only alive players.
5. You don't need to use the loop to show the alive players.

So, the right thing to do, is simple:

PHP Code:
#include <amxmodx>

#define VERSION "1.0"

public plugin_init() 
{
    
register_plugin("Show Alive Players"VERSION"IDK")
    
    
set_task(1.0"showAlivePlayers", .flags "b")
}

public 
showAlivePlayers()
{
    new 
iPlayers[32], iNum[2]
    
get_players(iPlayersiNum[0], "ae""CT")
    
get_players(iPlayersiNum[1], "ae""TERRORIST")
    
    if((
iNum[0] + iNum[1]) <= 1)
        return
        
    
set_hudmessage(025500.0090.0006.0105.00.30.31)
    
show_hudmessage(0"CTs: %d TRs: %d"iNum[0], iNum[1])

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
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 04:42.


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