SA-MP Forums Archive
Other way of making cmds - 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: Other way of making cmds (/showthread.php?tid=258652)



Other way of making cmds - Tachibana - 31.05.2011

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 /


Re: Other way of making cmds - Elka_Blazer - 31.05.2011

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


Re: Other way of making cmds - Skylar Paul - 31.05.2011

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.


Re: Other way of making cmds - Tachibana - 31.05.2011

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