switch( GetPlayerSkin( playerid )
{
case 163, 164, 165, 166:
{
// Code for these skins!
}
}
|
pawn Код:
|
CMD:buyclothes(playerid, params[]) {
if(GetPlayerVirtualWorld(playerid)-BUSINESS_VIRTUAL_WORLD >= 1) {
new
skinID,
slotID,
iPrice,
houseID = getPlayerHouseID(playerid),
businessID = GetPlayerVirtualWorld(playerid) - BUSINESS_VIRTUAL_WORLD;
if(businessID > 0) {
for(new i = 0; i < MAX_BUSINESS_ITEMS; i++) {
if(businessItems[i][bItemType] == 18 && businessItems[i][bItemBusiness] == businessID)
iPrice = businessItems[i][bItemPrice];
}
}
if(businessVariables[businessID][bType] == 2) {
if(houseID >= 1) {
if(sscanf(params, "dd", skinID, slotID)) {
return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/buyclothes [skinid] [house slot]");
}
else if(!IsValidSkin(skinID)) {
return SendClientMessage(playerid, COLOR_GREY, "Invalid skin ID.");
}
else if(!IsPublicSkin(skinID) && playerVariables[playerid][pGroup] != 1) {
return SendClientMessage(playerid, COLOR_GREY, "You can't purchase this skin.");
}
else if(slotID < 1 || slotID > 5) {
return SendClientMessage(playerid, COLOR_GREY, "Invalid slot specified.");
}
else if(playerVariables[playerid][pMoney] >= 500) {
playerVariables[playerid][pMoney] -= 500;
businessVariables[businessID][bVault] += 500;
playerVariables[playerid][pSkin] = skinID;
houseVariables[houseID][hWardrobe][slotID - 1] = skinID;
return SetPlayerSkin(playerid, skinID);
}
else {
format(szMessage, sizeof(szMessage), "You don't have $%d available.", iPrice);
SendClientMessage(playerid, COLOR_GREY, szMessage);
}
}
else if(!isnull(params)) {
skinID = strval(params);
if(!IsValidSkin(skinID)) {
return SendClientMessage(playerid, COLOR_GREY, "Invalid skin ID.");
}
else if(!IsPublicSkin(skinID) && playerVariables[playerid][pGroup] != 1) {
return SendClientMessage(playerid, COLOR_GREY, "You can't purchase this skin.");
}
else {
if(playerVariables[playerid][pMoney] >= iPrice) {
playerVariables[playerid][pMoney] -= iPrice;
businessVariables[businessID][bVault] += iPrice;
playerVariables[playerid][pSkin] = skinID;
return SetPlayerSkin(playerid, skinID);
} else {
format(szMessage, sizeof(szMessage), "You don't have $%d available.", iPrice);
SendClientMessage(playerid, COLOR_GREY, szMessage);
}
}
}
else {
format(szMessage, sizeof(szMessage), "Skins here cost $%d", iPrice);
SendClientMessage(playerid, COLOR_GREY, szMessage);
SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/buyclothes [skinid] (Skins cost $500.)");
}
}
}
return 1;
}
switch( GetPlayerSkin( playerid )
{
case 163, 164, 165, 166:
{
// These skins can buy clothes
// Code for buying here
}
default: SendClientMessage( playerid, -1, "You cannot buy this!" );
}