How do I remove underscore from this msg? -
aKnoxx - 24.12.2018
PHP код:
CMD:setskin(playerid, params[])
{
new targetid, skinid, str[90], targetidName[MAX_PLAYER_NAME], str1[90], playeridName[MAX_PLAYER_NAME];
if(sscanf(params, "ii", targetid, skinid))
return SendClientMessage(playerid, -1, "[USAGE]: /setskin [playerid] [skinid]");
SetPlayerSkin(targetid, skinid);
GetPlayerName(targetid, targetidName, sizeof(targetidName));
format(str, sizeof(str), "You have set %s's skin id to %i.", targetidName, skinid);
SendClientMessage(playerid, -1, str);
GetPlayerName(playerid, playeridName, sizeof(playeridName));
format(str1, sizeof(str1), "Your skin has been changed to %i by admin %s.", skinid, playeridName);
SendClientMessage(targetid, -1, str1);
return 1;
}
Re: How do I remove underscore from this msg? -
beckzy - 24.12.2018
Код:
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;
}
Re: How do I remove underscore from this msg? -
aKnoxx - 24.12.2018
tyvm +rep
Re: How do I remove underscore from this msg? -
beckzy - 24.12.2018
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;
}