Other way of making cmds
#1

Hey guys Im wondering if there are any tutorials on how to script commands with fast commands, what I mean is like

pawn Код:
CMD:setskin(playerid, params[])
{
    if(PVar[playerid][pLevel] >= 2)
    {
        new pID, SkinID;
        if(sscanf(params, "ui", pID, SkinID)) return SendClientMessage(playerid, COLOR_RED, "* Usage: /SetSkin < Player ID > < Skin ID >");

        if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "That user is not connected!");

        format(Msg, sizeof(Msg), "Admin: %s(%d) has set your skin id to: %d", pName(playerid), playerid);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, Msg);

        format(Msg, sizeof(Msg), "You have set: %s(%d)'s skin id to: %d", pName(pID), pID, SkinID);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, Msg);

        return SetPlayerSkin(pID, SkinID);
    }
    else return AdminCMD(playerid, 2);
}
I can see that it is easier than doing commands with /
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=244841
Credits to MarkX
Reply
#3

You want a sscanf and ZCMD tutorial? It's quite easy. I'll teach you how I learned;

Read this thread to learn about sscanf.

Read this thread to learn about zcmd.

pawn Код:
COMMAND:commandname(playerid, params[])
{
    new
        NumberSentToTheUser,
        User,
        string[128];
       
    if(sscanf(params, "ui", User, NumberSentToTheUser))
    {
        new
            YourName[MAX_PLAYER_NAME];

        GetPlayerName(playerid, YourName, sizeof(YourName));
        format(string, sizeof(string), "{FFFFFF}%s has sent you the following number: %d.", YourName);
        SendClientMessage(User, -1, string);
    }
    else return 1; //Not the correct syntax (Usage message?)
    return 1;
}
Study that command.
Reply
#4

I was about to write nvm I got it but thanks guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)