26.07.2012, 00:08
How can i script if a player type /skin ID then he should get the skin which he typed.
CMD:skin(playerid, params[])
{
new amount, name[MAX_PLAYER_NAME], string[128];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(sscanf(params,"i",amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [skinmodel]");
else if(amount> 299 || amount< 1) return SendClientMessage(playerid,COLOR_GREY,"Invalid skinid [1-299].");
else
{
GetPlayerName(playerid, name, sizeof(name));
strreplace(name, '_', ' ');
format(string, sizeof(string),"You have set %s's money to %d.", name, amount);
SendClientMessage(playerid,COLOR_WHITE,string);
PlayerInfo[playerid][pSkin] = amount;
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
}
}
else return SendClientMessage(playerid,COLOR_GREY,"You're not authorized to use that command!");
return 1;
}
if(strcmp(cmd, "/skin", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, red, "Usage: /skin [skinid]");
return 1;
}
new skin;
skin = strval(tmp);
if(skin > 299 || skin < 1) return SendClientMessage(playerid, COLOR_GREY, "Invalid skin ID!");
format(string, sizeof(string), "You have changed your skin to this skin ID: %d", skin);
SendClientMessage(playerid, COLOR_GREEN, string);
SetPlayerSkin(playerid, skin);
return 1;
}
if a player type /skin ID then he should get the skin which he typed. |
CMD:skin(playerid, params[])
{
new amount, name[MAX_PLAYER_NAME], string[128];
if(sscanf(params,"i",amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setskin [skinmodel]");
else if(amount> 299 || amount< 1) return SendClientMessage(playerid,COLOR_GREY,"Invalid skinid [1-299].");
else
{
GetPlayerName(playerid, name, sizeof(name));
strreplace(name, '_', ' ');
format(string, sizeof(string),"You have set %s's money to %d.", name, amount);
SendClientMessage(playerid,COLOR_WHITE,string);
PlayerInfo[playerid][pSkin] = amount;
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
}
return 1;
}
enum pInfo
{
pSkin
}
new PlayerInfo[MAX_PLAYERS][pInfo];
CMD:skin(playerid, params[])
{
new amount,skin, string[128];
if(sscanf(params,"i",amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /skin [skinmodel]");
else if(amount> 299 || amount< 1) return SendClientMessage(playerid,COLOR_GREY,"Invalid skinid [1-299].");
else
{
format(string, sizeof(string),"You have set skin to %d.", amount);
SendClientMessage(playerid,COLOR_WHITE,string);
SetPlayerSkin(playerid, skin);
}
return 1;
}
Depending whats your saving system, just change it to yours and use sscanf+ zcmd
pawn Код:
|