SA-MP Forums Archive
Help with a setskin CMD - 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)
+--- Thread: Help with a setskin CMD (/showthread.php?tid=531071)



Help with a setskin CMD - zConroy - 10.08.2014

So this CMD is not giving me any errors, yet for some reason when I do it IG nothing at all comes up. Not quite sure why, although I'm sure it's something really obvious and I'm just oblivious.

pawn Код:
CMD:setskin(playerid, params[])
{
    new pID, value;
    if(PlayerInfo[playerid][pAdmin] >= 2) return 0;
    else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [id] [Skin ID]");
    else if(value < 1 || value > 299 ) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Only skins 1-299");
    else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player Is Not Connected");
    else
    {
        new string[128], string1[128], target[MAX_PLAYERS], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "You've set %s skin to %i", target, value);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Your skin has been set to %i by %s:", value, pName);
        SendClientMessage(pID, COLOR_LIGHTBLUE, string1);
        PlayerInfo[pID][pSkin] = value;
        SetPlayerSkin(playerid, value);
    }
    return 1;
}



Re: Help with a setskin CMD - Stanford - 10.08.2014

pawn Код:
CMD:setskin(playerid, params[])
{
    new pID, value;
    if(PlayerInfo[playerid][pAdmin] <= 2) return 1; // if the admin is level 2 or LOWER it will return nothing
    if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [id] [Skin ID]");
    if(value < 1 || value > 299 ) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Only skins 1-299");
    if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player Is Not Connected");
    new string[128], string1[128], target[MAX_PLAYERS], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "You've set %s skin to %i", target, value);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Your skin has been set to %i by %s:", value, pName);
    SendClientMessage(pID, COLOR_LIGHTBLUE, string1);
    PlayerInfo[pID][pSkin] = value;
    SetPlayerSkin(playerid, value);
    return 1;
}
I hope I helped any feedback would be appreciated!


Re: Help with a setskin CMD - Kaperstone - 10.08.2014

pawn Код:
else if(value < 1 || value > 299 ) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Only skins 1-299");
you check if the 'value' is smaller than 1 or bigger than 299
plus add = near them if you want to check if the decimal is bigger/smaller or equal. (because as I see you want to make skins 1 and 299 available too (Only skins 1-299))

pawn Код:
pName[MAX_PLAYER_NAME];
Always should be +1 for end of string
pawn Код:
pName[MAX_PLAYER_NAME+1];



Re: Help with a setskin CMD - Don_Cage - 10.08.2014

Quote:
Originally Posted by xkirill
ПоÑмотреть Ñообщение
pawn Код:
pName[MAX_PLAYER_NAME];
Always should be +1 for end of string
pawn Код:
pName[MAX_PLAYER_NAME+1];
That's not necessery.


Re: Help with a setskin CMD - Kaperstone - 10.08.2014

Quote:
Originally Posted by Don_Cage
ПоÑмотреть Ñообщение
That's not necessery.
I prefer having it than sending a challenge to the server and risking a 24 char length corrupted name or something


Re: Help with a setskin CMD - zConroy - 10.08.2014

Thanks for the help but none of the suggestions have helped at all. There is no message whenever I enter the command, all others commands work just fine.


Re: Help with a setskin CMD - Kaperstone - 10.08.2014

Quote:
Originally Posted by zConroy
ПоÑмотреть Ñообщение
Thanks for the help but none of the suggestions have helped at all. There is no message whenever I enter the command, all others commands work just fine.
Then I think your level is not higher than or equal to two
Quote:

if(PlayerInfo[playerid][pAdmin] >= 2) return 0;

try to replace the 0 with a message and see if you get it


Re: Help with a setskin CMD - zConroy - 10.08.2014

Quote:
Originally Posted by Stanford
ПоÑмотреть Ñообщение
pawn Код:
CMD:setskin(playerid, params[])
{
    new pID, value;
    if(PlayerInfo[playerid][pAdmin] <= 2) return 1; // if the admin is level 2 or LOWER it will return nothing
    if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [id] [Skin ID]");
    if(value < 1 || value > 299 ) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Only skins 1-299");
    if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player Is Not Connected");
    new string[128], string1[128], target[MAX_PLAYERS], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "You've set %s skin to %i", target, value);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "Your skin has been set to %i by %s:", value, pName);
    SendClientMessage(pID, COLOR_LIGHTBLUE, string1);
    PlayerInfo[pID][pSkin] = value;
    SetPlayerSkin(playerid, value);
    return 1;
}
I hope I helped any feedback would be appreciated!
Quote:
Originally Posted by xkirill
ПоÑмотреть Ñообщение
Then I think your level is not higher than or equal to two

try to replace the 0 with a message and see if you get it
Yeah, it still doesn't work, and my level is set at 6


Re: Help with a setskin CMD - Kaperstone - 10.08.2014

Then it should return a message now.

can you show your new updated command ?


Re: Help with a setskin CMD - zConroy - 10.08.2014

pawn Код:
CMD:setskin(playerid, params[])
{
    new pID, value;
    if(PlayerInfo[playerid][pAdmin] >= 2) return 0;
    else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [id] [Skin ID]");
    else if(value <= 1 || value >= 299 ) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Only skins 1-299");
    else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player Is Not Connected");
    else
    {
        new string[128], string1[128], target[MAX_PLAYERS], pName[MAX_PLAYER_NAME+1];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "You've set %s skin to %i", target, value);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Your skin has been set to %i by %s:", value, pName);
        SendClientMessage(pID, COLOR_LIGHTBLUE, string1);
        PlayerInfo[pID][pSkin] = value;
        SetPlayerSkin(playerid, value);
    }
    return 1;