AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get something of all players (https://forums.alliedmods.net/showthread.php?t=102332)

Alucard^ 09-01-2009 02:29

Get something of all players
 
Hi...

Well, i don't understand how to do this.. i think is a rly easy and small code but i don't catch how to do it o.O

I need to get for EXAMPLE... the money of ALL players but not separated... so i want to show all the money in a hud...

PHP Code:

#include <amxmodx>
#include <cstrike>

#define PLUGIN    "Get Money Test"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

new HudSync
new g_MaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
set_task(1.0"ShowMoney"0""0"b")
    
    
g_MaxPlayers get_maxplayers()
    
HudSync CreateHudSyncObj()
}

public 
ShowMoney()
{
    new 
moneyi
    
    
for(0<= g_MaxPlayersi++)
    {
        if(
is_user_alive(i) )
        
money cs_get_user_money(i)
    }
    
set_hudmessage(2552552550.010.1501.01.00.10.2, -1)
    
ShowSyncHudMsg(0HudSync"Money: %i"money)


This not work and i understand why is not working... is becouse the cs_get_user_money(i) doesn't get the total amount of all money.. just get the money for every index (i). Now i ask... how to get the total amount of money from all players.

Thx and sry if my english suck.

ot_207 09-01-2009 02:49

Re: Get something of all players
 
You want to get all the money? Put together? Will come with an edit.

Code:
#include <amxmodx> #include <cstrike> #define PLUGIN    "Get Money Test" #define AUTHOR    "Alucard" #define VERSION    "1.0" new HudSync new g_MaxPlayers public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         set_task(1.0, "ShowMoney", 0, "", 0, "b")         g_MaxPlayers = get_maxplayers()     HudSync = CreateHudSyncObj() } public ShowMoney() {     new money, i         for(i = 1; i <= g_MaxPlayers; i++)     {         if(is_user_connected(i) )         money += cs_get_user_money(i)     }     set_hudmessage(255, 255, 255, 0.01, 0.15, 0, 1.0, 1.0, 0.1, 0.2, -1)     ShowSyncHudMsg(0, HudSync, "Money: %i", money) }

Alucard^ 09-01-2009 08:49

Re: Get something of all players
 
Thx very much ot_207. Work perfect.

Also i have a question... how you add "background lines" into the PHP BBCODE?

I know the porpuse is to show the difference, but how you did it? I used vbulletin system a lot of time but never notice that o.o

xPaw 09-01-2009 08:59

Re: Get something of all players
 
[pawn] + @@ hi

Alucard^ 09-01-2009 09:47

Re: Get something of all players
 
Sry xPaw but i didn't understand what you said o.O

xPaw 09-01-2009 10:50

Re: Get something of all players
 
Code:
 hello i am yellow line

[pawn]@@ hello i am yellow line[/pawn]

Alucard^ 09-01-2009 11:03

Re: Get something of all players
 
Ohhh.. sry i tried to use [pawn] bbcode into the [php] bbcode... Now i understand, sry... and thx


All times are GMT -4. The time now is 15:09.

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