dcmd length parameter
#1

Under OnPlayerCommandText you're meant to put

dcmd(cmd, len, params)

but isn't it easier to use sizeof(cmd) instead of having a seperate length parameter? How can I do this?

Please don't recommend that I use zcmd or bcmd or fcmd of jcmd, however many different ones there are - I like dcmd. I'm not really bothered if my commands execute 0.000001 seconds faster with zcmd.

Thanks.
Reply
#2

Its only a number ... insert it ..

pawn Код:
dcmd(test,4,cmdtext);
its easy insert a number
Reply
#3

Following by [ISS]jumbo's example of:

pawn Код:
dcmd(test,4,cmdtext);
"test" is a constant string, which means you can't dynamically get the size of it with sizeof(), especially as "test" has no identifier string at the stage of when you're inserting it in to dcmd(), don't forget - dcmd is a macro, not a proper function and it doesn't store in to a string at all.

tl;dr: No, you can't do that. That's why I'd suggest you use zcmd or another command processor, because it's a lot easier to use, and it's also faster.
Reply
#4

Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
Its only a number ... insert it ..

pawn Код:
dcmd(test,4,cmdtext);
its easy insert a number
Nowhere in my post did I say it was DIFFICULT.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)