SA-MP Forums Archive
Help with set skin 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: Help with set skin command (/showthread.php?tid=69385)



Help with set skin command - OcTeT - 17.03.2009

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"


Re: Help with set skin command - StrickenKid - 17.03.2009

use
pawn Код:
THIS
please.


Re: Help with set skin command - MenaceX^ - 17.03.2009

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);



Re: Help with set skin command - Weirdosport - 17.03.2009

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"


Re: Help with set skin command - MenaceX^ - 17.03.2009

Yeah, my bad. Wrongly counted it.


Re: Help with set skin command - Weirdosport - 17.03.2009

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.


Re: Help with set skin command - OcTeT - 18.03.2009

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;
}



Re: Help with set skin command - Norn - 18.03.2009

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.


Re: Help with set skin command - OcTeT - 18.03.2009

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?


Re: Help with set skin command - OcTeT - 18.03.2009

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;
    }