Raised This Month: $ Target: $400
 0% 

Get full player info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-15-2009 , 13:38   Re: Get full player info
Reply With Quote #1

Quote:
Originally Posted by Dores View Post
@SnoW: You forgot to check if the player is connected, which will cause issues.
Actually I didn't. It was an example function that wasn't ever called(the code was in function because it would look weird without with the init and global variable).

It was just a code part, if he adds it to spawn event, then he first checks if the user is alive, if somewhere is needed only connect-check then he checks that.

And because it was for all those information, if he wants to get healths, also shouldn't use connect-check.

Last edited by SnoW; 01-15-2009 at 13:43.
SnoW is offline
Send a message via MSN to SnoW
Old 01-15-2009, 13:49
AoD90
This message has been deleted by AoD90.
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-15-2009 , 13:51   Re: Get full player info
Reply With Quote #3

Quote:
Originally Posted by SnoW View Post
Actually I didn't. It was an example function that wasn't ever called(the code was in function because it would look weird without with the init and global variable).

It was just a code part, if he adds it to spawn event, then he first checks if the user is alive, if somewhere is needed only connect-check then he checks that.

And because it was for all those information, if he wants to get healths, also shouldn't use connect-check.
If his going to get/set the player's info when the player spawns, he doesn't need both my and your codes since his doing an each-player method of setting the info.

Quote:
Originally Posted by anakin_cstrike View Post
Is enought to check if he's alive.
I know.

Quote:
Originally Posted by AoD90 View Post
@Dores
Can I replace it with SnoW's function money[i]?
I guess you can, but it's not such a good idea since the player's money might change without the money[] variable to be updated.

Last edited by Dores; 01-15-2009 at 14:00.
Dores is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-15-2009 , 14:39   Re: Get full player info
Reply With Quote #4

Quote:
Originally Posted by Dores View Post
If his going to get/set the player's info when the player spawns, he doesn't need both my and your codes since his doing an each-player method of setting the info.
Hmm... You are talking to me. I -don't know/wasn't talking- anything about attaching our codes together. If you was answering to him, just leave it like that
SnoW is offline
Send a message via MSN to SnoW
AoD90
Senior Member
Join Date: Jul 2008
Location: Ugljevik/RS/BIH
Old 01-15-2009 , 15:52   Re: Get full player info
Reply With Quote #5

I still don't know how to get player wepons and later to give that weapons to player...
AoD90 is offline
Send a message via MSN to AoD90
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-15-2009 , 15:57   Re: Get full player info
Reply With Quote #6

Quote:
Originally Posted by SnoW View Post
Hmm... You are talking to me. I -don't know/wasn't talking- anything about attaching our codes together. If you was answering to him, just leave it like that
Huh?
1) I was talking to you - I wrote that right below a quote of yours...
2) I didn't meant combining our codes together, I meant that no matter what code he uses, mine or yours, if AoD's going to change a player's info when the player spawns like you said AoD might do, he(AoD) won't need any of the codes we gave him(not together...).

Quote:
Originally Posted by AoD90
I still don't know how to get player wepons and later to give that weapons to player...
Do you want to save the player's weapons and give them to him back when he respawns?
Dores is offline
AoD90
Senior Member
Join Date: Jul 2008
Location: Ugljevik/RS/BIH
Old 01-15-2009 , 16:01   Re: Get full player info
Reply With Quote #7

I wanna when I type some commant it saves all weapons of all players, and when i type some other commands it gives all players their weapons from saved values...
AoD90 is offline
Send a message via MSN to AoD90
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-15-2009 , 17:45   Re: Get full player info
Reply With Quote #8

Started coding that, AoD, but I must go to sleep now so I'll finish tomorrow unless someone faster than me will post before me which will most likely happen...
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-16-2009 , 00:52   Re: Get full player info
Reply With Quote #9

