Преработка на ZP Q&A

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
DoPe ;]]
Извън линия
Потребител
Потребител
Мнения: 402
Регистриран на: 27 Фев 2017, 22:10
Обратна връзка:

Преработка на ZP Q&A

Мнение от DoPe ;]] » 15 Фев 2018, 15:48

Ако може следния плъгин да се преработи така, че да може да се използва в jbextreme само от SIMON и админи с флаг: kick. Благодаря предварително!
Прикачени файлове
zp_addon_qna.sma
(6.11 KiB) Свалено 114 пъти
zp_addon_qna.sma
(6.11 KiB) Свалено 114 пъти
The Best Deathrun Server: 79.124.49.91:27019
The Best Respawn Server: 79.124.49.88:27021

Аватар
NiKo.
Извън линия
Потребител
Потребител
Мнения: 41
Регистриран на: 13 Окт 2016, 20:57
Местоположение: Варна
Получена благодарност: 1 път

Преработка на ZP Q&A

Мнение от NiKo. » 15 Фев 2018, 20:05

Използвах nativa от библиотеката jbextreme-crx на крома предполагам изполваш неговия едит на jbextreme тъй като е доста по-добре, чат съобщения и др не съм пипал, само SIMON и хората с флаг за кик както си написал могат да ги ползват.

Също предполагам знаеш, че след познаване на quest дава AMMOPACKS които са за ZP, не знам защо ти е за жб но заповядай.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <zombieplague>
#include <jbextreme-crx>

#define ADMIN_FLAG	ADMIN_KICK

new const VERSION[] = "1.0"

new question[64], answer[32], amount[5], saveamount, playeranswer[33][32], flags[33]

new bool:InQuestion

new cvar_questionduration
new Float:questionduration

new g_iMaxPlayers

new g_bitConnectedPlayers, g_bitAnsweredPlayers

#define MarkUserConnected(%0)   g_bitConnectedPlayers |= (1 << (%0 & 31))
#define ClearUserConnected(%0)  g_bitConnectedPlayers &= ~(1 << (%0 & 31))
#define IsUserConnected(%0)	g_bitConnectedPlayers & (1 << (%0 & 31))

#define MarkUserAnswered(%0)	g_bitAnsweredPlayers |= (1 << (%0 & 31))
#define ClearUserAnswered(%0)	g_bitAnsweredPlayers &= ~(1 << (%0 & 31))
#define IsUserAnswered(%0)	g_bitAnsweredPlayers & (1 << (%0 & 31))

public plugin_init()
{
	register_plugin("[ZP] Addon: Q & A", VERSION, "eXcalibur.007")
	
	register_clcmd("say /setquestion", "set_question", ADMIN_FLAG, "- Sets a question for players to answer")
	register_clcmd("say_team /setquestion", "set_question", ADMIN_FLAG, "- Sets a question for players to answer")
	
	register_clcmd("say /quest", "set_messagemode", 0, "- Attempt to answer the question")
	register_clcmd("say_team /quest", "set_messagemode", 0, "- Attempt to answer the question")
	
	register_clcmd("SetQuestion", "SetQuestion")
	register_clcmd("SetAnswer", "SetAnswer")
	register_clcmd("SetAmmopacks", "SetAmmopacks")
	register_clcmd("AttemptAnswer", "AttemptAnswer")
	
	register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
	
	cvar_questionduration = register_cvar("zp_qna_duration", "10.0")
	
	g_iMaxPlayers = get_maxplayers()
}

public client_putinserver(id)
{
	MarkUserConnected(id)
}

public client_disconnect(id)
{
	ClearUserConnected(id)
	ClearUserAnswered(id)
}

public event_new_round()
{
	questionduration = get_pcvar_float(cvar_questionduration)
	
	for(new i = 1; i <= g_iMaxPlayers; i++)
	{
		flags[i] = get_user_flags(i)
	}
}

public set_question(id)
{
	if(!(flags[id] & ADMIN_FLAG) && !(is_user_simon(id)))
	{
		client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
		return
	}
	
	if(IsUserConnected(id))
	{
		if(InQuestion)
		{
			client_print(id, print_chat, "[ZP] There is already and on-going question!")
			return
		}
		
		client_cmd(id, "messagemode SetQuestion")
	}
}

