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

Solved Help with stock


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 06-27-2018 , 19:52   Help with stock
Reply With Quote #1

Hello moders, good night, I hope everyone is well. Could someone give me an example of how to create (if not exist) a function that returns a specific number of players per team. Below I have a small example.

PHP Code:
#include <amxmodx>
#include <cstrike>

enum uUserData
{    
    
bool:bSurrender
}

new 
UserData[MAX_PLAYERS 1][uUserData]

// The player performs the function
    
UserData[id][bSurrender] = true
}

//Now what I need is a function that returns me the players who are surrendering, by teams [CT and TR] 

Last edited by iceeedr; 06-27-2018 at 23:23.
iceeedr is offline
Send a message via Skype™ to iceeedr
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-27-2018 , 20:16   Re: Help with stock
Reply With Quote #2

Call get_players() twice using the team flag. Use 2 parameters on your function, both by-reference.
__________________
Bugsy is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 06-27-2018 , 23:22   Re: Help with stock
Reply With Quote #3

Solved with

PHP Code:
GetSurrender(CsTeams:Team)
{
    new 
Players[32],Num;
    
get_players(Players,Num,"ceh",Team == CS_TEAM_T "TERRORIST" "CT");

    new 
Count 0;

    for(new 
0;Num;i++)
    {
        if(
UserData[Players[i]][bSurrender])
        {
            
Count++;
        }
    }

    return 
Count;

Thanks Bugsy and Smiley

Last edited by iceeedr; 06-27-2018 at 23:23.
iceeedr is offline
Send a message via Skype™ to iceeedr
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 23:47.


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