Raised This Month: $ Target: $400
 0% 

Finding a player from native by steamid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xDoctor
Member
Join Date: Jul 2013
Old 06-07-2015 , 02:00   Finding a player from native by steamid
Reply With Quote #1

i tried to get the player timelength online from my other plugin by doing

get_player_timeplayed( SteamID )

PHP Code:
public plugin_natives()
    
register_native"get_player_timeplayed""get_player_timeplayed");
    
public 
get_player_timeplayedsteamid2[] )
{
    new 
steamid332 ];
    
    
formatexsteamid3charsmaxsteamid3 ), "%s"steamid2 );
    new 
SteamID32 ], TimeLength;
    
    for( new 
0ArraySizeg_iTimePlayer ); i++ )
    {
        
ArrayGetStringg_iTimePlayeriSteamIDcharsmaxSteamID ) );
        
TrieGetCellg_iTimeLengthSteamIDTimeLength );
        
        if( 
equalisteamid2SteamID ) || equalisteamid3SteamID ) )
            return 
TimeLength;
    }
    return 
0;


PHP Code:
new TimePlayed get_player_timeplayedSteamID ); 
in the other plugin
can any one help me ?
xDoctor is offline
InsanityKARAI
Member
Join Date: Jul 2014
Old 06-07-2015 , 02:47   Re: Finding a player from native by steamid
Reply With Quote #2

Try


Remove:
public plugin_natives()
register_native( "get_player_timeplayed", "get_player_timeplayed", 1 );

native get_player_timeplayed( SteamID );
use to get the native registered in another plugin

main plugin:
PHP Code:
public plugin_natives() 
    
register_native"get_player_timeplayed""get_player_timeplayed"); 
     
public 
get_player_timeplayedsteamid2[] ) 

    new 
steamid332 ]; 
     
    
formatexsteamid3charsmaxsteamid3 ), "%s"steamid2 ); 
    new 
SteamID32 ], TimeLength
     
    for( new 
0ArraySizeg_iTimePlayer ); i++ ) 
    { 
        
ArrayGetStringg_iTimePlayeriSteamIDcharsmaxSteamID ) ); 
        
TrieGetCellg_iTimeLengthSteamIDTimeLength ); 
         
        if( 
equalisteamid2SteamID ) || equalisteamid3SteamID ) ) 
            return 
TimeLength
    } 
    return 
0

secondary plugin
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

native get_player_timeplayedSteamID );

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test","test")
}
public 
test(id)
{
    new 
played get_player_timeplayedSteamID );
    
// function


Last edited by InsanityKARAI; 06-07-2015 at 02:56.
InsanityKARAI is offline
xDoctor
Member
Join Date: Jul 2013
Old 06-07-2015 , 02:52   Re: Finding a player from native by steamid
Reply With Quote #3

Quote:
Originally Posted by InsanityKARAI View Post
Try

If the native is already registered in another plugin


Remove:
public plugin_natives()
register_native( "get_player_timeplayed", "get_player_timeplayed", 1 );

Add:
native get_player_timeplayed( SteamID );
i type alredy native get_player_timeplayed( steamid[] ) - for not getting an error in the other plugin

if ill delete the register_native the native will not be exists

native get_param( 1 ) = index i try to make it steamid[] )
i belive its the bug thats what im trying to understand.

Last edited by xDoctor; 06-07-2015 at 02:52.
xDoctor is offline
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 20:19.


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