public SetQuestion(id)
{
	if(!(flags[id] & ADMIN_FLAG) && !(is_user_simon(id)))
	{
		client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
		return
	}
	
	if(InQuestion)
	{
		client_print(id, print_chat, "[ZP] There is already and on-going question!")
		return
	}
	
	read_argv(1, question, charsmax(question))
	remove_quotes(question)
	
	if(equal(question, "") || equal(question, " "))
	{
		client_print(id, print_chat, "[ZP] You've entered a blank or a spacebar only. Please try again.")
		return
	}
	
	client_print(id, print_chat, "Question: %s", question)
	client_cmd(id, "messagemode SetAnswer")
}

public SetAnswer(id)
{
	if(!(flags[id] & ADMIN_FLAG) && (is_user_simon(id)))
	{
		client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
		return
	}
	
	if(InQuestion)
	{
		client_print(id, print_chat, "[ZP] There is already and on-going question!")
		return
	}
	
	read_argv(1, answer, charsmax(answer))
	remove_quotes(answer)
	
	
	if(equal(answer, "") || equal(answer, " "))
	{
		client_print(id, print_chat, "[ZP] You've entered a blank or a spacebar only. Please try again.")
		return
	}
	
	client_print(id, print_chat, "Answer: %s", answer)
	client_cmd(id, "messagemode SetAmmopacks")
}

public SetAmmopacks(id)
{
	if(!(flags[id] & ADMIN_FLAG) && !(is_user_simon(id)))
	{
		client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
		return
	}
	
	if(InQuestion)
	{
		client_print(id, print_chat, "[ZP] There is already and on-going question!")
		return
	}
	
	read_argv(1, amount, charsmax(amount))
	
	if(equal(amount, "") || equal(amount, " ") || !is_str_num(amount))
	{
		client_print(id, print_chat, "[ZP] You've entered a blank, a spacebar only or an invalid number. Please try again.")
		return
	}
	
	saveamount = str_to_num(amount)
	
	set_task(questionduration, "end_question")
	
	client_print(0, print_center, "Question: %s | Ammopacks: %i", question, saveamount)
	client_print(0, print_chat, "[ZP] Type /qna to attempt the question")
	
	InQuestion = true
}

public set_messagemode(id)
{
	if(IsUserConnected(id))
	{
		if(!InQuestion)
		{
			client_print(id, print_chat, "[ZP] Sorry, there is currently no on-going question. Please try again later")
			return
		}
		
		if(IsUserAnswered(id))
		{
			client_print(id, print_chat, "[ZP] Sorry, you've already answered the question")
			return
		}
		
		client_cmd(id, "messagemode AttemptAnswer")
	}
}

public AttemptAnswer(id)
{
	if(IsUserConnected(id))
	{
		if(!InQuestion)
		{
			client_print(id, print_chat, "[ZP] Sorry, there is currently no on-going question. Please try again later")
			return
		}
		
		if(IsUserAnswered(id))
		{
			client_print(id, print_chat, "[ZP] Sorry, you've already answered the question")
			return
		}
		
		read_argv(1, playeranswer[id], 31)
		remove_quotes(playeranswer[id])
		
		client_print(id, print_chat, "%s", playeranswer[id])
		
		if(equal(playeranswer[id], "") || equal(playeranswer[id], " "))
		{
			client_print(id, print_chat, "[ZP] You've entered a blank or a spacebar only. Please try again.")
			return
		}
	
		MarkUserAnswered(id)
	}
}

public end_question()
{
	for(new i = 1; i <= g_iMaxPlayers; i++)
	{
		if(IsUserAnswered(i))
		{
			if(equali(answer, playeranswer[i]))
			{
				client_print(i, print_center, "[ZP] Congratulations, you've won %i by giving the correct answer!", saveamount)
				zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + saveamount)
			}
			else
			{
				client_print(i, print_center, "[ZP] You've given the wrong answer, better luck next time!")
				client_print(i, print_center, "[ZP] The answer is: %s", answer)
			}
			ClearUserAnswered(i)
		}
		else
		{
			client_print(i ,print_center, "[ZP] Sorry, you did not answer the question.")
		}
	}
	InQuestion = false
}

Последно промяна от NiKo. на 16 Фев 2018, 00:41, променено общо 1 път.
Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Преработка на ZP Q&A

Мнение от OciXCrom » 15 Фев 2018, 23:11

