Raised This Month: $ Target: $400
 0% 

How to forward string?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 03-24-2011 , 20:39   How to forward string?
Reply With Quote #1

How do I forward a string that can be changed?

Currently my forward looks like this:
PHP Code:
g_hGFwd CreateGlobalForward("MyForward"ET_EventParam_CellParam_CellParam_StringParam_CellParam_CellByRef);

new 
Action:result Plugin_Continue;
Call_StartForward(g_hGFwd);
Call_PushCell(char);
Call_PushCell(client);
Call_PushString(buffer);
Call_PushCell(sizeof(buffer));
Call_PushCellRef(refStyle);
Call_Finish(result); 
Now if I try to change that string in one of the forwards with strcopy I get a memory leak error 18.

PHP Code:
public Action:OnMyForward(charclientString:text[], len, &style)
{
    
strcopy(textlen"test");
    return 
Plugin_Changed;

Or am I completely off track here?
Mr. Zero is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-24-2011 , 20:50   Re: How to forward string?
Reply With Quote #2

Use Call_PushStringEx with at least the SM_PARAM_COPYBACK flag.
psychonic is offline
Reply



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 09:39.


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