question
#1

why most people code like this

PHP код:
CMD:x(playeridparams[])
{
    new 
targetstr[x];
        
//some code
    
return 1;

when they can code like this

PHP код:
CMD:x(playeridstr[], target)
{
    
//some code
    
return 1;

Reply
#2

because you don't always target a player and param are really just parameters.
it is a lot better that way because using this and sscanf you can have many parameters of different types in unordered way.
/command [string] [int] [char] [float]
/command [float] [string] [int]

etc.

sscanf just slices your string to parts that you can parse.
Reply
#3

I know the second one won't work properly as ZCMD only parses the command name and the rest goes into "params".

So you simply just changed "params" to "str" which is not wrong but "target" will simply hold 0 always.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)