Mensajes: 128
Temas: 23
Registro en: Jun 2017
Reputación:
4
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(name, 32, "%s", string_test) client_print(id, print_chat, "%s", name) }
el include:
Código PHP: native print_test(index, string_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!
Mensajes: 1,902
Temas: 35
Registro en: Jan 2014
Reputación:
28
13/06/2018, 12:55 AM
(Última modificación: 13/06/2018, 12:56 AM por Chamo..)
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);
Mensajes: 128
Temas: 23
Registro en: Jun 2017
Reputación:
4
13/06/2018, 02:33 AM
(Última modificación: 13/06/2018, 02:50 AM por LeanPPP.)
(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( 1 ), print_chat, "%s", param_convert(get_param( 2 )) )
da error
edit:
asi tampoco
Código PHP: public __fxDecal(id, const test[]) {
param_convert(2)
client_print(get_param( 1 ), print_chat, "xD %s", test) }
Mensajes: 1,902
Temas: 35
Registro en: Jan 2014
Reputación:
28
13/06/2018, 10:24 AM
(Última modificación: 13/06/2018, 10:26 AM por Chamo..)
(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(param, dest[], maxlen);
|