Define Params manually - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Define Params manually (
/showthread.php?tid=237362)
Define Params manually -
Biesmen - 09.03.2011
I'm trying to define Params manually. I'm updating a script from strtok to sscanf. But I do not wish to change over 100 commands to DCMD. So I'd like to define Params manually. How could I do it?
I thought of something like "new params = cmdtext[];", I hope you get what I mean. But I don't think that will work.
I hope you can help me.
Re: Define Params manually -
Mean - 09.03.2011
This got owned by Calg00ne's post.
Re: Define Params manually -
Calgon - 09.03.2011
DCMD aren't like publics - once again, you have no idea about what you're talking about "Mean."
Furthermore, for ZCMD, ZCMD has a callback that is called prior to the command being executed, you could parse the data in THAT callback.
For DCMD, you can still use the cmdtext within the OnPlayerCommandText callback, or you can alternatively create another string and use strcat to copy the string data - you're better off finding & replacing the strings though (i.e: Replace "params" to "cmdtext" - if that's what you want).
Re: Define Params manually -
Biesmen - 09.03.2011
Thanks, Calgon.
Re: Define Params manually -
Mean - 09.03.2011
Quote:
Originally Posted by Calg00ne
DCMD aren't like publics - once again, you have no idea about what you're talking about "Mean."
Furthermore, for ZCMD, ZCMD has a callback that is called prior to the command being executed, you could parse the data in THAT callback.
For DCMD, you can still use the cmdtext within the OnPlayerCommandText callback, or you can alternatively create another string and use strcat to copy the string data - you're better off finding & replacing the strings though (i.e: Replace "params" to "cmdtext" - if that's what you want).
|
What I found in ZCMD include:
pawn Код:
#define COMMAND:%1(%2) \
forward cmd_%1(%2); \
public cmd_%1(%2)
Re: Define Params manually -
Calgon - 09.03.2011
Quote:
Originally Posted by Mean
What I found in ZCMD include:
pawn Код:
#define COMMAND:%1(%2) \ forward cmd_%1(%2); \ public cmd_%1(%2)
|
Yes, and ZCMD is
NOT DCMD - they do not function in the same way.
Re: Define Params manually -
admantis - 09.03.2011
100 commands won't take you longer than 8 hours. I had 70 and It only took me 5. Just work and do it, it's worth in the end.
Re: Define Params manually -
Mean - 09.03.2011
Quote:
Originally Posted by Calg00ne
Yes, and ZCMD is NOT DCMD - they do not function in the same way.
|
Oh yeah.
I failed, I meant ZCMD is like forward & public, not DCMD.