How do I remove underscore from this msg?
#1



PHP код:
CMD:setskin(playeridparams[])
{
    new 
targetidskinidstr[90], targetidName[MAX_PLAYER_NAME], str1[90], playeridName[MAX_PLAYER_NAME];
    if(
sscanf(params"ii"targetidskinid)) 
    return 
SendClientMessage(playerid, -1"[USAGE]: /setskin [playerid] [skinid]");
    
SetPlayerSkin(targetidskinid);
    
GetPlayerName(targetidtargetidNamesizeof(targetidName));
    
format(strsizeof(str), "You have set %s's skin id to %i."targetidNameskinid);
    
SendClientMessage(playerid, -1str);
    
GetPlayerName(playeridplayeridNamesizeof(playeridName));
    
format(str1sizeof(str1), "Your skin has been changed to %i by admin %s."skinidplayeridName);
    
SendClientMessage(targetid, -1str1);
    return 
1;

Reply
#2

Код:
CMD:setskin(playerid, params[])
{
    new targetid, skinid;
    if (sscanf(params, "ii", targetid, skinid)) {
        SendClientMessage(playerid, -1, "[USAGE]: /setskin [playerid] [skinid]");
        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
#3

tyvm +rep
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)