AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_frags . please help (https://forums.alliedmods.net/showthread.php?t=83479)

Sage_UA 01-10-2009 10:48

get_user_frags . please help
 
Code:

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    set_task(1.0, "pokazivalka", 1, "", 0, "b")
}

public pokazivalka()
{
    new fragi[5], smerti[5], hp[5]
       
        get_user_frags(id, fragi, sizeof fragi -1)
        get_user_deaths(id, smerti, sizeof smerti -1)
        get_user_health(id, hp, sizeof hp -1)
       
    set_hudmessage(255, 0, 255, 0.01, 0.15, 0, 6.0, 2.0)
    show_hudmessage(id, "Health: %s HP^nFrags: %s^nDeaths: %s", hp, fragi, smerti)
}

errors:

http://s53.radikal.ru/i141/0901/7a/29c356627db1t.jpg

please help :oops:

xPaw 01-10-2009 11:04

Re: get_user_frags . please help
 
you should loop that throught all players.

Arkshine 01-10-2009 11:09

Re: get_user_frags . please help
 
Since you're using a task which doesn't pass the player's id, you need to loop through all players, in pokazivalka().

Sage_UA 01-10-2009 11:32

Re: get_user_frags . please help
 
i have not understood something.
instead of pokazivalka() to make pokazivalka(id) ?

Can give a code please :)

ps
from me karma+ :)

anakin_cstrike 01-10-2009 11:43

Re: get_user_frags . please help
 
Read again what ark said.
PHP Code:

new g_maxplayers;
public 
plugin_init() g_maxplayers get_maxplayers(); // ..
public pokazivalka()
{
    for( new 
id 1id <= g_maxplayersid++ )
    {
          
// your code here



Sage_UA 01-10-2009 12:16

Re: get_user_frags . please help
 
i the beginner in pawn scripting, also do not understand about what you.

also what it for a code which has given anakin_cstrike :o

you could not transform to it in my code? please.

SnoW 01-10-2009 12:25

Re: get_user_frags . please help
 
Lol, messed with these colors...
Code:

new g_maxplayers;
public
plugin_init()

{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    set_task(1.0, "pokazivalka", 1, "", 0, "b")

    g_maxplayers = get_maxplayers();
}
public pokazivalka
()
{

    new fragi[5], smerti[5], hp[5]
    for( new
id = 1; id <= g_maxplayers; id
++ )
    {
        get_user_frags(id, fragi, sizeof fragi -1)
        get_user_deaths(id, smerti, sizeof smerti -1)
        get_user_health(id, hp, sizeof hp -1)
       
        set_hudmessage(255, 0, 255, 0.01, 0.15, 0, 6.0, 2.0)
        show_hudmessage(id, "Health: %s HP^nFrags: %s^nDeaths: %s", hp, fragi, smerti)

         

    }
}


Sage_UA 01-10-2009 12:38

Re: get_user_frags . please help
 
Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Frags and Death pod radarom"
#define VERSION "1.0"
#define AUTHOR "maJic"


new g_maxplayers

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    set_task(1.0, "pokazivalka", 1, "", 0, "b")
   
    g_maxplayers = get_maxplayers()
}

public pokazivalka()
{
    new fragi[5], smerti[5], hp[5]
   
    for( new id = 1; id <= g_maxplayers; id++ )
    {
    get_user_frags(id, fragi, sizeof fragi -1)
    get_user_deaths(id, smerti, sizeof smerti -1)
    get_user_health(id, hp, sizeof hp -1)
       
        set_hudmessage(255, 0, 255, 0.01, 0.15, 0, 6.0, 2.0)
        show_hudmessage(id, "Health: %s HP^nFrags: %s^nDeaths: %s", hp, fragi, smerti)
         
    }
}

errors :(

on lines:
Code:

    get_user_frags(id, fragi, sizeof fragi -1)
    get_user_deaths(id, smerti, sizeof smerti -1)
    get_user_health(id, hp, sizeof hp -1)

%)

SnoW 01-10-2009 13:14

Re: get_user_frags . please help
 
I never fixed the code, just attached them like you wanted.
The values must be int, still you could set them in the show_hud straigth, so you don't need to create values for them, still just showing how to do with ints:
Code:

#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Frags and Death pod radarom"
#define VERSION "1.0"
#define AUTHOR "maJic"
 
new g_maxplayers
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
 
    set_task(1.0, "pokazivalka", 1, "", 0, "b")
 
    g_maxplayers = get_maxplayers()
}
public pokazivalka()
{
    for( new id = 1; id <= g_maxplayers; id++ )
    {
      new fragi = get_user_frags(id);
      new smerti = get_user_deaths(id);
      new hp = get_user_health(id);     
        set_hudmessage(255, 0, 255, 0.01, 0.15, 0, 6.0, 2.0)
        show_hudmessage(id, "Health: %i HP^nFrags: %i^nDeaths: %i", hp, fragi, smerti)
 
    }
}


xPaw 01-10-2009 13:27

Re: get_user_frags . please help
 
PHP Code:

#include <amxmodx>

#define PLUGIN    "Frags & Deaths under radar"
#define VERSION    "1.0"
#define AUTHOR    "maJic"

new gMaxPlayers;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)

    
set_task(1.0"pokazivalka"1""0"b")
    
gMaxPlayers get_maxplayers()
}

public 
pokazivalka() {
    for( new 
id 1id <= gMaxPlayersid++ ) {
        if( 
is_user_alive(id) ) {
            
set_hudmessage(25502550.010.1501.01.0);
            
show_hudmessage(id"Health: %i HP^nFrags: %i^nDeaths: %i"get_user_health(id), get_user_frags(id), get_user_deaths(id));
        }
    }




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

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