Joker
Умник
Для начала создайте в интерьерах магазинов пикапы, при действии на которых можно будет купить скин
1)Создадим массивы для скинов и прочего:
Ко всем new (желательно в конец):
Если вы собираетесь создать несколько магазинов, то проще объединить их в одну переменную (поправьте если неправильно написал):
2)Создадим команду для покупки скина:
В public OnPlayerCommandText(playerid, cmdtext[])
3)Теперь обозначим действия нашего диалога:
В public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Вот собственно и всё!
Если у вас система денег не ServerGivePlayerMoney, то замените её на свою
1)Создадим массивы для скинов и прочего:
Ко всем new (желательно в конец):
PHP:
new ClothesSex[MAX_PLAYERS]; // нужно для пола
new ClothesStyle[MAX_PLAYERS]; // нужна для стиля
new ClothesRun[MAX_PLAYERS]; // для выбора
static SportSkinMale[] = { // Спортивные скины мужские
22,51,52,96,97,99,154,252 };
static SportSkinFemale[] = { // Спортивные скины женские
13,38,41,88,90,92,138,139,140,251 };
static DelovSkinMale[] = { // Деловые скины мужские
17,57,59,82,83,84,98,147,153,187,221,227,228,240,255 };
static DelovSkinFemale[] = { // Деловые скины женские
9,11,40,55,76,141,148,169,211,215,219,224,225,233,256,263 };
static PovseSkinMale[] = { // Повседневные скины мужчины
7,14,15,18,19,20,21,23,26,27,28,29,30,32,35,36,37,44,45,47,48 //
,49,50,58,60,73,78,94,95,101,132,133,134,135,136,142,143,156 //
,158,160,170,184,185,188,202,206,210,217,220,222,223,229,230 //
,236,247,249,250,261, }; //
static PovseSkinFemale[] = { // Повседневные скины женские
10,12,31,39,54,56,64,69,89,93,129,130,131,151,152,157 //
,190,191,192,196,197,199,207,218,226,231,232,237,245 }; //
PHP:
IsAtClothes(playerid)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,5.0,217.4895324707,-98.33056640625,1005.2578125) || IsPlayerInRangeOfPoint(playerid,5.0,181.28218078613,-89.311637878418,1002.0307006836))return 1; //таким образом мы объединили, чтобы потом не мучаться. Важно: писать координаты пикапа (x,y,z)
}
return 0;
}
В public OnPlayerCommandText(playerid, cmdtext[])
PHP:
if(strcmp(cmd, "/clothes", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (!IsAtClothes(playerid))
{
return 1;
}
ShowPlayerDialog(playerid,221,0,"Магазин одежды","Выберите вид одежды:","Мужской","Женский");
}
return 1;
}
В public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
PHP:
switch(dialogid)
{
case 221:
{
if(response) ClothesSex[playerid] = 1;
else ClothesSex[playerid] = 2;
ShowPlayerDialog(playerid,222,2,"Магазин Одежды","{A0B0D0}Спортивная одежда {7CC000}300$\n{A0B0D0}Деловая одежда {7CC000}300$\n{A0B0D0}Повседневная одежда {7CC000}300$\n{A0B0D0}Назад","Выбрать","Выйти");
return 1;
}
case 222: // Магазин Одежды
{
if(!response)
{
SetCameraBehindPlayer(playerid); TogglePlayerControllable(playerid, 1);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
ClothesRun[playerid] = 0;
return 1;
}
else
{
switch(listitem)
{
case 0: {
ClothesStyle[playerid] = 1;
ShowPlayerDialog(playerid,224,0,"Спортивная одежда","Выберите нужную:","Дальше","Выбрать");
return 1; }
case 1: {
ClothesStyle[playerid] = 2;
ShowPlayerDialog(playerid,224,0,"Деловая одежда","Выберите нужную:","Дальше","Выбрать");
return 1; }
case 2: {
ClothesStyle[playerid] = 3;
ShowPlayerDialog(playerid,224,0,"Повседневная одежда","Выберите нужную:","Дальше","Выбрать");
return 1; }
case 3: return ShowPlayerDialog(playerid,221,0,"Магазин одежды","Выберите вид одежды:","Мужской","Женский");
}
}
}
case 224:
{
if(response)
{
if(ClothesStyle[playerid] == 1)
{
if(ClothesSex[playerid] == 1)
{
ClothesRun[playerid]++;
if(ClothesRun[playerid] >= sizeof(SportSkinMale)) ClothesRun[playerid] = 0;
SetPlayerSkin(playerid, SportSkinMale[ClothesRun[playerid]]);
}
else if(ClothesSex[playerid] == 2)
{
ClothesRun[playerid]++;
if(ClothesRun[playerid] >= sizeof(SportSkinFemale)) ClothesRun[playerid] = 0;
SetPlayerSkin(playerid, SportSkinFemale[ClothesRun[playerid]]);
}
}
else if(ClothesStyle[playerid] == 2)
{
if(ClothesSex[playerid] == 1)
{
ClothesRun[playerid]++;
if(ClothesRun[playerid] >= sizeof(DelovSkinMale)) ClothesRun[playerid] = 0;
SetPlayerSkin(playerid, DelovSkinMale[ClothesRun[playerid]]);
}
else if(ClothesSex[playerid] == 2)
{
ClothesRun[playerid]++;
if(ClothesRun[playerid] >= sizeof(DelovSkinFemale)) ClothesRun[playerid] = 0;
SetPlayerSkin(playerid, DelovSkinFemale[ClothesRun[playerid]]);
}
}
else if(ClothesStyle[playerid] == 3)
{
if(ClothesSex[playerid] == 1)
{
ClothesRun[playerid]++;
if(ClothesRun[playerid] >= sizeof(PovseSkinMale)) ClothesRun[playerid] = 0;
SetPlayerSkin(playerid, PovseSkinMale[ClothesRun[playerid]]);
}
else if(ClothesSex[playerid] == 2)
{
ClothesRun[playerid]++;
if(ClothesRun[playerid] >= sizeof(PovseSkinFemale)) ClothesRun[playerid] = 0;
SetPlayerSkin(playerid, PovseSkinFemale[ClothesRun[playerid]]);
}
}
ShowPlayerDialog(playerid,224,0,"Выберите одежду","Вы будите брать эту одежду?:","Дальше","Выбор");
return 1;
}
else return ShowPlayerDialog(playerid,225,0,"Касса","{A0B0D0}Хотите {7CC000}купить{A0B0D0} эту одежду за {7CC000}300$?","Да","Нет");
}
case 225: // Покупка одежды
{
if(response)
{
if(ClothesStyle[playerid] == 1) {
if(ClothesSex[playerid] == 1) PlayerInfo[playerid][pModel] = SportSkinMale[ClothesRun[playerid]];
else if(ClothesSex[playerid] == 2) PlayerInfo[playerid][pModel] = SportSkinFemale[ClothesRun[playerid]]; }
else if(ClothesStyle[playerid] == 2) {
if(ClothesSex[playerid] == 1) PlayerInfo[playerid][pModel] = DelovSkinMale[ClothesRun[playerid]];
else if(ClothesSex[playerid] == 2) PlayerInfo[playerid][pModel] = DelovSkinFemale[ClothesRun[playerid]]; }
else if(ClothesStyle[playerid] == 3) {
if(ClothesSex[playerid] == 1) PlayerInfo[playerid][pModel] = PovseSkinMale[ClothesRun[playerid]];
else if(ClothesSex[playerid] == 2) PlayerInfo[playerid][pModel] = PovseSkinFemale[ClothesRun[playerid]]; }
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
ServerGivePlayerMoney(playerid, -300);
ClothesRun[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "* Вы купили новую одежду с вас взяли {009000}300$");
SetCameraBehindPlayer(playerid); TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
ClothesRun[playerid] = 0;
ShowPlayerDialog(playerid,222,2,"Магазин Одежды","{A0B0D0}Спортивная одежда {7CC000}300$\n{A0B0D0}Деловая одежда {7CC000}300$\n{A0B0D0}Повседневная одежда {7CC000}300$\n{A0B0D0}Назад","Выбрать","Выйти");
return 1;
}
}
}
Если у вас система денег не ServerGivePlayerMoney, то замените её на свою
