Raised This Month: $32 Target: $400
 8% 

AMX Mod X Stocks (Custom useful stocks)


Post New Thread Reply   
 
Thread Tools Display Modes
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-14-2016 , 23:29   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
PHP Code:
stock get_random_player()
{
    new 
iPlayers[32], iPlayersNum
    get_players
(iPlayersiPlayersNum)
    return 
iPlayersiPlayersNum randomiPlayersNum ) : ]

ftfy
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 09-15-2016 , 02:21   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #12

Quote:
Originally Posted by Emp` View Post
ftfy
PHP Code:
stock get_random_player() 

    new 
iPlayers[32], iPlayersNum 
    get_players
(iPlayersiPlayersNum
    return 
iPlayersNum iPlayersrandomiPlayersNum ) ] : 0

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-15-2016 , 10:02   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #13

Quote:
Originally Posted by meTaLiCroSS View Post
PHP Code:
stock get_random_player() 

    new 
iPlayers[32], iPlayersNum
    get_players
(iPlayersiPlayersNum)
    return 
iPlayersNum iPlayersrandomiPlayersNum ) ] : 0

PHP Code:
stock get_random_player() 

    new 
iPlayers[32], iPlayersNum;
    
get_players(iPlayersiPlayersNum);
    return 
iPlayersNum iPlayersrandomiPlayersNum ) ] : 0;

__________________
edon1337 is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 09-15-2016 , 15:10   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #14

Maybe I can use that feature for a later update, thank you.
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!
happy_2012 is offline
Old 09-16-2016, 05:54
Craxor
This message has been deleted by Craxor. Reason: however...
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-16-2016 , 06:00   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #15

Btw )

PHP Code:
stock get_random_alive_player()  
{  
    new 
iPlayers[32], iPlayersNum
    
get_players(iPlayersiPlayersNum"a");
 
    return 
iPlayersNum iPlayersrandomiPlayersNum ) ] : 0

__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-16-2016 , 13:45   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #16

Hack hack hack:
PHP Code:
#include <amxmodx>
#include <amxmisc>

#if !defined MAX_PLAYERS
const MAX_PLAYERS 32;
#endif

#define ForEachPlayer(%1,%2,%3) do {\
    
for (new %1; %<= MAX_PLAYERS; %1++) {\
        if (%
2) {\
            %
3;\
        }\
    }\
} while (
is_linux_server() == 0xDEADBEEF)

public 
plugin_init() {
    
register_clcmd("say /dd""DD");
}

public 
DD() {
    
ForEachPlayer(xis_user_alive(x) && is_user_admin(x), client_print(xprint_chat"!!!"));

PHP Code:
ForEachPlayer(xis_user_alive(x) && is_user_admin(x), client_print(xprint_chat"!!!"), give_item(x"weapon_ak47")); 
__________________

Last edited by PRoSToTeM@; 09-16-2016 at 13:48.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 09-16-2016 , 13:55   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #17

Quote:
Originally Posted by PRoSToTeM@ View Post
Hack hack hack:
PHP Code:
#include <amxmodx>
#include <amxmisc>

#if !defined MAX_PLAYERS
const MAX_PLAYERS 32;
#endif

#define ForEachPlayer(%1,%2,%3) do {\
    
for (new %1; %<= MAX_PLAYERS; %1++) {\
        if (%
2) {\
            %
3;\
        }\
    }\
} while (
is_linux_server() == 0xDEADBEEF)

public 
plugin_init() {
    
register_clcmd("say /dd""DD");
}

public 
DD() {
    
ForEachPlayer(xis_user_alive(x) && is_user_admin(x), client_print(xprint_chat"!!!"));

PHP Code:
ForEachPlayer(xis_user_alive(x) && is_user_admin(x), client_print(xprint_chat"!!!"), give_item(x"weapon_ak47")); 
wait wait wait, what is this for :
Code:
 while (is_linux_server() == 0xDEADBEEF)
Freezo Begin is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-16-2016 , 14:03   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #18

Quote:
Originally Posted by Freezo Begin View Post
wait wait wait, what is this for :
Code:
 while (is_linux_server() == 0xDEADBEEF)
This is guaranted loop break without compiler warnings. (but not compile-time...)
__________________

Last edited by PRoSToTeM@; 09-16-2016 at 14:03.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-16-2016 , 14:18   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #19

Why did you need that in the first place?
klippy is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-16-2016 , 14:48   Re: AMX Mod X Stocks (Custom useful stocks)
Reply With Quote #20

Wow, this works too:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

#pragma tabsize 0 // I can't win loose indentation in macro...

#if !defined MAX_PLAYERS
const MAX_PLAYERS 32;
#endif

#define ForEachPlayer(%1,%2,%3) do {\
    
for (new %1; %<= MAX_PLAYERS; %1++) {\
        if (%
2) {\
            %
3;\
        }\
    }\
} while (
is_linux_server() == 0xDEADBEEF)

#define GetPlayers(%0,%1,%2,%3) do {\
    
%0;\
    for (new %
1; %<= MAX_PLAYERS; %2++) {\
        if (%
3) {\
            %
0[%1++] = %2;\
        }\
    }\
} while (
is_linux_server() == 0xDEADBEEF)

#define GetRandomPlayers(%0,%1,%2,%3) do {\
    
static _plrs[MAX_PLAYERS];\
    new 
_plrCount;\
    
GetPlayers(_plrs_plrCount, %2, %3);\
    \
    %
min(%1_plrCount);\
    for (new 
_i 0_i < %1_i++) {\
        new 
_rnd random_num(0_plrCount 1);\
        \
        %
0[_i] = _plrs[_rnd];\
        
_plrs[_rnd] = _plrs[_plrCount 1];\
        \
        
_plrCount--;\
    }\
} while (
is_linux_server() == 0xDEADBEEF)

#define GetRandomPlayer(%0,%1,%2) do {\
    
static _players[MAX_PLAYERS];\
    new 
_playerCount;\
    
GetPlayers(_players_playerCount, %1, %2);\
    %
_playerCount _players[random_num(0_playerCount 1)] : 0;\
} while (
is_linux_server() == 0xDEADBEEF)

public 
plugin_init() {
    
register_clcmd("say /dd""DD");

PHP Code:
public DD() {
    
ForEachPlayer(xis_user_alive(x) && is_user_admin(x), client_print(xprint_chat"!!!"), give_item(x"weapon_ak47"));
    
    new 
players[2], count sizeof(players);
    
GetRandomPlayers(playerscountxis_user_connected(x) && is_user_admin(x));
    
    new 
player;
    
GetRandomPlayer(playerxis_user_alive(x) && is_user_admin(x));
    
client_print(0print_chat"%d"player);

Quote:
Originally Posted by KliPPy View Post
Why did you need that in the first place?
What do you mean?
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
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:05.


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