Help with a setskin CMD
#1

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

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!
Reply
#3

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];
Reply
#4

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

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
Reply
#6

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

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

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
Reply
#9

Then it should return a message now.

can you show your new updated command ?
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)