MySkin command.
#1

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

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;
}
Reply
#3

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")
Reply
#4

PHP код:
new cmd
Reply
#5

it isnt working
Reply
#6

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] . ..
Reply
#7

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;
}
Reply
#8

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

Reply
#9

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

+1 lol, Post Edited.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)