CSSERVERS Vote

Pluginuri pentru modul AmxModX.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
User avatar
LondoN eXtream
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2908
Joined: 10 Oct 2014, 05:21
Detinator Steam: Da
SteamID: /id/london_extreamcs
Reputatie: Scripter eXtreamCS
Moderator ajutator
Membru Club eXtreamCS (6 luni)
Fond eXtream: 0
Location: Roman, Neamț
Has thanked: 2 times
Been thanked: 3 times

16 Jan 2019, 16:05

Descriere: Cu acest plugin, jucatorii de pe server, pot vota serverul pe www.csservers.ro si a va mari rating-ul/voturile astfel incat sa castigati dropuri/jucatori. Pluginul verifica automat daca a dat un vot real pe site si ofera si un bonus. [Momentan pentru ZM, dar il puteti modifica pentru alte moduri]. Nu raspund daca nu functioneaza la cei ce au guarduri. Pe steam functioneaza fara nicio problema.

Descarcare:
csservers_vote | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <regex>
#include <httpx>

#define PLUGIN	"CSSERVERS Vote"
#define VERSION	"2.2"
#define AUTHOR	"LondoN eXtream"

#define REGEX_STRING	"voturi-azi^">(.*?)</a>"

native zp_get_user_ammo_packs(Player);
native zp_set_user_ammo_packs(Player, Packs);

new g_CurrentVotes, g_LastVotes;
new g_PlayerID;
new g_CvarServer;
new g_MaxPlayers;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);

	register_clcmd("say /vote", "VoteazaServer");

	g_CvarServer = register_cvar("csservers_server", "zm.darkland.ro");
	g_MaxPlayers = get_maxplayers();

	set_task(120.0, "VerificaOnline", .flags="b");

	set_task(120.0, "PrintMessage", .flags="b");
}

public PrintMessage()	Print(0, "^x04[BONUS]^x01 Daca doresti^x03 200^x01 Ammo Packs tasteaza^x04 /vote^x01 si voteaza serverul!");

public VerificaOnline()
{
	// Stocam voturile actuale
	new Server[32], URL[256];
	get_pcvar_string(g_CvarServer, Server, charsmax(Server));
	formatex(URL, charsmax(URL), "http://www.csservers.ro/evidenta/%s", Server);
	HTTPX_Download(URL, _, _, "SalveazaVoturile");
}	

public VoteazaServer(Player)
{
	// Stocam voturile actuale
	new Server[32], URL[256];
	get_pcvar_string(g_CvarServer, Server, charsmax(Server));
	formatex(URL, charsmax(URL), "http://www.csservers.ro/evidenta/%s", Server);
	HTTPX_Download(URL, _, _, "SalveazaVoturile");

	// Afisam pagina de votare
	formatex(URL, charsmax(URL), "http://www.csservers.ro/voteaza/%s", Server);
	show_motd(Player, URL);

	// Stocam jucatorul
	g_PlayerID = Player;

	// Verificam din nou peste ceva timp
	set_task(25.0, "VerificaVoturile", Player);
}

public SalveazaVoturile(DownloadID)
{
	new g_Buffer[1024], g_Error[64], g_Votes[16], iVotes, iNum;
	new Regex:Voturi;

	while(HTTPX_GetData(g_Buffer, charsmax(g_Buffer)))
	{
		Voturi = regex_match(g_Buffer, REGEX_STRING, iNum, g_Error, charsmax(g_Error));

		if(Voturi)
		{
			regex_substr(Voturi, 1, g_Votes, charsmax(g_Votes));
			iVotes = str_to_num(g_Votes);

			g_LastVotes = iVotes;
		
			server_print("[CSSERVERS] Serverul are %d voturi", iVotes);

			regex_free(Voturi);
		}
	}
}

public VerificaVoturile(Player)
{
	new g_Server[32], URL[256];
	get_pcvar_string(g_CvarServer, g_Server, charsmax(g_Server));
	formatex(URL, charsmax(URL), "http://www.csservers.ro/evidenta/%s", g_Server);

	new DownloadID = HTTPX_Download(URL, _, _, "VoturiCurente");
	HTTPX_SetCustom(DownloadID, Player);
}

public VoturiCurente(DownloadID)
{
	new g_Buffer[1024], g_Error[64], g_Votes[16], iVotes, iNum;
	new Regex:Voturi;

	while(HTTPX_GetData(g_Buffer, charsmax(g_Buffer)))
	{
		Voturi = regex_match(g_Buffer, REGEX_STRING, iNum, g_Error, charsmax(g_Error));

		if(Voturi)
		{
			regex_substr(Voturi, 1, g_Votes, charsmax(g_Votes));
			iVotes = str_to_num(g_Votes);

			g_CurrentVotes = iVotes;

			if(g_CurrentVotes > g_LastVotes)
			{
				new Player = g_PlayerID;

				if(!(1 <= Player <= g_MaxPlayers))
					return;

				zp_set_user_ammo_packs(Player, zp_get_user_ammo_packs(Player) + 200);
				Print(Player, "^x04[CSSERVERS]^x01 Felicitari! Ai votat serverul si ai primit^x03 200^x01 Ammo Packs");
			}

			regex_free(Voturi);
		}
	}
}

stock Print(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players);
				write_string(msg);
				message_end();
			}
		}
	}
}


Nume: CSSERVERS VOTE
Versiune: 2.2
Autor: LondoN eXtream (credite Bugsy, JoCanys, BlackRose from alliedmodders)

Instalare:
1. Fisierul csservers_vote.sma il puneti in addons/amxmodx/scripting
2. Fisierul csservers_vote.amxx il puneti in addons/amxmodx/plugins
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:

Code: Select all

csservers_vote.amxx
4. Pentru a putea rula aveti nevoie de instalarea HTTP:X

Cvar-uri (se adauga in fisierul amxmodx\configs\amxx.cfg):
  • csservers_server "zm.darkland.ro" -> inlocuiti cu serverul vostru
Module necesare (se sterge ; din fata modulului de mai jos; acestea le gasiti in fisierul amxmodx\configs\modules.ini):
- REGEX

Imagini:
Image
IG-BOOST.org - Instagram Followers Best, Cheap, Reliable
User avatar
# DeaLeR.
Super moderator
Super moderator
Posts: 1578
Joined: 13 Feb 2016, 16:52
Detinator Steam: Da
CS Status: Connection lost
Reputatie: Super moderator
Fost Membru Club eXtreamCS ( o luna )
Fond eXtream: 0
Location: Mediaş, Sibiu, România
Has thanked: 1 time
Been thanked: 4 times
Contact:

01 Mar 2019, 20:22

Poti sa faci o versiune cu bani?
Post Reply

Return to “AmxModX”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests