Enviar string a un native
#1
Hola gente!

Estoy teniendo un pequeño problema: no puedo enviar un string a un native de una libreria.

Ya probe con get_param(1) get_param(2), despues le puse una constante, despues formatex, y me da error de string invalido...como puedo hacer?

Libreria:

Código PHP:
public plugin_natives ()
{
    
register_library"libreria de prueba" );
    
register_native"print_test""__print_test" );
}


public 
__print_test(id, const string_test[])
{
    static 
name[33]
    
formatex(name32"%s"string_test)
    
client_print(idprint_chat"%s"name)


el include:

Código PHP:
native print_test(indexstring_test[] = "string de prueba"


y obviamente luego llamo esa native casi igual que en el inc:

Código PHP:
public test(id)
{
       
print_test(id"texto de prueba")


Cual es el problema? desde ya muchas gracias!
Responder
#2

amxmodx.inc escribió:
Código PHP:
// More Dynamic Native System Stuff
// Each of these natives affects one of the parameters sent to your native.
// Parameters go from 1 to n, just like in modules, and it is important to 
//  remember two things: The parameters are actually coming from another plugin
//  (and just like modules, you must use these special natives).
//  two: you CANNOT call your native from inside your native.  This is very bad.

//This function should only be called if you registered with style=1
//You only need to use it on by-reference parameters.
native param_convert(num); 
Responder
#3
(13/06/2018, 12:55 AM)Chamo. escribió:
amxmodx.inc escribió:
Código PHP:
// More Dynamic Native System Stuff
// Each of these natives affects one of the parameters sent to your native.
// Parameters go from 1 to n, just like in modules, and it is important to 
//  remember two things: The parameters are actually coming from another plugin
//  (and just like modules, you must use these special natives).
//  two: you CANNOT call your native from inside your native.  This is very bad.

//This function should only be called if you registered with style=1
//You only need to use it on by-reference parameters.
native param_convert(num); 

asi?
Código PHP:
client_print(get_param), print_chat"%s"param_convert(get_param)) ) 

da error Oh god why


edit:

asi tampoco Triste
Código PHP:
public __fxDecal(id, const test[])
{

    
param_convert(2)

    
client_print(get_param), print_chat"xD %s"test)

Responder
#4
(13/06/2018, 12:55 AM)Chamo. escribió:
amxmodx.inc escribió:// More Dynamic Native System Stuff
// Each of these natives affects one of the parameters sent to your native.
// Parameters go from 1 to n, just like in modules, and it is important to
// remember two things: The parameters are actually coming from another plugin
// (and just like modules, you must use these special natives).
// two: you CANNOT call your native from inside your native. This is very bad.

//This function should only be called if you registered with style=1

//You only need to use it on by-reference parameters.
native param_convert(num);


Tienes que registrar la native con el estilo 'nuevo'.



Si quieres usar la native con el estilo 'viejo', entonces debes usar esto:

amxmodx.inc escribió:
Código PHP:
// Gets a string from the calling plugin 
native get_string(paramdest[], maxlen); 
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)