AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   register_native, return text. (https://forums.alliedmods.net/showthread.php?t=92768)

xbatista 05-19-2009 13:23

register_native, return text.
 
I know I return bad,cuz it returns not a value, so how to return it as a text/text message by playersh[id]?
Cuz I need to put it in another plugin ,something like this :
Second plugin :
PHP Code:

    pos += format(szMotd[pos], 2047-pos"RankShit : %s<br><br>"get_user_sh(id)) 

Include file:
PHP Code:

native get_user_sh(id

First plugin :
PHP Code:

#define MAXSHIT 2

new const RANKSHIT[MAXSHIT][] = { "bull.....""cow....."}

new 
playersh[33];
public 
plugin_natives()
{
    
register_native("get_user_sh""native_get_user_sh"1);


PHP Code:

// Native: return text
public native_get_user_sh(id)
{
    return 
RANKSHIT[playersh[id]];



Emp` 05-19-2009 14:03

Re: register_native, return text.
 
IIRC you cannot do that with natives. You will have to use:
Code:

// Sets a string in the calling plugin
native set_string(param, dest[], maxlen);


xbatista 05-19-2009 14:08

Re: register_native, return text.
 
Omg I don't know how to use it :/
Show me please an example of that code what I gave

Emp` 05-19-2009 16:01

Re: register_native, return text.
 
Code:

public native_get_user_sh(id, string[], len)
{
    return set_string(2, RANKSHIT[playersh[id]], len);
}

You might be able to just do:
Code:

public native_get_user_sh(id, string[], len)
{
    return copy(string, len, RANKSHIT[playersh[id]]);
}

I'm not really sure with mode 1 with fakenatives.

You'll also have to use
Code:

native get_user_sh(id, string[], len)
In your include file.

xbatista 05-19-2009 16:37

Re: register_native, return text.
 
Ok thanks ,will try tommorow ,will give feedback, going to sleep :0

xbatista 05-20-2009 00:28

Re: register_native, return text.
 
How to use than this in MOTD/show text?

new str[5];
get_user_sh(id, str, 4) ?

xbatista 05-21-2009 10:02

Re: register_native, return text.
 
Someone,please? :/

xbatista 06-02-2009 12:17

Re: register_native, return text.
 
Please? :mrgreen:

hleV 06-02-2009 12:54

Re: register_native, return text.
 
Don't bump your thread unless it's been 2 weeks after the last post.

xbatista 06-12-2009 13:45

Re: register_native, return text.
 
bump :0
I need to solve that sh...


All times are GMT -4. The time now is 01:24.

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