22.12.2016, 15:35
make it like anyone can use it(NO ZCMD PLEASE)
CMD:setskin(playerid, params[]) { new targetid, skinid; if (sscanf(params, "ui", targetid, skinid)) { return SendClientMessage(playerid, 0xFF0000FF, "/setskin"); } SetPlayerSkin(targetid, skinid); SendClientMessage(playerid, 0xFFFFFFFF, "You have set someone's skin to something... yay."); return 1; }
CMD:skin(playerid, params[]) return SetPlayerSkin(playerid, strval(params));
new idx;
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/skin", cmdtext, true) == 0)
{
new tmp[256], str[75];
tmp = strtok (cmdtext, idx);
if (!strlen(tmp) return SendClientMessage(playerid, -1, "USAGE: /skin [Skin Id]");
SetPlayerSkin(playerid, strval(tmp));
format(str, sizeof(str), "You have changed your skin to Id : %s", GetPlayerSkin(playerid));
SendClientMessage(playerid, -1, str);
return 1;
}
return 0;
}
CMD:skin(playerid, params[])
{
new str[75];
if (isnull(params) return SendClientMessage(playerid, -1, "USAGE: /skin [Skin Id]");
SetPlayerSkin(playerid, params);
format(str, sizeof(str), "You have changed your skin to Id : %s" ,params);
SendClientMessage(playerid, -1, str);
return 1;
}
CMD:skin(playerid,params[])
{
new skin;
if(sscanf(params,"i",skin)) return SendClientMessage(playerid,0xF8F8F8FFF,"[SERVER]: {FFFFFF}Usage: /skin (skinid)");
if(!IsValidSkin(skin)) return SendClientMessage(playerid,0xF8F8F8FFF,"[SERVER]: {FFFFFF}Invalid skinID");
SetPlayerSkin(playerid,skin);
SendClientMessage(playerid,0xF8F8F8FFF,"[SERVER]: {FFFFFF}You've chosen your Custom Skin.");
return 1;
}
stock IsValidSkin(SkinID)
{
if((SkinID >= 0 && SkinID <= 2)||(SkinID == 7)||(SkinID >= 9 && SkinID <= 41)||(SkinID >= 43 && SkinID <= 64)||(SkinID >= 66 && SkinID <= 73)||(SkinID >= 75 && SkinID <= 85)||(SkinID >= 87 && SkinID <= 118)||(SkinID >= 120 && SkinID <= 148)||(SkinID >= 150 && SkinID <= 207)||(SkinID >= 209 && SkinID <= 264)||(SkinID >= 274 && SkinID <= 288)||(SkinID >= 290 && SkinID <= 299)) return true;
else return false;
}
ZCMD & Sscanf2 Ways :
PHP код:
|
if (skinid >= 0 && skinid <= 311)