[Tutorial] How to script /skin command
#3

This is definitely the bad way to make this command. It's a lot easier doing it with sscanf.

pawn Code:
command(skin, playerid, params[])
{
        new string[128], skinid;
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "d", skinid)
        {
            SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /skin [skinID]");
        }
        else
        {
            SetPlayerSkin(playerid, skinid);
            format(string, sizeof(string), "You have set your skin ID to %d", skinid);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    return 1;
}
This checks if a player is an admin (RCON), if the sscanf params are correct, if not it sends a message with the correct usage (SYNTAX) if the params are correct, it continues the command. It will set your skin to the ID you chose and then send you a message telling you what skin you chose. I used ZCMD and SSCANF2 to do this. Took me 10 seconds.
Reply


Messages In This Thread
How to script /skin command - by Injector - 24.09.2010, 13:18
Re: How to script /skin command - by Kyosaur - 24.09.2010, 13:25
Re: How to script /skin command - by Scenario - 24.09.2010, 13:29
Re: How to script /skin command - by Injector - 24.09.2010, 13:30
Re: How to script /skin command - by Injector - 24.09.2010, 13:34
Re: How to script /skin command - by Cameltoe - 24.09.2010, 13:37
Re: How to script /skin command - by Injector - 24.09.2010, 13:41
Re: How to script /skin command - by Scenario - 24.09.2010, 13:46
Re: How to script /skin command - by LarzI - 29.09.2010, 18:27
Re: How to script /skin command - by Calgon - 02.10.2010, 08:48

Forum Jump:


Users browsing this thread: 1 Guest(s)