Също предполагам знаеш, че след познаване на quest дава AMMOPACKS които са за ZP, не знам защо ти е за жб но заповядай.
Ами надали ползва zombie plague + jailbreak extreme заедно, че плъгинът да може да работи. :D
Дай информация какво да дава вместо ammo packs. Ако искаш да е JBPacks, качи плъгина за пакове (магазина).

Аватар
DoPe ;]]
Извън линия
Потребител
Потребител
Мнения: 402
Регистриран на: 27 Фев 2017, 22:10
Обратна връзка:

Преработка на ZP Q&A

Мнение от DoPe ;]] » 21 Фев 2018, 15:35

Нищо не искам да дава, искам като напиша: /quest и и след това да ми изисква да напиша и отговора, който отговори пръв да изпише в чата: Nick has just answered the question first! (Ако може да е цветно)
The Best Deathrun Server: 79.124.49.91:27019
The Best Respawn Server: 79.124.49.88:27021

Аватар
NiKo.
Извън линия
Потребител
Потребител
Мнения: 41
Регистриран на: 13 Окт 2016, 20:57
Местоположение: Варна
Получена благодарност: 1 път

Преработка на ZP Q&A

Мнение от NiKo. » 21 Фев 2018, 21:01

Нека имаме увъжение към авторите на плъгини..
До колкото знам плъгина който искаш е подобен на този в iPlay JB, а тяхният е авторски и го няма в нета, ако OcixCrom е съгласен да ти дам плъгина който пренаписах от този горе, ще ти го дам.
Последно промяна от NiKo. на 21 Фев 2018, 21:04, променено общо 1 път.
Изображение

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Преработка на ZP Q&A

Мнение от OciXCrom » 21 Фев 2018, 21:04

Все тая, ще кача и моя версия скоро.

Аватар
NiKo.
Извън линия
Потребител
Потребител
Мнения: 41
Регистриран на: 13 Окт 2016, 20:57
Местоположение: Варна
Получена благодарност: 1 път

Преработка на ZP Q&A

Мнение от NiKo. » 21 Фев 2018, 21:10

Е тогава,

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <jbextreme-crx>
#include <cromchat>

#define ADMIN_FLAG	ADMIN_KICK

new question[64], answer[32]

new bool:InQuestion

new cvar_questionduration
new Float:questionduration

new bool:g_bIsAnswered[33];

new g_bitConnectedPlayers

#define MarkUserConnected(%0)   g_bitConnectedPlayers |= (1 << (%0 & 31))
#define ClearUserConnected(%0)  g_bitConnectedPlayers &= ~(1 << (%0 & 31))
#define IsUserConnected(%0)	g_bitConnectedPlayers & (1 << (%0 & 31))

public plugin_init()
{
	register_plugin("[JB] Quest", "1.0", "NiKo")
	
	register_clcmd("say /quest", "set_question", ADMIN_FLAG, " Sets a question for prisoners to answer")
	register_clcmd("say_team /quest", "set_question", ADMIN_FLAG, " Sets a question for prisoners to answer")
	
	register_clcmd("say", "SayAnswer", 0, " Answer the question")
	register_clcmd("say_team", "SayAnswer", 0, " Answer the question")
	
	register_clcmd("Question", "Question")
	register_clcmd("Answer", "Answer")
	
	register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
	
	cvar_questionduration = register_cvar("quest_duration", "10.0")
}

public client_putinserver(id)
{
	MarkUserConnected(id)
}

public client_disconnect(id)
{
	ClearUserConnected(id)
}

public event_new_round()
{
	questionduration = get_pcvar_float(cvar_questionduration)
}

public set_question(id)
{
	if((get_user_flags(id) & ADMIN_FLAG) || is_user_simon(id))
	{
		if(IsUserConnected(id))
		{
			if(InQuestion)
			{
				CC_SendMessage(id, "&x04[JB] &x01There is already and on-going question!")
				return
			}
		
			client_cmd(id, "messagemode Question")
		}
	}
	else
	{
		CC_SendMessage(id, "&x04[JB] &x01You have to be an admin or simon to use this command.")
		return
	}
}

