This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[SOLVED]How to get the args


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
powwoww
BANNED
Join Date: Oct 2008
Old 10-05-2008 , 08:57   [SOLVED]How to get the args
Reply With Quote #1

cppcode:
static cell Print2Args(AMX* amx, cell *params){
char*arg1 = MF_GetAmxString(amx,params[1],0,0),
*arg2 = MF_GetAmxString(amx,params[2],0,0);
MF_Log("arg1:%s,arg2:%s",arg1,arg2);
return 1;
}
inc:
native Print2Args(fst[],sec[])
sma:
Print2Args("this is 1st","this is 2nd")

result(console):
arg1:this is 2nd,arg2:this is 2nd

Whats the problem,the 2 args are the same?!
I'm new here and confused

Please help me

Last edited by powwoww; 10-05-2008 at 14:21. Reason: SOLVED
powwoww is offline
More
Member
Join Date: Nov 2004
Location: Internet
Old 10-05-2008 , 09:05   Re: How to get the args(Amx* amx...)
Reply With Quote #2

u need to specify another bufferid for the second string or it overwrites the first

use: *arg2 = MF_GetAmxString(amx,params[2],1,0);
More is offline
powwoww
BANNED
Join Date: Oct 2008
Old 10-05-2008 , 09:20   Re: How to get the args(Amx* amx...)
Reply With Quote #3

oh I appreciate u for fix it so rapidly(wish my English better...)

Last edited by powwoww; 10-05-2008 at 09:24.
powwoww is offline
BAILOPAN
Join Date: Jan 2004
Old 10-05-2008 , 14:54   Re: [SOLVED]How to get the args
Reply With Quote #4

Note: there are only four buffers available. (Someone should file a bug on that, modules should get the re-entrant version of MF_GetAmxString.)
__________________
egg
BAILOPAN 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 13:21.


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