Setskin problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Setskin problem (
/showthread.php?tid=354971)
Setskin problem -
Crazyboobs - 28.06.2012
Hey i script this cmd but its not working
please help to fix it
pawn Код:
CMD:setmyskin(playerid,params[]) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /setmyskin [ID]");
new player1 = strval(tmp), skin = strval(tmp2),string[128];
if(!IsValidSkin(skin)) return SendClientMessage(playerid, red, "ERROR: Invaild Skin ID");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
format(string,sizeof(string),"|- You have set your skin to %d -|", skin); SendClientMessage(playerid,yellow,string);
return SetPlayerSkin(player1, skin);}
return 1;}
Re: Setskin problem -
phillip875 - 28.06.2012
pawn Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
CMD:setskin(playerid,params[])
{
new idx,tmp[128],skinid;
tmp = strtok(params,idx);
skinid = strval(tmp);
if(strlen(tmp) == 0) return SendClientMessage(playerid,palepink,"Usage: /setskin [skinid]");
if(skinid > 299) return SendClientMessage(playerid,brightred,"Highest skin number is 299!");
if(skinid < 0) return SendClientMessage(playerid,brightred,"Lowest skin number is 0!");
SetPlayerSkin(playerid,skinid);
TogglePlayerControllable(playerid,1);
return 1;
}
Re: Setskin problem -
[MM]RoXoR[FS] - 28.06.2012
pawn Код:
CMD:setmyskin(playerid,params[])
{
new id;
if(sscanf(params,"d",id)) return SendClientMessage(playerid, red, "USAGE: /setmyskin [ID]");
new skin = id;
if(!IsValidSkin(skin)) return SendClientMessage(playerid, red, "ERROR: Invaild Skin ID");
if(playerid != INVALID_PLAYER_ID)
{
SetPlayerSkin(player1, skin);
format(string,sizeof(string),"|- You have set your skin to %d -|", skin);
return SendClientMessage(playerid,yellow,string);
}
return 1;
}
Re: Setskin problem -
phillip875 - 28.06.2012
pawn Код:
#define palepink 0xFFCCCC00
#define brightred 0xFF330000
forgot to include that before
Re: Setskin problem -
Strech - 28.06.2012
pawn Код:
CMD:setskin(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], giveplayerid, skinid;
if(sscanf(params, "ud", giveplayerid, skinid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]");
if(IsPlayerConnected(giveplayerid))
{
if(!IsInvalidSkin(skinid))
{
if(GetPlayerSkin(giveplayerid) == skinid)
{
SendClientMessageEx( playerid, COLOR_WHITE, "The player you're trying to change skins of already is using the skin you're trying to set." );
}
else
{
PlayerInfo[giveplayerid][pChar] = skinid;
PlayerInfo[giveplayerid][pModel] = skinid;
format(string, sizeof(string), "Your skin has been changed to ID %d by Administrator %s.", skinid, GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have given %s skin ID %d.", GetPlayerNameEx(giveplayerid), skinid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SetPlayerSkin(giveplayerid, PlayerInfo[giveplayerid][pChar]);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid skin ID!");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}