SA-MP Forums Archive
Zcmd /setskin [ID] [Skin ID] - 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: Zcmd /setskin [ID] [Skin ID] (/showthread.php?tid=264318)



Zcmd /setskin [ID] [Skin ID] - GangsTa_ - 25.06.2011

Hello. I tried to make a /setskin command using ZCMD, and I got no errors, but in-game I have A LOT of errors, can someone help me?
The problem is that I'm beginner with ZCMD, and I want to learn because it's fast and better.
So here's my code:

http://pastebin.com/kVvhMWsH

Didn't paste too good, but in my script I had no errors on it...
The problem is that when I type /setskin 0 102 for example, it shows me invalid skin ID.
When I type any number as skin ID it says Invalid skin ID...
Please help.

pawn Код:
command(setskin, playerid, params[])
{
    new tmp[256];
    new level, id;
    if(sscanf(params, "ud", id, level))
    {
        if(Player[playerid][AdminLevel] >= 2)
        {
            SendClientMessage(playerid, WHITE, "{FF0000}USAGE:{FFFFFF}  /setskin [playerid] [skin id]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 2)
        {
            level = strval(tmp);
            if(level > 299 || level < 1) { SendClientMessage(playerid, GREY, "Invalid skin ID!"); return 1; }
            Player[id][LastSkin] = level;
            SetPlayerSkin(id, Player[id][LastSkin]);
        }
    }
    return 1;
}



Re: Zcmd /setskin [ID] [Skin ID] - Willow - 25.06.2011

Try this (untested):

Код:
CMD:setskin(playerid, params[]) //this is the new syntax for zcmd
{
    new level, id;
    if(sscanf(params, "dd", id, level)) //changed from 'ud' to 'dd'
    {
        if(Player[playerid][AdminLevel] >= 2)
        {
            SendClientMessage(playerid, WHITE, "{FF0000}USAGE:{FFFFFF}  /setskin [playerid] [skin id]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 2)
        { // no need for tmp here, you already got 'level' (skinid?) by sscanf
            if(level > 299 || level < 1) return SendClientMessage(playerid, GREY, "Invalid skin ID!");
            Player[id][LastSkin] = level;
            SetPlayerSkin(id, Player[id][LastSkin]);
        }
    }
    return 1;
}



Re: Zcmd /setskin [ID] [Skin ID] - GangsTa_ - 25.06.2011

Gonna try it.


Re: Zcmd /setskin [ID] [Skin ID] - Markx - 25.06.2011

Quote:
Originally Posted by Willow
Посмотреть сообщение
Try this (untested):

Код:
CMD:setskin(playerid, params[]) //this is the new syntax for zcmd
{
    new level, id;
    if(sscanf(params, "dd", id, level)) //changed from 'ud' to 'dd'
    {
        if(Player[playerid][AdminLevel] >= 2)
        {
            SendClientMessage(playerid, WHITE, "{FF0000}USAGE:{FFFFFF}  /setskin [playerid] [skin id]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 2)
        { // no need for tmp here, you already got 'level' (skinid?) by sscanf
            if(level > 299 || level < 1) return SendClientMessage(playerid, GREY, "Invalid skin ID!");
            Player[id][LastSkin] = level;
            SetPlayerSkin(id, Player[id][LastSkin]);
        }
    }
    return 1;
}
Why you use two Integers? Replace "dd" with "ud". Then it should work i guess


Re: Zcmd /setskin [ID] [Skin ID] - Tommy_Mandaz - 25.06.2011

Great tutorial for sscanf and zcmd:
http://forum.sa-mp.com/showthread.ph...76#post1142276


Re: Zcmd /setskin [ID] [Skin ID] - GangsTa_ - 25.06.2011

Works perfectly, SOLVED.