How do I remove underscore from this msg?
#4

You might also want to check if the target ID and skin ID are valid:

Код:
if (!IsPlayerConnected(targetid)) {
    SendClientMessage(playerid, -1, "Inactive player ID.");
    return 1;
}
Код:
if (skinid < 0 || skinid == 74 || skinid > 311) {
    SendClientMessage(playerid, -1, "Invalid skin ID. Select from 0 - 73, 75 - 311.");
    return 1;
}
Код:
CMD:setskin(playerid, params[])
{
    new targetid, skinid;
    if (sscanf(params, "ii", targetid, skinid)) {
        SendClientMessage(playerid, -1, "[USAGE]: /setskin [playerid] [skinid]");
        return 1;
    }
    if (!IsPlayerConnected(targetid)) {
        SendClientMessage(playerid, -1, "Inactive player ID.");
        return 1;
    }
    if (skinid < 0 || skinid == 74 || skinid > 311) {
        SendClientMessage(playerid, -1, "Invalid skin ID. Select from 0 - 73, 75 - 311.");
        return 1;
    }
    SetPlayerSkin(targetid, skinid);
    new str[128], i;
    GetPlayerName(targetid, str, MAX_PLAYER_NAME);
    for (i = 0; i < strlen(str); i++) if (str[i] == '_') str[i] = ' ';
    format(str, sizeof(str), "You have set %s's skin id to %i.", str, skinid);
    SendClientMessage(playerid, -1, str);
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
    for (i = 0; i < strlen(str); i++) if (str[i] == '_') str[i] = ' ';
    format(str, sizeof(str), "Your skin has been changed to %i by admin %s.", skinid, str);
    SendClientMessage(targetid, -1, str);
    return 1;
}
Reply


Messages In This Thread
How do I remove underscore from this msg? - by aKnoxx - 24.12.2018, 05:49
Re: How do I remove underscore from this msg? - by BeckzyBoi - 24.12.2018, 05:56
Re: How do I remove underscore from this msg? - by aKnoxx - 24.12.2018, 06:13
Re: How do I remove underscore from this msg? - by BeckzyBoi - 24.12.2018, 06:20

Forum Jump:


Users browsing this thread: 1 Guest(s)