AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] API Problem (https://forums.alliedmods.net/showthread.php?t=223188)

pacheco 08-10-2013 17:24

[Solved] API Problem
 
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]

ConnorMcLeod 08-10-2013 17:31

Re: API Problem
 
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;



pacheco 08-10-2013 18:02

Re: API Problem
 
Thanks Connor! Works!


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

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