Quote:
Originally Posted by AoD90 View Post
I wanna when I type some commant it saves all weapons of all players, and when i type some other commands it gives all players their weapons from saved values...
Untested but this should work, it may require some modding depending on your needs (ie. getting\giving bpammo, blocking ct\t only weapons).

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>

new g_Weapons[33];

public 
plugin_init() 
{
    
register_plugin("Get\Give player weapons""1.0" "bugsy")
    
    
register_concmd("amx_getweapons""GetWeapons" ADMIN_ADMIN  "- Get all players current weapons.")
    
register_concmd("amx_giveweapons""GiveWeapons" ADMIN_ADMIN  "- Give all players their saved weapons.")
}

public 
client_disconnect(id)
{
    
g_Weapons[id] = 0;
}

public 
GetWeapons(id)
{
    new 
iPlayers[32];
    new 
iPlayerNum;
    
    
get_playersiPlayersiPlayerNum "ac" );

    for( new 
0iPlayerNumi++)
        
g_Weapons[iPlayers[i]] = pev(iPlayers[i], pev_weapons) &~ (<< 31);

}

public 
GiveWeapons(id)
{
    new 
szWeapon[32];

    new 
iPlayers[32];
    new 
iPlayerNum;
    new 
o;

    
get_playersiPlayersiPlayerNum "ac" );

    for( new 
0iPlayerNumi++)
    {
        if( 
g_Weapons[iPlayers[i]] )
        {
            
fm_strip_user_weaponsiPlayers[i] );
        
            for( 
o<= 30 o++ )
            {
                if( (
g_Weapons[iPlayers[i]] & ( << )) )
                {
                    
get_weaponnameszWeapon 31 );
                    
fm_give_itemiPlayers[i] , szWeapon );
                }
            }
        }
    }
    return 
PLUGIN_HANDLED;

__________________

Last edited by Bugsy; 01-16-2009 at 01:46.
Bugsy is offline
AoD90
Senior Member
Join Date: Jul 2008
Location: Ugljevik/RS/BIH
Old 01-16-2009 , 03:22   Re: Get full player info
Reply With Quote #10

This is full code and it's not working...
Code:
public freeze()
{
    skorct=ctscore
    skort=tscore
    new players[32],num,i
    get_players(players,num)
    for(i = 1; i <= num; i++)
    {
        if (is_user_connected(i))
        {
            new id = players[i]
            set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN)
            money[i] = cs_get_user_money(i)
            frags[i] = get_user_frags(i)
            deaths[i] = cs_get_user_deaths(i)
            armor[i] = cs_get_user_armor(i,ArmorType)
            g_Weapons[id] = pev(id, pev_weapons) &~ (1 << 31)
        }
    }
    server_cmd("mp_freezetime 999")
    //server_cmd("sv_restart 1")
}

public unfreeze()
{
    new szWeapon[32]
    new o
    new players[32],num,i
    get_players(players,num)
    for(i = 0; i <= num; i++)
    {
        if (is_user_connected(i))
        {
            new id = players[i]
            set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)
            cs_set_user_money(i, money[i])
            set_user_frags(i, frags[i])
            cs_set_user_deaths(i,deaths[i])
            cs_set_user_armor(i,armor[i],ArmorType)
            if( g_Weapons[id] )
            {
                fm_strip_user_weapons( id );
        
                for( o = 1 ; o<= 30 ; o++ )
                {
                    if( (g_Weapons[id] & ( 1 << o )) )
                    {
                        get_weaponname( o , szWeapon , 31 );
                        fm_give_item( id , szWeapon );
                    }
                }
            }
        }
    }
    remove_task(11111)
    set_hudmessage(0, 150, 0, -1.0, 0.1, 0, 1.0, 3.0, 0.01, 0.01, -1)
    show_hudmessage(0,"[CyberSports - Match]^n^n Igra se nastavlja !!!")
    skor()
    //server_cmd("sv_restart 1")
    server_cmd("mp_freezetime 8")
    set_task(4.0,"skor", 0,"",1)
}
AoD90 is offline
Send a message via MSN to AoD90
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 01:47.


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