dcmd vs scanff vs strcmp ?
#1

Hello guys, i am just one of the many beginners learning pawn, and getting better at it.

Now i created a few filterscripts/gamemodes etc but i am wondering.. What is the point of using scanff and/or dcmd except the faster speed i've readed.

I know there are tutorials for how to use it, but which one is the best and why ?

I think (hope atleast ) i am not the only beginner whos wondering about this.
Reply
#2

I've wonder about this as well. I made a thread but I didn't get any responce. Would be nice if someone could comment about it
Reply
#3

Quote:
Originally Posted by Samdudes
Посмотреть сообщение
I've wonder about this as well. I made a thread but I didn't get any responce. Would be nice if someone could comment about it
Lets hope
Reply
#4

I use both zcmd and sscanf. Extremely easy to use and the speed is good.

They are used to cut down code mass as well as the speed of which they are processed.
Reply
#5

Quote:
Originally Posted by vital2k
Посмотреть сообщение
I use both zcmd and sscanf. Extremely easy to use and the speed is good.

They are used to cut down code mass as well as the speed of which they are processed.
You mean like a PM command which requires /pm PLAYERID MESSAGE it can shorten the code instead of using a lot of extra functions like strtok etc in a strcmp command ?
Reply
#6

dcmd is based on strcmp, just dcmd commands loads at the same time as GM. So... DCMD is not the best variant. Better ir ZCMD now, which uses CallLocalFunction. This function helps to hook function don't using strcmp in the onplayercommandtext. So ZCMD is the best variant for this time.

What's about sscanf. Sscanf is fast and very useful function. U can do the same with strtok but it's not comfortable... Much time u spend for arguments writting. So sscanf is the best way to explode strings.
Sscanf is very useful, because it has many features like integer, string, user, hex exploding.
Reply
#7

Quote:
Originally Posted by Masj
Посмотреть сообщение
dcmd is based on strcmp, just dcmd commands loads at the same time as GM. So... DCMD is not the best variant. Better ir ZCMD now, which uses CallLocalFunction. This function helps to hook function don't using strcmp in the onplayercommandtext. So ZCMD is the best variant for this time.

What's about sscanf. Sscanf is fast and very useful function. U can do the same with strtok but it's not comfortable... Much time u spend for arguments writting. So sscanf is the best way to explode strings.
Sscanf is very useful, because it has many features like integer, string, user, hex exploding.
So basicly, sscanf is no command processor but for splitting arguments (like pm/kick/ban commands etc) and dcmd and zcmd are command compressors ?

Anyways i know now how dcmd (and zcmd too then i think) works, but cant find a good explaination about sscanf, do you know a simple tutorial :$ ? thanks for explaining anyways
Reply
#8

pawn Код:
CMD:kill(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new ID;
    if(sscanf(params, "u", ID)) return /*error message*/
    /*Add filters, ifisplayerconnected, etc..*/
    SetPlayerHealth(ID, 0.0);
    return 1;
}
See how short they can be :P
Reply
#9

well thats a peace of script that kills you, i see
sscanf readed the given ID i guess, but why "u" and how to get multiple things like a personal message ?

Edit:
Thanks ******, im going to test these things soon and lets hope il get it to work

I thinks its easyer to understand once you used it a few times, and i think i know basicly how it works now
Reply
#10

Okay i get it now
pawn Код:
dcmd_pm(playerid,params[]) {
    new id,message;
    sscanf(params,"is",id,message);
    new pName[32];
    new string[128];
    GetPlayerName(playerid,pName,32);
    format(string,sizeof string,"PM From %s(%i): %s",pName,playerid,message);
        SendClientMessage(id,COLOR_ORANGE,string);
    }
    return 1;
}
as example

Really usefull to know , its like 3 times as small as my regular pm with strcmp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)