public Question(id)
{
	if((get_user_flags(id) & ADMIN_FLAG) || is_user_simon(id))
	{
		if(InQuestion)
		{
			CC_SendMessage(id, "&x04[JB] &x01There is already and on-going question!")
			return
		}
	
		read_argv(1, question, charsmax(question))
		remove_quotes(question)
		
		if(equal(question, "") || equal(question, " "))
		{
			CC_SendMessage(id, "&x04[JB] &x01You've entered a blank or a spacebar only. Please try again.")
			return
		}
	
		CC_SendMessage(id, "&x01Question is&x04 %s", question)
		CC_SendMessage(id, "&x04Now type the answer to start the quest.")
		client_cmd(id, "messagemode Answer")
	}
	else
	{
		client_print(id, print_chat, "&x04[JB] &x01You have to be an admin or simon to use this command.")
		return
	}
}

public Answer(id)
{
	if((get_user_flags(id) & ADMIN_FLAG) || is_user_simon(id))
	{
		if(InQuestion)
		{
			CC_SendMessage(id, "&x04[JB] &x01There is already and on-going question!")
			return
		}
	
		read_argv(1, answer, charsmax(answer))
		remove_quotes(answer)
	
	
		if(equal(answer, "") || equal(answer, " "))
		{
			client_print(id, print_chat, "[JB] You've entered a blank, a spacebar only or an invalid number. Please try again.")
			return
		}
	
		set_task(questionduration, "end_question")
		new szName[32]
		get_user_name(id, szName, charsmax(szName))
		CC_SendMessage(id, "&x04Answer is %s", answer)
		CC_SendMessage(0, "&x04[JB] &x03%s &x01asked a question: &x04%s", szName, question)
	
		InQuestion = true
	}
	else
	{
		CC_SendMessage(id, "&x04[JB] &x01You have to be an admin or simon to use this command.")
		return
	}
}

public SayAnswer(id)
{
	if(IsUserConnected(id))
	{
		new szAnswer[192], szName[32];
		read_args(szAnswer, charsmax(szAnswer));
		remove_quotes(szAnswer);
		get_user_name(id, szName, charsmax(szName))
		
		if(equali(szAnswer, answer))
		{
			g_bIsAnswered[id] = true;
			if(is_user_alive(id) && InQuestion)
			{
				end_question()
				CC_SendMessage(0, "&x04[JB] &x03%s &x04has just answered the question first!", szName)
			}
			else
			{
				return
			}
		}
	}
}

public end_question()
{
	InQuestion = false
}
Изображение

Аватар
DoPe ;]]
Извън линия
Потребител
Потребител
Мнения: 402
Регистриран на: 27 Фев 2017, 22:10
Обратна връзка:

Преработка на ZP Q&A

Мнение от DoPe ;]] » 21 Фев 2018, 22:03

Става, но ако може да се сложи task от 10 секунди, ако за тия 10 секунди никой не успее да отговори на въпроса да се анулира, като изпише: [JB] Nikoi ne uspq da otgovori na vuprosa pravilno.
The Best Deathrun Server: 79.124.49.91:27019
The Best Respawn Server: 79.124.49.88:27021

Аватар
NiKo.
Извън линия
Потребител
Потребител
Мнения: 41
Регистриран на: 13 Окт 2016, 20:57
Местоположение: Варна
Получена благодарност: 1 път

Преработка на ZP Q&A

Мнение от NiKo. » 21 Фев 2018, 22:15

DoPe ;]] написа: 21 Фев 2018, 22:03 Става, но ако може да се сложи task от 10 секунди, ако за тия 10 секунди никой не успее да отговори на въпроса да се анулира, като изпише: [JB] Nikoi ne uspq da otgovori na vuprosa pravilno.
Също ако решиш да променяш времето за отговаряне направих ти cvar "quest_duration <секунди>"

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <jbextreme-crx>
#include <cromchat>

#define ADMIN_FLAG	ADMIN_KICK

new question[64], answer[32]

new bool:InQuestion

new cvar_questionduration
new Float:questionduration

new bool:g_bIsAnswered[33];

new g_bitConnectedPlayers

#define MarkUserConnected(%0)   g_bitConnectedPlayers |= (1 << (%0 & 31))
#define ClearUserConnected(%0)  g_bitConnectedPlayers &= ~(1 << (%0 & 31))
#define IsUserConnected(%0)	g_bitConnectedPlayers & (1 << (%0 & 31))

