Help with set skin command
#1

Hey. I am trying to use this to make it work but I get some errors...
I have this at #defines:

pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Under OnPlayerCommandText i have this...
pawn Код:
dcmd_setskin(playerid,params[])
{
    new player, skin;
    if(sscanf(params,"dd",player,skin)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]");
    if(!IsPlayerConnected(player)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
    if(IsInvalidSkin(skin)) return SendClientMessage(playerid, COLOR_GREY, "* Invalid Skin ID");
    SetPlayerSkin(player, skin);
    SendClientMessage(player, COLOR_WHITE, "An Admin has changed your skin.");
    return 1;
}
And I still get those errors...

D:\script.PWN(8577) : error 017: undefined symbol "dcmd_setskin"
D:\script.PWN(8580) : error 017: undefined symbol "sscanf"
D:\script.PWN(8582) : error 017: undefined symbol "IsInvalidSkin"
Reply
#2

use
pawn Код:
THIS
please.
Reply
#3

Even I'm a dcmd noob I guess this is your problem.


You don't have a varieble which named 'IsInvalidSkin'
And it doesn't find the dcmd_setskin becuase you didn't put
pawn Код:
dcmd(setskin,6,cmdtext);
Reply
#4

Quote:
Originally Posted by MenaceX^
Even I'm a dcmd noob I guess this is your problem.


You don't have a varieble which named 'IsInvalidSkin'
And it doesn't find the dcmd_setskin becuase you didn't put
pawn Код:
dcmd(setskin,6,cmdtext);
It's "7" not "6"
Reply
#5

Yeah, my bad. Wrongly counted it.
Reply
#6

As for the undefined sscanf, you need to go to THIS PAGE and copy the stock to the bottom of your script.

And the IsValidSkin needs finding on this forum, I might try in a second and edit this post.
Reply
#7

D:\script.PWN(8577) : error 017: undefined symbol "dcmd_setskin"
D:\script.PWN(8580) : error 017: undefined symbol "dcmd_setskin"
D:\script.PWN(8581) : error 017: undefined symbol "params"
D:\script.PWN(8583) : error 017: undefined symbol "IsInvalidSkin"
These are the errors I got
I added the stock at the end also...and this is my script.
pawn Код:
dcmd(setskin,7,cmdtext);
    dcmd_setskin(playerid,params[])
{
    new player, skin;
    dcmd(setskin,7,cmdtext);
    if(sscanf(params,"dd",player,skin)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]");
    if(!IsPlayerConnected(player)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
    if(IsInvalidSkin(skin)) return SendClientMessage(playerid, COLOR_GREY, "* Invalid Skin ID");
    SetPlayerSkin(player, skin);
    SendClientMessage(player, COLOR_WHITE, "An Admin has changed your skin.");
    return 1;
}
Reply
#8

Quote:
Originally Posted by MenaceX^
Even I'm a dcmd noob I guess this is your problem.


You don't have a varieble which named 'IsInvalidSkin'
And it doesn't find the dcmd_setskin becuase you didn't put
pawn Код:
dcmd(setskin,6,cmdtext);
Why would it matter? dcmd's are just functions. It doesn't matter if you don't put it under OnPlayerCommandText. It'll just mean you cant type it, it wont cause compile errors.

IsInvalidSkin is a function not a variable.
Reply
#9

On my screen it says it's a symbol so uh...what shell I do to make it work? Do I have to define them? If yes, how?
Reply
#10

Hm...I kinda changed my mind with this dcmp and used strcmp...
Here it is what I've done.
By the way. IT WORKS !!!
pawn Код:
if(strcmp(cmd, "/setskin", true) == 0)
    {
    if (PlayerInfo[playerid][pAdmin] < 2)
      {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to change skins");
        return 1;
      }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
        {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /setskin [player/PartOfName] [skin]");
        return 1;
        }
    giveplayerid = ReturnUser(tmp);
    if(giveplayerid == INVALID_PLAYER_ID)
      {
      SendClientMessage(playerid, COLOR_GREY, "Invalid user or user is not online");
        return 1;
      }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
        {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /setskin [player/PartOfName] [skin]");
        return 1;
        }
    new skinid = strval(tmp);
    if (skinid<0 || skinid > 299)
      {
      SendClientMessage(playerid, COLOR_GREY, "Invalid skin ID, must be between 0 and 299");
        return 1;
      }
    PlayerInfo[giveplayerid][pModel] = skinid;
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    format(string, sizeof(string), "%s's Skin was set to %d", giveplayer, skinid);
    SendClientMessage(playerid, COLOR_WHITE, string);
    OnPlayerUpdate(giveplayerid);
    SetPlayerSkin(giveplayerid, skinid);
    return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)