Raised This Month: $32 Target: $400
 8% 

Forward string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 11-13-2007 , 08:52   Forward string
Reply With Quote #1

Hi,

Is there a way to pass a pointer to string in a multiforward ?
I call a multiforward with strings in parameter from plugin1, plugin2 has the function and modify theses strings ... and i would like to get modifyed string in plugin1.

It doesn't work with string, I've always the same string in plugin1 ...


Quote:
plugin1:

g_MultiForward = CreateMultiForward("forward_fnc", ET_IGNORE, FP_STRING, FP_STRING, FP_STRING, FP_CELL);
...
ExecuteForward(g_MultiForward, g_MultiForwardResult, stringa, stringc,stringb, exist_flag);
...
Quote:
plugin2:

public forward_fnc(stringa, stringc, stringb,exist_flag)
{...
format(stringa,123,"something ...")
...
}

thks
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-13-2007 , 09:33   Re: Forward string
Reply With Quote #2

Can't use use FM's EngFunc_AllocString, and pass it as a cell?

So long as anyone using your forward knows it's an allocated string ...

No, wait. Think I slightly missed your point.

PAWN doesn't really do pointers, so I doubt you'll have any real luck there.
purple_pixie is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 11-13-2007 , 10:23   Re: Forward string
Reply With Quote #3

The only thing i can think and tested, is to call a forward to main plugin and send the modified string ...here is an e.g (Works):

Main:
Code:
#include <amxmodx>
 
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Alka"
 
new g_MultiForward;
new g_MultiForwardResult;
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR);
 
 g_MultiForward = CreateMultiForward("Function_Show_Msg", ET_IGNORE, FP_CELL, FP_STRING, FP_STRING, FP_STRING);
 
 register_clcmd("say /test", "TestMultiForward");
}
 
public plugin_end()
 DestroyForward(g_MultiForward);
 
public TestMultiForward(id)
{
 static String[32], String1[32], String2[32];
 static Cell;
 
 formatex(String, sizeof String - 1, "wow");
 formatex(String1, sizeof String1 - 1, "is working!");
 formatex(String2, sizeof String2 - 1, "Woot :D");
 
 Cell = id;
 
 ExecuteForward(g_MultiForward, g_MultiForwardResult, Cell, String, String1, String2);
}
 
public Function_Show_Msg_Main(id, String1[], String2[], String3[])
{
 client_print(id, print_chat, "%s %s%s", String1, String2, String3);
}
Sample:
Code:
#include <amxmodx>
 
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Alka"
 
new g_MultiForward;
new g_MultiForwardResult;
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR);
 
 g_MultiForward = CreateMultiForward("Function_Show_Msg_Main", ET_IGNORE, FP_CELL, FP_STRING, FP_STRING, FP_STRING);
}
 
public plugin_end()
 DestroyForward(g_MultiForward);
 
public Function_Show_Msg(id, String1[], String2[], String3[])
{
 client_print(id, print_chat, "%s %s%s", String1, String2, String3);
 
 static String1m[32], String2m[32], String3m[32];
 
 format(String1m, sizeof String1m - 1, "%s[Modified]", String1);
 format(String2m, sizeof String2m - 1, "%s[Modified]", String2);
 format(String3m, sizeof String3m - 1, "%s[Modified]", String3);
 
 static Cell;
 Cell = id;
 
 ExecuteForward(g_MultiForward, g_MultiForwardResult, Cell, String1m, String2m, String3m);
}
Maybe someone know a better way ?!
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 11-14-2007 , 22:17   Re: Forward string
Reply With Quote #4

Take a look at ATAC 3.0.0 source code:
exec_PunishName function is what you want to look at, this is the core for handling the punishment titles.

The only thing is you must encode the string to send it back to plugin 1.
Look at any punishment scripts for function: public atac_punishment_name( id ).
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 11-14-2007 , 22:29   Re: Forward string
Reply With Quote #5

Yer site ain't loading thar Monkey boy.
__________________
Brad is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-14-2007 , 22:54   Re: Forward string
Reply With Quote #6

Code:
native set_string(param, dest[], maxlen);
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 11-15-2007 , 07:53   Re: Forward string
Reply With Quote #7

Thank you guys, I'll try asap.
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 11-15-2007 , 10:51   Re: Forward string
Reply With Quote #8

Quote:
Originally Posted by Brad View Post
Yer site ain't loading thar Monkey boy.
Yes I know ATAC 3.0.0 is over here anyhow. We're in a dispute with our server provider at the moment, site will hopefully be back up and running sometime in the future else we'll have to find a new host.
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
Reply


Thread Tools
Display Modes

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 18:42.


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