public plugin_init()
{
	register_plugin("[JB] Quest", "1.0", "NiKo")
	
	register_clcmd("say /quest", "set_question", ADMIN_FLAG, " Sets a question for prisoners to answer")
	register_clcmd("say_team /quest", "set_question", ADMIN_FLAG, " Sets a question for prisoners to answer")
	
	register_clcmd("say", "SayAnswer", 0, " Answer the question")
	register_clcmd("say_team", "SayAnswer", 0, " Answer the question")
	
	register_clcmd("Question", "Question")
	register_clcmd("Answer", "Answer")
	
	register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
	
	cvar_questionduration = register_cvar("quest_duration", "10.0")
}

public client_putinserver(id)
{
	MarkUserConnected(id)
}

public client_disconnect(id)
{
	ClearUserConnected(id)
}

public event_new_round()
{
	questionduration = get_pcvar_float(cvar_questionduration)
}

public set_question(id)
{
	if((get_user_flags(id) & ADMIN_FLAG) || is_user_simon(id))
	{
		if(IsUserConnected(id))
		{
			if(InQuestion)
			{
				CC_SendMessage(id, "&x04[JB] &x01There is already and on-going question!")
				return
			}
		
			client_cmd(id, "messagemode Question")
		}
	}
	else
	{
		CC_SendMessage(id, "&x04[JB] &x01You have to be an admin or simon to use this command.")
		return
	}
}

public Question(id)
{
	if((get_user_flags(id) & ADMIN_FLAG) || is_user_simon(id))
	{
		if(InQuestion)
		{
			CC_SendMessage(id, "&x04[JB] &x01There is already and on-going question!")
			return
		}
	
		read_argv(1, question, charsmax(question))
		remove_quotes(question)
		
		if(equal(question, "") || equal(question, " "))
		{
			CC_SendMessage(id, "&x04[JB] &x01You've entered a blank or a spacebar only. Please try again.")
			return
		}
	
		CC_SendMessage(id, "&x01Question is&x04 %s", question)
		CC_SendMessage(id, "&x04Now type the answer to start the quest.")
		client_cmd(id, "messagemode Answer")
	}
	else
	{
		client_print(id, print_chat, "&x04[JB] &x01You have to be an admin or simon to use this command.")
		return
	}
}

public Answer(id)
{
	if((get_user_flags(id) & ADMIN_FLAG) || is_user_simon(id))
	{
		if(InQuestion)
		{
			CC_SendMessage(id, "&x04[JB] &x01There is already and on-going question!")
			return
		}
	
		read_argv(1, answer, charsmax(answer))
		remove_quotes(answer)
	
	
		if(equal(answer, "") || equal(answer, " "))
		{
			client_print(id, print_chat, "[JB] You've entered a blank, a spacebar only or an invalid number. Please try again.")
			return
		}
	
		set_task(questionduration, "end_question")
		
		new szName[32]
		get_user_name(id, szName, charsmax(szName))
		CC_SendMessage(id, "&x04Answer is %s", answer)
		CC_SendMessage(0, "&x04[JB] &x03%s &x01asked a question: &x04%s", szName, question)
	
		InQuestion = true
	}
	else
	{
		CC_SendMessage(id, "&x04[JB] &x01You have to be an admin or simon to use this command.")
		return
	}
}

public SayAnswer(id)
{
	if(IsUserConnected(id))
	{
		new szAnswer[192], szName[32];
		read_args(szAnswer, charsmax(szAnswer));
		remove_quotes(szAnswer);
		get_user_name(id, szName, charsmax(szName))
		
		if(equali(szAnswer, answer))
		{
			g_bIsAnswered[id] = true
			if(is_user_alive(id) && InQuestion)
			{
				InQuestion = false
				CC_SendMessage(0, "&x04[JB] &x03%s &x04has just answered the question first!", szName)
			}
			else
			{
				return
			}
		}
	}
}

public end_question()
{
	if(InQuestion)
	{
		CC_SendMessage(0, "&x04[JB] &x01Nikoi ne uspq da otgovori na vuprosa pravilno.")
	}
	InQuestion = false
}
Изображение

Аватар
DoPe ;]]
Извън линия
Потребител
Потребител
Мнения: 402
Регистриран на: 27 Фев 2017, 22:10
Обратна връзка:

Преработка на ZP Q&A

Мнение от DoPe ;]] » 21 Фев 2018, 22:26

Благодаря много, ключ.
The Best Deathrun Server: 79.124.49.91:27019
The Best Respawn Server: 79.124.49.88:27021

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 10 госта