SA-MP Forums Archive
MySkin command. - 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: MySkin command. (/showthread.php?tid=248473)



MySkin command. - IvancheBG - 14.04.2011

Hi.How to make a command that when i type (Example) /myskin 3 and my skin is number 3.


Re: MySkin command. - omer5198 - 14.04.2011

pawn Код:
if(strcmp(cmd, "/myskin", true) == 0)
{
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR, "Usage: /myskin [skinid]");
        return 1;
    }
    new skin;
    skin = strval(tmp);
    new string[128];
    format(string, sizeof(string), "You change your skin to this skin ID: %d", skin);
    SendClientMessage(playerid, COLOR, string);
    SetPlayerSkin(playerid, skin);
    return 1;
}



Re: MySkin command. - IvancheBG - 14.04.2011

Nevermind i get it but it sends these errors

C:\Documents and Settings\user\Desktop\server samp\gamemodes\test.pwn(386) : error 017: undefined symbol "cmd"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\test.pwn(389) : error 017: undefined symbol "strtok"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\test.pwn(389) : error 033: array must be indexed (variable "tmp")


Re: MySkin command. - boyan96 - 14.04.2011

PHP код:
new cmd



Re: MySkin command. - IvancheBG - 14.04.2011

it isnt working


Re: MySkin command. - Voldemort - 14.04.2011

Thats because everyone just paste some things from GF edits...


use
pawn Код:
if(strcmp(cmdtext, "/myskin", true) == 0)
and please dont just paste cmd, think logical what you do, as you see pawno already told you what is wrong, strtok function is to get value after space ( " " ), just replace strtok function with function what you use to seperate cmd values like /cmd [value1] [value2] . ..


Re: MySkin command. - HyperZ - 14.04.2011

I suggest you to use Sscanf2And Zcmd.
pawn Код:
command(myskin, playerid, params[])
{
    new string[64], SkinID;
    if(sscanf(params, "d", SkinID))
        return SendClientMessage(playerid, -1, "USAGE: /myskin [SkinID]");
    if(SkinID < 0 || SkinID > 299)
    {
        SendClientMessage(playerid, -1, "Error: Choose a skin ID between 0 and 299.");
    }
    else
    {
        SetPlayerSkin(playerid, SkinID);
        format(string, sizeof(string), "You've changed your skin to Skin-ID %d", SkinID);
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}



Re: MySkin command. - Anastasia - 14.04.2011

Lol Clive look the cmd myskin and look the usage /skin!




Re: MySkin command. - HyperZ - 14.04.2011

Quote:
Originally Posted by Anastasia
Посмотреть сообщение
Lol Clive look the cmd myskin and look the usage /skin!

+1 lol, Post Edited.