Plugin Cerut: Trivia bot
Descriere (adica ce face el mai exact): pune intrebari random si poti raspunde ca player la ele.
Ai cautat pluginul?(daca da, precizeaza cum): google si multe cu buguri si ne traduse.
Serverul impune conditii strict HLDS/REHLDS?: nu
Necesita mod special?: Nu
Versiune AMXX Server: versiune 1.9.0
caut un plugin trivia in romana cum era cel de pe extreamcs la modul cache.
[Cerere Plugin] Trivia bot
Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com
Forum rules
Accesează link-ul pentru a putea vedea regulile forumului
Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Accesează link-ul pentru a putea vedea regulile forumului
Daca doriti sa vi se modifice un plugin, va rugam postati aici .
-
- Membru, skill 0
- Posts: 84
- Joined: 28 Oct 2022, 00:10
- Detinator Steam: Da
- CS Status: :)
- Detinator server CS: Da
- Fond eXtream: 0
- Location: United Kingdom
- Has thanked: 2 times
- Been thanked: 1 time
Oamenii nu părăsesc oamenii pe care îi iubesc..ci părăsesc oameni pe care îi folosesc.
-
- Membru, skill 0
- Posts: 84
- Joined: 28 Oct 2022, 00:10
- Detinator Steam: Da
- CS Status: :)
- Detinator server CS: Da
- Fond eXtream: 0
- Location: United Kingdom
- Has thanked: 2 times
- Been thanked: 1 time
nu merg linkurile de download + este nevoie de toate resursele include etc..
Oamenii nu părăsesc oamenii pe care îi iubesc..ci părăsesc oameni pe care îi folosesc.
- Laurentiu P.
- Fost moderator
- Posts: 2551
- Joined: 10 Jul 2013, 21:26
- Detinator Steam: Da
- Reputatie: Fost super moderator
- Fond eXtream: 100
- Has thanked: 26 times
- Been thanked: 64 times
- Contact:
triviabot.sma
colorchat.inc
Code: Select all
/*
Fisier descarcat de pe www.celife.ro/forum !
Fisier tradus de LeThy !
Versiune plugin: 1.1
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <nvault>
#include <colorchat>
#define PLUGIN "Trivia Bot"
#define VERSION "1.1"
#define AUTHOR "Alka"
#define CharsMax(%1) sizeof %1 - 1
#define MAX_LINES 512
#define MAX_LEN 256
#define QUESTION_INTERVAL 15.0
#define QUESTION_INTERVAL_NUM 15
new List[2][MAX_LINES][MAX_LEN];
new Amount;
new Timer = QUESTION_INTERVAL_NUM;
new CurrentAnswer[128];
new bool:TriviaOnOff[33];
new TriviaPoints[33];
new const PluginTag[] = "[Fanatic.celife.ro]";
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say", "HookSay");
register_clcmd("say !top10", "ShowTriviaTop");
register_clcmd("say !triviatop10", "ShowTriviaTop");
register_clcmd("say !triviatop", "ShowTriviaTop");
register_clcmd("say !triviapoints", "ShowTriviaPoints");
register_clcmd("say !points", "ShowTriviaPoints");
set_task(1.0, "TimeRemainingCounter", 1111, "", 0, "b", 0);
}
public plugin_cfg()
{
new ConfigsDir[64], File[64];
new TriviaDir[64];
get_configsdir(ConfigsDir, CharsMax(ConfigsDir));
formatex(TriviaDir, CharsMax(TriviaDir), "%s/Trivia Bot", ConfigsDir);
formatex(File, CharsMax(File), "%s/trivia_list.ini", TriviaDir);
if(!dir_exists(TriviaDir))
mkdir(TriviaDir);
if(!file_exists(File))
write_file(File, "", -1);
new FilePointer = fopen(File, "rt");
new Buffer[512];
while(!feof(FilePointer))
{
fgets(FilePointer, Buffer, CharsMax(Buffer));
if(!Buffer[0] || Buffer[0] == ';' || strlen(Buffer) < 3)
continue;
trim(Buffer);
strtok(Buffer, List[0][Amount], sizeof List[][] - 1, List[1][Amount], sizeof List[][] - 1, ';', 0);
Amount++;
}
fclose(FilePointer);
server_print("%s Successfuly loaded %d lines from %s.", PluginTag, Amount, File);
ShowQuestion();
}
public ShowQuestion()
{
if(task_exists(2222))
remove_task(2222);
new RndNum = random(Amount);
formatex(CurrentAnswer, CharsMax(CurrentAnswer), List[1][RndNum]);
static Players[32], Num, Player;
get_players(Players, Num, "bh");
for(new i = 0 ; i < Num ; i++)
{
Player = Players[i];
if(!is_user_connected(Player))
continue;
if(!TriviaOnOff[Player])
continue;
ColorChat(Player, RED, "%s^x01%s", PluginTag, List[0][RndNum]);
}
Timer = QUESTION_INTERVAL_NUM - 1;
set_task(QUESTION_INTERVAL, "ShowQuestion", 2222, "", 0, "", 0);
}
public TimeRemainingCounter()
{
if(Timer < 0)
return;
static Players[32], Num, Player;
get_players(Players, Num, "bh");
for(new i = 0 ; i < Num ; i++)
{
Player = Players[i];
if(!is_user_connected(Player))
continue;
if(!TriviaOnOff[Player])
continue;
set_hudmessage(255, 255, 255, -1.0, 0.7, 0, 1.0, 0.8, 1.0, 1.0, 4);
show_hudmessage(Player, "%s Timp ramas pana la urmatoarea intrebare : %d", PluginTag, Timer);
}
Timer--;
}
public HookSay(id)
{
new Args[256];
read_args(Args, CharsMax(Args));
if(containi(Args, CurrentAnswer) != -1 && TriviaOnOff[id])
{
new RndNum = random(500);
ColorChat(id, RED, "%s^x01 Raspunsul tau a fost corect. Felicitari, ai castigat %d$", PluginTag, RndNum);
TriviaPoints[id] += 1;
if(is_user_connected(id))
cs_set_user_money(id, cs_get_user_money(id) + RndNum, 0);
ShowQuestion();
return 1;
}
else if(equali(Args, "^"/trivia^"", 9))
{
if(!TriviaOnOff[id])
{
ColorChat(id, RED, "%s^x04 Te-ai alaturat la Trivia, il poti juca cat timp esti mort!", PluginTag);
TriviaOnOff[id] = true;
}
else
{
ColorChat(id, RED, "%s^x04 Ai parasit Trivia, nu mai poti juca!", PluginTag);
TriviaOnOff[id] = false;
}
}
return 0;
}
public client_disconnect(id)
{
TriviaOnOff[id] = false;
if(TriviaPoints[id] != 1)
SavePoints(id);
}
public client_putinserver(id)
{
set_task(15.0, "ShowAdvMessage", id + 3333);
LoadPoints(id);
}
public ShowAdvMessage(index)
{
index -= 3333;
ColorChat(index, RED, "%s^x01 In timp ce esti mort poti juca Trivia si poti castiga bani! Tasteaza ^x04/trivia ^x01 in chat pentru activare.", PluginTag);
}
public SavePoints(index)
{
new Vault = nvault_open("trivia_points");
new Key[64], Value[64], Name[32];
get_user_name(index, Name, sizeof Name - 1);
formatex(Key, sizeof Key - 1, "%s-trivia_points:", Name);
formatex(Value, sizeof Value - 1, "%d", TriviaPoints[index]);
nvault_set(Vault, Key, Value);
nvault_close(Vault);
}
public LoadPoints(index)
{
new Vault = nvault_open("trivia_points");
new Key[64], Value[64], Name[32];
get_user_name(index, Name, sizeof Name - 1);
formatex(Key, sizeof Key - 1, "%s-trivia_points:", Name);
nvault_get(Vault, Key, Value, sizeof Value - 1);
nvault_close(Vault);
TriviaPoints[index] = str_to_num(Value);
}
public ShowTriviaTop(id)
{
static Sort[33][2];
new Count;
new Players[32], Num, Player;
get_players(Players, Num);
for(new i = 0 ; i < Num ; i++)
{
Player = Players[i];
Sort[Count][0] = Player;
Sort[Count][1] = TriviaPoints[Player];
Count++;
}
SortCustom2D(Sort, Count, "points_compare");
new Motd[1024], Len;
Len = format(Motd, sizeof Motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
Len += format(Motd[Len], (sizeof Motd - 1) - Len,"%s %-22.22s %3s^n", "#", "Name", "Trivia Points");
new b = clamp(Count, 0, 10);
new Name[32], User;
for(new a = 0; a < b; a++)
{
User = Sort[a][0];
get_user_name(User, Name, sizeof Name - 1);
Len += format(Motd[Len], (sizeof Motd - 1) - Len,"%d %-22.22s %d^n", a + 1, Name, Sort[a][1]);
}
Len += format(Motd[Len], (sizeof Motd - 1) - Len,"</body></font></pre>");
show_motd(id, Motd, "Trivia Top 10");
}
public points_compare(elem1[], elem2[])
{
if(elem1[1] > elem2[1])
return -1;
else if(elem1[1] < elem2[1])
return 1;
return 0;
}
public ShowTriviaPoints(id)
ColorChat(id, RED, "%s^x04 Aveti %d puncte trivia%s.", PluginTag, TriviaPoints[id], TriviaPoints[id] > 1 ? "s" : "");
Code: Select all
/* Fun functions
*
* by Numb
*
* This file is provided as is (no warranties).
*/
#if defined _colorchat_included
#endinput
#endif
#define _colorchat_included
enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
new message[256];
switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
// Make sure message is not longer than 192 character. Will crash the server.
message[192] = '^0';
new team, ColorChange, index, MSG_Type;
if(id)
{
MSG_Type = MSG_ONE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_ALL;
}
team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team]);
}
}
ShowColorMessage(id, type, message[])
{
static bool:saytext_used;
static get_user_msgid_saytext;
if(!saytext_used)
{
get_user_msgid_saytext = get_user_msgid("SayText");
saytext_used = true;
}
message_begin(type, get_user_msgid_saytext, _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[])
{
static bool:teaminfo_used;
static get_user_msgid_teaminfo;
if(!teaminfo_used)
{
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
teaminfo_used = true;
}
message_begin(type, get_user_msgid_teaminfo, _, id);
write_byte(id);
write_string(team);
message_end();
return 1;
}
ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:
{
return Team_Info(index, type, TeamName[2]);
}
case GREY:
{
return Team_Info(index, type, TeamName[0]);
}
}
return 0;
}
FindPlayer()
{
new i = -1;
while(i <= get_maxplayers())
{
if(is_user_connected(++i))
return i;
}
return -1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
no...
-
- Scripter eXtreamCS
- Posts: 924
- Joined: 02 Nov 2020, 01:57
- Detinator Steam: Da
- Fond eXtream: 0
- Discord: lexzor#0630
- Has thanked: 73 times
- Been thanked: 140 times
posteaza si in linkul cu pluginul te rog :DLaurentiu P. wrote: ↑23 Mar 2024, 06:35triviabot.smacolorchat.incCode: Select all
/* Fisier descarcat de pe www.celife.ro/forum ! Fisier tradus de LeThy ! Versiune plugin: 1.1 */ #include <amxmodx> #include <amxmisc> #include <cstrike> #include <nvault> #include <colorchat> #define PLUGIN "Trivia Bot" #define VERSION "1.1" #define AUTHOR "Alka" #define CharsMax(%1) sizeof %1 - 1 #define MAX_LINES 512 #define MAX_LEN 256 #define QUESTION_INTERVAL 15.0 #define QUESTION_INTERVAL_NUM 15 new List[2][MAX_LINES][MAX_LEN]; new Amount; new Timer = QUESTION_INTERVAL_NUM; new CurrentAnswer[128]; new bool:TriviaOnOff[33]; new TriviaPoints[33]; new const PluginTag[] = "[Fanatic.celife.ro]"; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("say", "HookSay"); register_clcmd("say !top10", "ShowTriviaTop"); register_clcmd("say !triviatop10", "ShowTriviaTop"); register_clcmd("say !triviatop", "ShowTriviaTop"); register_clcmd("say !triviapoints", "ShowTriviaPoints"); register_clcmd("say !points", "ShowTriviaPoints"); set_task(1.0, "TimeRemainingCounter", 1111, "", 0, "b", 0); } public plugin_cfg() { new ConfigsDir[64], File[64]; new TriviaDir[64]; get_configsdir(ConfigsDir, CharsMax(ConfigsDir)); formatex(TriviaDir, CharsMax(TriviaDir), "%s/Trivia Bot", ConfigsDir); formatex(File, CharsMax(File), "%s/trivia_list.ini", TriviaDir); if(!dir_exists(TriviaDir)) mkdir(TriviaDir); if(!file_exists(File)) write_file(File, "", -1); new FilePointer = fopen(File, "rt"); new Buffer[512]; while(!feof(FilePointer)) { fgets(FilePointer, Buffer, CharsMax(Buffer)); if(!Buffer[0] || Buffer[0] == ';' || strlen(Buffer) < 3) continue; trim(Buffer); strtok(Buffer, List[0][Amount], sizeof List[][] - 1, List[1][Amount], sizeof List[][] - 1, ';', 0); Amount++; } fclose(FilePointer); server_print("%s Successfuly loaded %d lines from %s.", PluginTag, Amount, File); ShowQuestion(); } public ShowQuestion() { if(task_exists(2222)) remove_task(2222); new RndNum = random(Amount); formatex(CurrentAnswer, CharsMax(CurrentAnswer), List[1][RndNum]); static Players[32], Num, Player; get_players(Players, Num, "bh"); for(new i = 0 ; i < Num ; i++) { Player = Players[i]; if(!is_user_connected(Player)) continue; if(!TriviaOnOff[Player]) continue; ColorChat(Player, RED, "%s^x01%s", PluginTag, List[0][RndNum]); } Timer = QUESTION_INTERVAL_NUM - 1; set_task(QUESTION_INTERVAL, "ShowQuestion", 2222, "", 0, "", 0); } public TimeRemainingCounter() { if(Timer < 0) return; static Players[32], Num, Player; get_players(Players, Num, "bh"); for(new i = 0 ; i < Num ; i++) { Player = Players[i]; if(!is_user_connected(Player)) continue; if(!TriviaOnOff[Player]) continue; set_hudmessage(255, 255, 255, -1.0, 0.7, 0, 1.0, 0.8, 1.0, 1.0, 4); show_hudmessage(Player, "%s Timp ramas pana la urmatoarea intrebare : %d", PluginTag, Timer); } Timer--; } public HookSay(id) { new Args[256]; read_args(Args, CharsMax(Args)); if(containi(Args, CurrentAnswer) != -1 && TriviaOnOff[id]) { new RndNum = random(500); ColorChat(id, RED, "%s^x01 Raspunsul tau a fost corect. Felicitari, ai castigat %d$", PluginTag, RndNum); TriviaPoints[id] += 1; if(is_user_connected(id)) cs_set_user_money(id, cs_get_user_money(id) + RndNum, 0); ShowQuestion(); return 1; } else if(equali(Args, "^"/trivia^"", 9)) { if(!TriviaOnOff[id]) { ColorChat(id, RED, "%s^x04 Te-ai alaturat la Trivia, il poti juca cat timp esti mort!", PluginTag); TriviaOnOff[id] = true; } else { ColorChat(id, RED, "%s^x04 Ai parasit Trivia, nu mai poti juca!", PluginTag); TriviaOnOff[id] = false; } } return 0; } public client_disconnect(id) { TriviaOnOff[id] = false; if(TriviaPoints[id] != 1) SavePoints(id); } public client_putinserver(id) { set_task(15.0, "ShowAdvMessage", id + 3333); LoadPoints(id); } public ShowAdvMessage(index) { index -= 3333; ColorChat(index, RED, "%s^x01 In timp ce esti mort poti juca Trivia si poti castiga bani! Tasteaza ^x04/trivia ^x01 in chat pentru activare.", PluginTag); } public SavePoints(index) { new Vault = nvault_open("trivia_points"); new Key[64], Value[64], Name[32]; get_user_name(index, Name, sizeof Name - 1); formatex(Key, sizeof Key - 1, "%s-trivia_points:", Name); formatex(Value, sizeof Value - 1, "%d", TriviaPoints[index]); nvault_set(Vault, Key, Value); nvault_close(Vault); } public LoadPoints(index) { new Vault = nvault_open("trivia_points"); new Key[64], Value[64], Name[32]; get_user_name(index, Name, sizeof Name - 1); formatex(Key, sizeof Key - 1, "%s-trivia_points:", Name); nvault_get(Vault, Key, Value, sizeof Value - 1); nvault_close(Vault); TriviaPoints[index] = str_to_num(Value); } public ShowTriviaTop(id) { static Sort[33][2]; new Count; new Players[32], Num, Player; get_players(Players, Num); for(new i = 0 ; i < Num ; i++) { Player = Players[i]; Sort[Count][0] = Player; Sort[Count][1] = TriviaPoints[Player]; Count++; } SortCustom2D(Sort, Count, "points_compare"); new Motd[1024], Len; Len = format(Motd, sizeof Motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>"); Len += format(Motd[Len], (sizeof Motd - 1) - Len,"%s %-22.22s %3s^n", "#", "Name", "Trivia Points"); new b = clamp(Count, 0, 10); new Name[32], User; for(new a = 0; a < b; a++) { User = Sort[a][0]; get_user_name(User, Name, sizeof Name - 1); Len += format(Motd[Len], (sizeof Motd - 1) - Len,"%d %-22.22s %d^n", a + 1, Name, Sort[a][1]); } Len += format(Motd[Len], (sizeof Motd - 1) - Len,"</body></font></pre>"); show_motd(id, Motd, "Trivia Top 10"); } public points_compare(elem1[], elem2[]) { if(elem1[1] > elem2[1]) return -1; else if(elem1[1] < elem2[1]) return 1; return 0; } public ShowTriviaPoints(id) ColorChat(id, RED, "%s^x04 Aveti %d puncte trivia%s.", PluginTag, TriviaPoints[id], TriviaPoints[id] > 1 ? "s" : "");
Code: Select all
/* Fun functions * * by Numb * * This file is provided as is (no warranties). */ #if defined _colorchat_included #endinput #endif #define _colorchat_included enum Color { NORMAL = 1, // clients scr_concolor cvar color GREEN, // Green Color TEAM_COLOR, // Red, grey, blue GREY, // grey RED, // Red BLUE, // Blue } new TeamName[][] = { "", "TERRORIST", "CT", "SPECTATOR" } ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...) { new message[256]; switch(type) { case NORMAL: // clients scr_concolor cvar color { message[0] = 0x01; } case GREEN: // Green { message[0] = 0x04; } default: // White, Red, Blue { message[0] = 0x03; } } vformat(message[1], 251, msg, 4); // Make sure message is not longer than 192 character. Will crash the server. message[192] = '^0'; new team, ColorChange, index, MSG_Type; if(id) { MSG_Type = MSG_ONE; index = id; } else { index = FindPlayer(); MSG_Type = MSG_ALL; } team = get_user_team(index); ColorChange = ColorSelection(index, MSG_Type, type); ShowColorMessage(index, MSG_Type, message); if(ColorChange) { Team_Info(index, MSG_Type, TeamName[team]); } } ShowColorMessage(id, type, message[]) { static bool:saytext_used; static get_user_msgid_saytext; if(!saytext_used) { get_user_msgid_saytext = get_user_msgid("SayText"); saytext_used = true; } message_begin(type, get_user_msgid_saytext, _, id); write_byte(id) write_string(message); message_end(); } Team_Info(id, type, team[]) { static bool:teaminfo_used; static get_user_msgid_teaminfo; if(!teaminfo_used) { get_user_msgid_teaminfo = get_user_msgid("TeamInfo"); teaminfo_used = true; } message_begin(type, get_user_msgid_teaminfo, _, id); write_byte(id); write_string(team); message_end(); return 1; } ColorSelection(index, type, Color:Type) { switch(Type) { case RED: { return Team_Info(index, type, TeamName[1]); } case BLUE: { return Team_Info(index, type, TeamName[2]); } case GREY: { return Team_Info(index, type, TeamName[0]); } } return 0; } FindPlayer() { new i = -1; while(i <= get_maxplayers()) { if(is_user_connected(++i)) return i; } return -1; } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par } */