Setskin Command
#8

I cannot tell you exactly what the error is, but some tips for your code:
1. Don't call sscanf when you're not sure if the result is going to be used. Run the pAdminLevel and AdminDuty checks before using sscanf.
2. No need to create another string if you're going to send 2 messages in a row. Just use the 1st string when formatting the second message.
pawn Код:
CMD:setskin(playerid, params[])
{
    if(!PlayerInfo[playerid][pAdminLevel])
        return SendClientMessage(playerid, COLOR_GREY, "You must be a administrator or moderator to use this command"), true;
    if(AdminDuty[playerid] < 1)
        return SendClientMessage(playerid, COLOR_GREY, "You must be on duty to perform this command"), true;
   
    new Player, Skinid;
    if(sscanf(params, "ui", Player, Skinid))
        return SendClientMessage(playerid, COLOR_GREY, "[Command Usage]: /setskin [PlayerID or Name] [SkinID]"), true;
    if(Player == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, COLOR_GREY, "Invalid player name or id entered!"), true;

    new string[128];
    format(string, sizeof(string), "Your skin has been set to %i by %s", Skinid, GetPlayerNameEx(playerid));
    SendClientMessage(Player, COLOR_YELLOW, string);
    format(string, sizeof(string), "You have set %s's skin to %i", GetPlayerNameEx(Player), Skinid);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    SetPlayerSkin(Player, Skinid);
    PlayerInfo[Player][pSkin] = Skinid;
    return true;
}
Reply


Messages In This Thread
Setskin Command - by Dr - 01.08.2011, 03:16
Re: Setskin Command - by Kingunit - 01.08.2011, 03:27
Re: Setskin Command - by Dr - 01.08.2011, 03:50
Re: Setskin Command - by Famalamalam - 01.08.2011, 03:58
Re: Setskin Command - by Ironboy - 01.08.2011, 06:05
Re: Setskin Command - by iggy1 - 01.08.2011, 06:21
Re: Setskin Command - by Dr - 01.08.2011, 15:34
Re: Setskin Command - by AndreT - 01.08.2011, 15:44
Re: Setskin Command - by Dr - 01.08.2011, 16:01
Re: Setskin Command - by AndreT - 01.08.2011, 16:07
Re: Setskin Command - by Dr - 01.08.2011, 17:00
Re: Setskin Command - by Dr - 01.08.2011, 22:56
Re: Setskin Command - by =WoR=Varth - 02.08.2011, 00:09
Re: Setskin Command - by Dr - 02.08.2011, 02:10
Re: Setskin Command - by =WoR=Varth - 02.08.2011, 02:28

Forum Jump:


Users browsing this thread: 3 Guest(s)