Доступ к готовым решениям

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Мануал Работа Дровосека

Статус
В этой теме нельзя размещать новые ответы.

Merlin

Умник
Добрый день , вот решил выложить интересную работу new.
Ко всем #define​
PHP:
#define COLOR_ORANGE 0xFFA500FF
#define COLOR_SYSTEM 0xFFFFFFFF
#define COLOR_YELLOW3d 0xFFFF00FF
После в forward
PHP:
forward TimeDrov(playerid);
К new ->
PHP:
new Text3D:cutterd;
new cutt;
new bool:startjobd[MAX_PLAYERS];
new bool:woodcutter[MAX_PLAYERS];
new timecutt[MAX_PLAYERS];
new Oldskin[MAX_PLAYERS];
new kgcutt[MAX_PLAYERS];
new cuttrands;
new pickcutt,cutter;
new randomcutt[][1] = {
    {25},{27},{29},{28},{33},{30},{35},{32},{37},{41},  {36},
	{42},{47},{52},{39},{40},{53},{54},{43},{44},{45}
};
Далее в public OnGameModeInit()
PHP:
new texts[56];
	CreateObject(18259,-1897.80004883,-1971.00000000,86.59999847,0.00000000,0.00000000,0.  00000000); //object(logcabinn01) (2)
	CreateObject(1463,-1892.90002441,-1984.69995117,85.50000000,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (1)
	CreateObject(1463,-1894.19995117,-1983.09997559,85.50000000,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (2)
	CreateObject(1463,-1892.40002441,-1981.00000000,85.50000000,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (3)
	CreateObject(1463,-1894.09997559,-1981.40002441,85.50000000,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (4)
	CreateObject(1463,-1892.30004883,-1982.40002441,85.50000000,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (5)
	CreateObject(1463,-1894.00000000,-1982.09997559,85.80000305,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (6)
	CreateObject(1463,-1892.40002441,-1981.59997559,85.80000305,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (7)
	CreateObject(1463,-1893.80004883,-1981.80004883,86.40000153,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (8)
	CreateObject(1463,-1894.19995117,-1982.69995117,86.09999847,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (9)
	CreateObject(1463,-1891.19995117,-1984.00000000,85.50000000,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (10)
	CreateObject(1463,-1894.90002441,-1984.90002441,85.50000000,0.00000000,0.00000000,0.  00000000); //object(dyn_woodpile2) (11)
	CreateObject(14872,-1890.09997559,-1979.19995117,85.69999695,0.00000000,0.00000000,0.  00000000); //object(kylie_logs) (1)
	CreateObject(14872,-1892.09997559,-2013.30004883,78.80000305,0.00000000,0.00000000,0.  00000000); //object(kylie_logs) (2)
	CreateObject(14872,-1868.80004883,-2016.80004883,77.50000000,0.00000000,0.00000000,0.  00000000); //object(kylie_logs) (3)
	CreateObject(848,-1872.30004883,-2005.09997559,82.40000153,0.00000000,0.00000000,0.  00000000); //object(dead_tree_20) (1)
	CreateObject(684,-1888.40002441,-1973.19995117,85.69999695,3.00000000,0.00000000,0.  00000000); //object(sm_fir_log02) (1)
	CreateObject(846,-1892.00000000,-2019.80004883,77.00000000,17.50000000,0.00000000,0  .00000000); //object(dead_tree_18) (1)
	CreateObject(842,-1898.30004883,-1982.00000000,85.40000153,0.00000000,0.00000000,0.  00000000); //object(dead_tree_14) (1)
	CreateObject(834,-1882.90002441,-2009.50000000,81.69999695,0.00000000,0.00000000,0.  00000000); //object(dead_tree_7) (1)
	CreateObject(831,-1883.59997559,-1993.90002441,83.40000153,0.00000000,0.00000000,0.  00000000); //object(dead_tree_5) (1)
	CreateObject(831,-1917.90002441,-1904.50000000,86.19999695,0.00000000,0.00000000,0.  00000000); //object(dead_tree_5) (2)
	CreateObject(831,-1905.50000000,-1889.30004883,86.19999695,0.00000000,0.00000000,25  0.00000000); //object(dead_tree_5) (3)
	pickcutt = CreatePickup(1275,23,-1904.40002441,-1979.30004883,87.80000305);
	format(texts,sizeof(texts),"Склад пуст");
	Create3DTextLabel(texts, 0xFFA500FF, -1889.9906,-1976.1985,86.3198, 40.0, 0, 0);
В public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
PHP:
if(startjobd[playerid]==true){
	if(newkeys == KEY_JUMP || newkeys == KEY_FIRE || KEY_CROUCH || KEY_SECONDARY_ATTACK){
  	DisablePlayerCheckpoint(playerid);
 	RemovePlayerAttachedObject(playerid,1);
 	ApplyAnimation(playerid,"PED","IDLE_tired",4.1,0,1,1,0,1);
 	SendClientMessage(playerid,0xAFAFAFAA," Вы уронили древесину");
	SetPlayerCheckpoint(playerid, -1898.4493,-2008.8124,80.6425,1.0);
	}
	}
В public OnPlayerPickUpPickup(playerid, pickupid)
PHP:
if(pickupid == pickcutt){
	if(woodcutter[playerid] == true){// тоже можно разными цветами
	ShowPlayerDialog(playerid,116,DIALOG_STYLE_MSGBOX,"Работа дровосека","{EEADDF}>>{FFFFFF}Вы действительно желаете закончить рабочий день?","Да","Нет");
	}else{
	ShowPlayerDialog(playerid,115,DIALOG_STYLE_MSGBOX,"Работа дровосека","{EEADDF}>>{FFFFFF}Вы желаете начать работу дровосека?","Да","Нет");
	}
	}
В public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
PHP:
new string[256];
	if(dialogid == 115 && response){// Если не на работе, то показываем чтоб устроиться
	if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);// забрали кирку
	woodcutter[playerid] = true;// работу начал
	Oldskin[playerid] = GetPlayerSkin(playerid);// сохроняем старый скин
	SetPlayerSkin(playerid, 133);// ставим скин работяги
	SetPlayerCheckpoint(playerid,-1898.4493,-2008.8124,80.6425,1.0);// Ставим чекпоинт где долбить руду
	SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}Вы начали работу Дровосека!");
	SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}На вашей карте отмечен чекпоинт");
	SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}Идите к нему, чтобы начать рубку леса");
	ApplyAnimation(playerid,"CHAINSAW","WEAPON_csaw",4.1,1,0,0,0,1);
	ClearAnimations(playerid);
	}
	if(dialogid == 116 && response){// Если на работе, то показваем, что желаете ли закончить рабочий день
	woodcutter[playerid] = false;// Игрок не дровосек
	SetPlayerSkin(playerid,Oldskin[playerid]);// Ставим старый скин
	DisablePlayerCheckpoint(playerid);// Убираем чп.
	GivePlayerMoney(playerid, kgcutt[playerid]/2);
	format(string, sizeof(string), "{EEADDF}>>{FFFFFF}Вы заработали %d$ за вырубку %d древисины",kgcutt[playerid]/2,kgcutt[playerid]);
	SendClientMessage(playerid, COLOR_SYSTEM, string);
	kgcutt[playerid] = 0;
	if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
	if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);// забрали тачку
	if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);// забрали тачку
	}
В public OnPlayerEnterCheckpoint(playerid)
PHP:
new string[128];
	ClearAnimations(playerid);
	ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
	if(PlayerToPoint(6.0, playerid,-1898.4493,-2008.8124,80.6425)){
	startjobd[playerid] = true;
	ApplyAnimation(playerid,"CHAINSAW","WEAPON_csaw",4.1,1,0,0,0,11000);
	GivePlayerWeapon(playerid, 9, 1);
	DisablePlayerCheckpoint(playerid);
	timecutt[playerid] = SetTimerEx("TimeDrov",9800,false,"i", playerid);
	return 1;
	}
	else if(PlayerToPoint(3.0, playerid,-1896.6873,-1984.3062,86.1669) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT){
	startjobd[playerid] = false;
	cuttrands = random(sizeof(randomcutt));
	kgcutt[playerid] += randomcutt[cuttrands][0];
	if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);// забрали тачку
	if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);// забрали камень
	format(string, sizeof(string), "Общее количество древисины %d",kgcutt[playerid]);
	SendClientMessage(playerid, -1, string);
	format(string, sizeof(string), "Вы вырубили %d древисины",randomcutt[cuttrands][0]);
	SendClientMessage(playerid, -1, string);
	cutter+=randomcutt[cuttrands][0];
	cutt+=randomcutt[cuttrands][0];
	cutt ++;
	ApplyAnimation(playerid,"PED","IDLE_tired",4.1,1,0,0,0,2500);
	SetPlayerCheckpoint(playerid, -1898.4493,-2008.8124,80.6425,1.0);
	UpdateMine();
	return 1;
    }
В Конце мода
PHP:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}
public TimeDrov(playerid)
{
	if(startjobd[playerid]==true){
	ResetPlayerWeapons(playerid);
	SetPlayerAttachedObject(playerid, 1 , 1463, 1,0.20,0.36,0.0,0.0,90.0, 0.0, 0.4, 0.3, 0.6);
	ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
	SetPlayerCheckpoint(playerid,-1896.6873,-1984.3062,86.1669,1.0);
	}
	return 1;
}
public OnPlayerDisconnect(playerid)
{
	woodcutter[playerid] = false;// Игрок не дровосек
	return 1;
}
UpdateMine()
{
	new string[56];
	format(string,sizeof(string),"На складе:\n %d древесины",cutt);
	Update3DTextLabelText(cutterd, COLOR_YELLOW3d, string);
	SaveMine();
	return 1;
}
stock SaveMine()
{
 	new File = ini_openFile("mine.ini");
	if(!File)
	{
        ini_setInteger(File,"Древесины на складе",cutt);
       	ini_closeFile(File);
	}
	return 1;
}
В scriptfiles создаём
PHP:
mine.ini
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу