AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Displaying HUD msg to a group... (https://forums.alliedmods.net/showthread.php?t=62915)

Mini_Midget 11-07-2007 07:30

Displaying HUD msg to a group...
 
1 Attachment(s)
I'm trying to display this...
[img]http://img136.**************/img136/5194/csassault0023nu7.jpg[/img]
But this is displaying for the whole CT team and my team mates stats.

What I'm trying to do is make it display for the squad you are in.
For eg...
I'm in squad alpha and I type /stats.
I want it to show the stats of everyone in squad alpha.
Not any other squads, just the CT side of squad alpha.

I know its somewhere in these lines...
PHP Code:

new infoTable[256], pdata[32][playerData], pnum
    format
(infoTable255"HP - AP^t^tWEAPON^t^tAMMO^t^tNAME^n")

    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"ae""CT")
    for (new 
iNum ;  x++)
    {
        new 
iPlayers[x

        new 
line[MAX_ROW_SIZE], name[32], ihphp[4], iapap[4], weapon[8], iclipclip[4], iammoammo[4], weap get_user_weapon(iiclipiammo


The next thing is that I realized that all the squads are all linked to both teams.
For eg...
I'm in CT and I join squad delta.
Delta - 1/5
And someone in T joins squad delta too.
Delta - 2/5

How can I make it so both teams have their own group of squads so when you join one. It won't effect the other teams squad member count.

Thanks for the help!

ConnorMcLeod 11-07-2007 07:57

Re: Displaying HUD msg to a group...
 
May be like this ?
Code:
showRes(id) { //  if ( cs_get_user_team(id) != CS_TEAM_CT) return     new infoTable[256], pdata[32][playerData], pnum     format(infoTable, 255, "HP - AP^t^tWEAPON^t^tAMMO^t^tNAME^n")     new iPlayers[32], iNum     get_players(iPlayers, iNum/*, "ae", "CT"*/)     for (new x = 0 ; x < iNum ;  x++)     {         new i = iPlayers[x]         if(PlayerSquad[i] != PlayerSquad[id])             continue         new line[MAX_ROW_SIZE], name[32], ihp, hp[4], iap, ap[4], weapon[8], iclip, clip[4], iammo, ammo[4], weap = get_user_weapon(i, iclip, iammo)

[ --<-@ ] Black Rose 11-07-2007 08:16

Re: Displaying HUD msg to a group...
 
I changed it a bit...

Mini_Midget 11-08-2007 05:44

Re: Displaying HUD msg to a group...
 
Whoa...
Thanks [ --<-@ ] Black Rose!

I'm just going through your code and learning from it.
Btw, why did you include fakemeta when you didn't use any functions from it?

Hmm...
When I test it with your version. There seems to be a runtime error when someone spawns.
Code:

L 11/08/2007 - 23:29:34: [AMXX] Run time error 4: index out of bounds
L 11/08/2007 - 23:29:34: [AMXX]    [0] squad_mod(2).sma::ChooseSquad (line 164)
L 11/08/2007 - 23:29:34: [AMXX]    [1] squad_mod(2).sma::event_player_spawn (line 127)
L 11/08/2007 - 23:29:34: [AMXX]    [2] squad_mod(2).sma::event_hud_reset (line 110)

I can't find the error myself... o.0

[ --<-@ ] Black Rose 11-08-2007 10:15

Re: Displaying HUD msg to a group...
 
Wich line is 164?

I never got that error...

Mini_Midget 11-08-2007 20:29

Re: Displaying HUD msg to a group...
 
164:
PHP Code:

    len += format(menu[len], 511-len"\y1. \wAlpha   (\y%d/\r%d)^n"squad_alpha[get_user_team(id) - 1], limit

127:
PHP Code:

case SQUAD_NONE: {
            
ChooseSquad(id)
            return 
PLUGIN_HANDLED 

110:
PHP Code:

public event_hud_reset(id) {
    if (
g_restart_attempt[id]) {
        
g_restart_attempt[id] = false;
        return;
    }
    
event_player_spawn(id// <---
    
ShowTeam()



Alka 11-09-2007 00:32

Re: Displaying HUD msg to a group...
 
The error is when the function "ChooseSquad(id)" is called, then line 164. Try to make the "squad_alpha" array with 5 cells ("squad_alpha[5]").

[ --<-@ ] Black Rose 11-09-2007 07:40

Re: Displaying HUD msg to a group...
 
Why would you need 5 when there's only 2 teams?

Try this then.

Alka 11-09-2007 07:45

Re: Displaying HUD msg to a group...
 
Yeah, you'r right, but i don't see the problem, was a suggestion.

Mini_Midget 11-10-2007 08:45

Re: Displaying HUD msg to a group...
 
Thanks a bundle [ --<-@ ] Black Rose!!!

I was gonna make it do all that but just needed help with this part.
No more run time errors now so thats a good sign.

Oh btw, is there a better way to update the stats?
Or is CurWeapon properly the best choice though it only updates if YOU do something like...
- Shoot
- Change weapons
- Reload
- Action2 (Scope and stuff)


All times are GMT -4. The time now is 01:14.

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