Raised This Month: $ Target: $400
 0% 

[Solved] API Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pacheco
Senior Member
Join Date: Jul 2011
Old 08-10-2013 , 17:24   [Solved] API Problem
Reply With Quote #1

Hello. I have one register system like zp rabs (https://forums.alliedmods.net/showthread.php?t=168909)
I'm trying to do API for the register system, but I have one problem to get username.

I did it
PHP Code:
public native_get_user_login(id)
{
    return 
g_szTempName[id]

But it doesn't work. How to do it correct?

PS: the variable is:
Code:
new g_szTempName[33][100]
__________________




Last edited by pacheco; 08-10-2013 at 18:10.
pacheco is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-10-2013 , 17:31   Re: API Problem
Reply With Quote #2

You have to proceed as get_user_name

Code:
native get_user_login(index, dest[], maxlen);
I think something like that but i've never used set_string and its 2nd param is named dest, i think it should be named source[] and then the usage should be ok.

PHP Code:
new g_szTempName[33][100];

public 
plugin_natives()
{
    
register_native("get_user_login""native_get_user_login");
}

public 
native_get_user_login(pluginparams
{
    new 
id get_param(1);
    if( 
<= id <= 32 )
    {
        
set_string(2g_szTempName[id], get_param(3));
        return 
1;
    }
    return 
0;

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-10-2013 at 17:33.
ConnorMcLeod is offline
pacheco
Senior Member
Join Date: Jul 2011
Old 08-10-2013 , 18:02   Re: API Problem
Reply With Quote #3

Thanks Connor! Works!
__________________



pacheco 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 00:06.


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