GOLD System [1.0]

Pluginuri pentru modul AmxModX.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

User avatar
Challenger.
Fost moderator
Fost moderator
Posts: 2548
Joined: 07 Dec 2014, 14:32
Detinator Steam: Da
Reputatie: Fost Super Moderator
Nume anterior: whisTle
Puncte: 1.7 / 3
Fond eXtream: 0
Contact:

14 Jun 2015, 12:10

Foarte frumos !
Ar trebui sa mai adaugi sa primeasca gold pentru plantare/explodare/dezamorsare bomba :) !
NU sunt intermediar.

Dacă ai nevoie de ajutor pe forum dă-mi un PM şi rezolvăm.

REGULAMENT FORUM

RECLAMAȚII MODERATORI

RECLAMAȚII PM
Activitate scăzută
Rapidserver
User avatar
Raluuu
Membru, skill +1
Membru, skill +1
Posts: 186
Joined: 08 Nov 2014, 10:54
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

14 Jun 2015, 12:58

Si ce faci cu goldu acumulat?
Image
User avatar
Challenger.
Fost moderator
Fost moderator
Posts: 2548
Joined: 07 Dec 2014, 14:32
Detinator Steam: Da
Reputatie: Fost Super Moderator
Nume anterior: whisTle
Puncte: 1.7 / 3
Fond eXtream: 0
Contact:

14 Jun 2015, 13:00

Raluuu wrote:Si ce faci cu goldu acumulat?
Nu faci nimic.
Pe baza acestui plugin poti face altele !
NU sunt intermediar.

Dacă ai nevoie de ajutor pe forum dă-mi un PM şi rezolvăm.

REGULAMENT FORUM

RECLAMAȚII MODERATORI

RECLAMAȚII PM
Activitate scăzută
User avatar
-BlacKodE-
Super moderator
Super moderator
Posts: 1185
Joined: 16 Nov 2013, 11:57
Detinator Steam: Da
SteamID: blackode
Reputatie: Super moderator
Membru Club eXtreamCS (1 luna)
Fost Membru Club eXtreamCS (5 apr - 5 mai - acces in club)
Location: Pascani
Has thanked: 16 times
Been thanked: 10 times

14 Jun 2015, 16:51

Uitati un mic update daca va place :)))

Am adaugat sa primiti gold si pe damage-ul produs.
| Afiseaza codul
#include <amxmodx>
// Some special includes
#include <hamsandwich>
#include <nvault>
#include <colorchat>

new const PLUGIN [] = "Gold System";
new const VERSION [] = "1.1";
new const AUTHOR [] = "LordOfNothing";

/* g var */

new cvar,gold_dmg,savegold,gold[33];


public plugin_init()
{
	register_plugin(PLUGIN,VERSION,AUTHOR);
	
	/*	Some Cvars :	*/
	cvar = register_cvar("gold_kill","600");
	gold_dmg = register_cvar("gold_dmg","20"); // cat dmg este necesar ca sa pimesti 1 gold	
	
	/*	Some Events :	*/
	RegisterHam(Ham_Spawn, "player", "GoldKill", 1);
	register_event("Damage", "GoldDmg", "b", "2!=0")
	
	/*	Show Your gold command		*/
	register_clcmd("say /gold","GoldCmd");
	register_clcmd("say_team /gold","GoldCmd");

	/* 	Save Gold	*/
	savegold = nvault_open("goldvault");
}

public plugin_natives()
{
	register_native("get_user_gold","_get_gold");
	register_native("set_user_gold","_set_gold");
}

public _get_gold(plugin, params)
{
	return gold[get_param(1)];
}

public _set_gold(plugin, params)
{
	new client = get_param(1);
	gold[client] = max(0, get_param(2));
	return gold[client];
}


public SaveGold(id)
{
	new PlayerName[35];
	get_user_authid(id,PlayerName,34);
	
	new vaultkey[64],vaultdata[256];
	format(vaultkey,63,"%s",PlayerName);
	format(vaultdata,255,"%i",gold[id]);
	nvault_set(savegold,vaultkey,vaultdata);
	return PLUGIN_CONTINUE;
}

public LoadGold(id)
{
	new PlayerName[35];
	get_user_authid(id,PlayerName,34);
	
	new vaultkey[64],vaultdata[256];
	format(vaultkey,63,"%s",PlayerName);
	nvault_get(savegold,vaultkey,vaultdata,255);
	
	replace_all(vaultdata, 255, " ", " ");
	
	new playerlives[33];
	
	parse(vaultdata, playerlives, 31);
	
	gold[id] = str_to_num(playerlives);
	
	return PLUGIN_CONTINUE;
}

public GoldKill(victim,attacker,shouldgib)
{
	if(!attacker || attacker == victim)
		return PLUGIN_HANDLED;
	
	gold[attacker] += get_pcvar_num(cvar);
	return PLUGIN_CONTINUE
}

public GoldDmg(id)
{
	new damage = read_data(2)
	new attacker = get_user_attacker(id)	

	if(kid==id || !kid || !is_user_alive(kid)) return PLUGIN_HANDLED

	while(damage>=get_pcvar_num(gold_dmg))
        {
		damage-=get_pcvar_num(gold_dmg)
		gold[attacker]+=1
	}

	return PLUGIN_CONTINUE
}

public GoldCmd(id)
{
	ColorChat(id, RED, "[GOLD] ^4You have %i gold !",gold[id]);
	return;
}
public client_authorized(id)
{
	LoadGold(id);
}

public client_disconnect(id)
{
	SaveGold(id);
}
User avatar
Challenger.
Fost moderator
Fost moderator
Posts: 2548
Joined: 07 Dec 2014, 14:32
Detinator Steam: Da
Reputatie: Fost Super Moderator
Nume anterior: whisTle
Puncte: 1.7 / 3
Fond eXtream: 0
Contact:

14 Jun 2015, 17:53

<-|EviL|-> wrote:Uitati un mic update daca va place :)))

Am adaugat sa primiti gold si pe damage-ul produs.
| Afiseaza codul
#include <amxmodx>
// Some special includes
#include <hamsandwich>
#include <nvault>
#include <colorchat>

new const PLUGIN [] = "Gold System";
new const VERSION [] = "1.1";
new const AUTHOR [] = "LordOfNothing";

/* g var */

new cvar,gold_dmg,savegold,gold[33];


public plugin_init()
{
	register_plugin(PLUGIN,VERSION,AUTHOR);
	
	/*	Some Cvars :	*/
	cvar = register_cvar("gold_kill","600");
	gold_dmg = register_cvar("gold_dmg","20"); // cat dmg este necesar ca sa pimesti 1 gold	
	
	/*	Some Events :	*/
	RegisterHam(Ham_Spawn, "player", "GoldKill", 1);
	register_event("Damage", "GoldDmg", "b", "2!=0")
	
	/*	Show Your gold command		*/
	register_clcmd("say /gold","GoldCmd");
	register_clcmd("say_team /gold","GoldCmd");

	/* 	Save Gold	*/
	savegold = nvault_open("goldvault");
}

public plugin_natives()
{
	register_native("get_user_gold","_get_gold");
	register_native("set_user_gold","_set_gold");
}

public _get_gold(plugin, params)
{
	return gold[get_param(1)];
}

public _set_gold(plugin, params)
{
	new client = get_param(1);
	gold[client] = max(0, get_param(2));
	return gold[client];
}


public SaveGold(id)
{
	new PlayerName[35];
	get_user_authid(id,PlayerName,34);
	
	new vaultkey[64],vaultdata[256];
	format(vaultkey,63,"%s",PlayerName);
	format(vaultdata,255,"%i",gold[id]);
	nvault_set(savegold,vaultkey,vaultdata);
	return PLUGIN_CONTINUE;
}

public LoadGold(id)
{
	new PlayerName[35];
	get_user_authid(id,PlayerName,34);
	
	new vaultkey[64],vaultdata[256];
	format(vaultkey,63,"%s",PlayerName);
	nvault_get(savegold,vaultkey,vaultdata,255);
	
	replace_all(vaultdata, 255, " ", " ");
	
	new playerlives[33];
	
	parse(vaultdata, playerlives, 31);
	
	gold[id] = str_to_num(playerlives);
	
	return PLUGIN_CONTINUE;
}

public GoldKill(victim,attacker,shouldgib)
{
	if(!attacker || attacker == victim)
		return PLUGIN_HANDLED;
	
	gold[attacker] += get_pcvar_num(cvar);
	return PLUGIN_CONTINUE
}

public GoldDmg(id)
{
	new damage = read_data(2)
	new attacker = get_user_attacker(id)	

	if(kid==id || !kid || !is_user_alive(kid)) return PLUGIN_HANDLED

	while(damage>=get_pcvar_num(gold_dmg))
        {
		damage-=get_pcvar_num(gold_dmg)
		gold[attacker]+=1
	}

	return PLUGIN_CONTINUE
}

public GoldCmd(id)
{
	ColorChat(id, RED, "[GOLD] ^4You have %i gold !",gold[id]);
	return;
}
public client_authorized(id)
{
	LoadGold(id);
}

public client_disconnect(id)
{
	SaveGold(id);
}
Poti adauga si pentru plantat/dezamorsat/explodat bomba ?
NU sunt intermediar.

Dacă ai nevoie de ajutor pe forum dă-mi un PM şi rezolvăm.

REGULAMENT FORUM

RECLAMAȚII MODERATORI

RECLAMAȚII PM
Activitate scăzută
User avatar
LondoN eXtream
Utilizator neserios
Utilizator neserios
Posts: 2703
Joined: 10 Oct 2014, 05:21
Detinator Steam: Da
SteamID: /id/london_extreamcs
Reputatie: Utilizator neserios
Fost scripter eXtreamCS
Fost moderator ajutator
Membru Club eXtreamCS (6 luni)
Fond eXtream: 0
Location: Roman, Neamț
Has thanked: 2 times
Been thanked: 4 times

14 Jun 2015, 18:29

| Afiseaza codul
public GoldKill(victim,attacker,shouldgib)
{
	if(!attacker || attacker == victim)
		return PLUGIN_HANDLED;
	
	gold[attacker] += get_pcvar_num(cvar);
	return PLUGIN_CONTINUE
}
==>>
| Afiseaza codul
public GoldKill() {
	new attacker, victim
	attacker = read_data(1)
	victim = read_data(2)
	if(attacker == victim) {
		return;
	}
	gold[attacker] += get_pcvar_num(cvar)
}
User avatar
FaTzZu
Fost moderator
Fost moderator
Posts: 1206
Joined: 22 Dec 2012, 18:37
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 114 times
Been thanked: 168 times
Contact:

16 Jun 2015, 07:40

LoNNNDoNNN wrote:
| Afiseaza codul
public GoldKill(victim,attacker,shouldgib)
{
	if(!attacker || attacker == victim)
		return PLUGIN_HANDLED;
	
	gold[attacker] += get_pcvar_num(cvar);
	return PLUGIN_CONTINUE
}
==>>
| Afiseaza codul
public GoldKill() {
	new attacker, victim
	attacker = read_data(1)
	victim = read_data(2)
	if(attacker == victim) {
		return;
	}
	gold[attacker] += get_pcvar_num(cvar)
}
Vezi ca nu este DeathMsg event , este functia

Code: Select all

RegisterHam(Ham_Spawn, "player", "GoldKill", 1);
A fool's brain digests philosophy into folly, science into superstition, and art into pedantry.

#RETIRED.
*Or!g!naL*
Fost moderator
Fost moderator
Posts: 1363
Joined: 16 Feb 2014, 16:28
Detinator Steam: Nu
CS Status: N-avem!
Detinator server CS: Zm.Darkcs.ro
Reputatie: Fost moderator ajutator
Has thanked: 3 times
Been thanked: 1 time

18 Aug 2015, 08:06

LordOfNothing wrote:
HamletEagle wrote:Uite o idee: foloseste modulul regex ca sa verifici daca are steam,atunci faci salvarea pe steam,altfel salvezi pe nume. Daca nu stii cum sa faci,zi si te ajut cu placere.
sa primesc ajutor de la incepatori ? , nu mersi !

si nu trebuie regex ca sa fac salvarea pe steam :)))

in functiie LoadGold si SaveGold pot inlocui get_user_name cu get_user_authid :)))
daca era mai avansat poate stiai si tu :))

Code: Select all

sa primesc ajutor de la incepatori ? , nu mersi !
CLAR =)))))))))
mi se pare inutil :))) De ce ? sunt o multime de astfel de pluginuri pe aici asa ca ...
Inactiv pana dupa bac.
User avatar
MzQ*
Membru eXtream
Membru eXtream
Posts: 3419
Joined: 07 Jul 2014, 17:30
Detinator Steam: Da
Fond eXtream: 0
Location: R.Moldova
Has thanked: 3 times
Been thanked: 3 times
Contact:

18 Aug 2015, 09:11

*Or!g!naL* wrote:
LordOfNothing wrote:
HamletEagle wrote:Uite o idee: foloseste modulul regex ca sa verifici daca are steam,atunci faci salvarea pe steam,altfel salvezi pe nume. Daca nu stii cum sa faci,zi si te ajut cu placere.
sa primesc ajutor de la incepatori ? , nu mersi !

si nu trebuie regex ca sa fac salvarea pe steam :)))

in functiie LoadGold si SaveGold pot inlocui get_user_name cu get_user_authid :)))
daca era mai avansat poate stiai si tu :))

Code: Select all

sa primesc ajutor de la incepatori ? , nu mersi !
CLAR =)))))))))
mi se pare inutil :))) De ce ? sunt o multime de astfel de pluginuri pe aici asa ca ...
macar uitate in ce an a spus Lord ala cuvintele ca Hamlet e incepator
User avatar
HamletEagle
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 750
Joined: 21 Sep 2013, 14:05
Detinator Steam: Da
CS Status: Inactiv cateva zile.
SteamID: privat
Reputatie: Scripter eXtreamCS.com
Fost Moderator ajutator
Has thanked: 19 times
Been thanked: 86 times

18 Aug 2015, 10:49

Lord vorbea aiurea, imi pare rau ca n-am vazut topicul la timp ca sa ii raspund. get_user_authid poate returna si steam id lan/valve id lan, deci steamid-ul nu o sa fie valid. Poti sa faci un pattern cu regex ca sa scapi de acesta problema, si sa iei doar playeri cu steam. Se poate si fara regex, insa trebuie sa verifici manual fiecare caz in care steamid-ul poate sa fie invalid, si e o munca inutila. In perioada aia imi dadea pm-uri pe allied sa ma intrebe diverse(cu contul ala fals al lui) iar aici zicea ca-s incepator :))
Daca vreti ajutorul meu, nu dati bump la topic, fara intrebari de genu "cat mai dureaza/mai astept mult?".
User avatar
The Kalu
eXtream Mod
eXtream Mod
Posts: 12716
Joined: 09 Oct 2010, 11:39
Detinator Steam: Da
CS Status: In grajd!
SteamID: kalulord
Reputatie: Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra
Location: Romania, Ploiesti
Has thanked: 207 times
Been thanked: 418 times
Contact:

18 Aug 2015, 10:50

HamletEagle wrote:Lord vorbea aiurea, imi pare rau ca n-am vazut topicul la timp ca sa ii raspund. get_user_authid poate returna si steam id lan/valve id lan, deci steamid-ul nu o sa fie valid. Poti sa faci un pattern cu regex ca sa scapi de acesta problema, si sa iei doar playeri cu steam. In perioada aia imi dadea pm-uri pe allied sa ma intrebe diverse(cu contul ala fals al lui) iar aici zicea ca-s incepator :))
Hamlet asta copia de pe allied, gasisem eu postul original de unde se inspirase.Te facea pe tine incepator cand el copia, doamne ce copil. :troll
User avatar
IonutJrrBoOoM
Membru, skill +1
Membru, skill +1
Posts: 124
Joined: 01 Aug 2015, 13:02
Detinator Steam: Nu
CS Status: niku-l meu e -sNk- # - MasteR Nu ionutjr
Detinator server CS: In curand ...
SteamID: Nu am deocamdata..
Fond eXtream: 0
Location: Resita
Contact:

25 Sep 2015, 16:25

@Turbo e author-ul sistemului de gold
| Afiseaza codul
http://www.extreamcs.com/forum/amxmodx/ ... 99119.html
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <nvault>

#define MSG_PAS 5
#define MSG_BROADCAST 0
#define MSG_PVS 4
#define MSG_ONE_UNRELIABLE 8
#define MSG_ALL 2
#define MSG_ONE 1

// Credite
new PlayerGold[10000]
new Vault, savegold;

// Tag
new const TAG[] = "FURIEN";


public plugin_init()
{
	register_plugin("Gold System", "1.0", "Turbo")
		
	savegold = register_cvar("fr_save_gold", "1");
	register_concmd("amx_gold", "cmdGive", ADMIN_RCON, "Name - Amount");
	register_concmd("amx_remove_gold", "Reset_Gold", ADMIN_RCON, "Name");
	register_clcmd("say /gold","Show_Golds")
	register_clcmd("say /golds","Show_Golds")
}

public plugin_natives() {
	register_native("get_user_gold", "get_user_gold", 1);
	register_native("set_user_gold", "set_user_gold", 1);
}
public set_user_gold(id, gold) {
	
	PlayerGold[id] = gold;
	SaveGold(id)
}
public get_user_gold(id) {
	
	return PlayerGold[id]
}
public client_putinserver(id) {
	
	LoadGold(id)
}
public client_authorized(id) {
	
	LoadGold(id)
}
public client_connected(id) {
	
	LoadGold(id)
}
public client_disconnect(id) {
	
	SaveGold(id)
}
public Show_Golds(id) {
         color(id, "^x03[FURIEN]^x04 Ai^x03 %d^x04 Golds.", PlayerGold[id]);
         return PLUGIN_HANDLED;
}
public SaveGold(id) {
	
	Vault = nvault_open("DepozitGold");
	new data_gold[256], key_gold[64];
	switch( get_pcvar_num(savegold) ) { 
		case 1:  { 
			new name[33];
			get_user_name(id,name,32);
			format(key_gold, 63, "%s-/", name);
		}
		case 2: {
			new player_ip[33];
			get_user_ip(id,player_ip,32);
			format(key_gold, 63, "%s-/", player_ip);
		}
		case 3: {
			new steam_ID[33];
			get_user_authid(id,steam_ID,32);
			format(key_gold, 63, "%s-/", steam_ID);
		}
	}
	format(data_gold, 255, "%i#", PlayerGold[id]);
	nvault_set(Vault, key_gold, data_gold);
	return PLUGIN_CONTINUE;
}

public LoadGold(id) {
	Vault = nvault_open("DepozitGold");
	new data_gold[256], key_gold[64];
	switch( get_pcvar_num(savegold) )  { 
		case 1:  { 
			new name[33];
			get_user_name(id,name,32);
			format(key_gold, 63, "%s-/", name);
		}
		case 2: {
			new player_ip[33];
			get_user_ip(id,player_ip,32);
			format(key_gold, 63, "%s-/", player_ip);
		}
		case 3: {
			new steam_ID[33];
			get_user_authid(id,steam_ID,32);
			format(key_gold, 63, "%s-/", steam_ID);
		}
	}
	format(data_gold, 255, "%i#", PlayerGold[id]);
	nvault_get(Vault, key_gold, data_gold, 255);
	replace_all(data_gold, 255, "#", " ");
	
	new Gold[32];
	parse(data_gold, Gold, 31);
	PlayerGold[id] = str_to_num(Gold);
	return PLUGIN_CONTINUE;
} 

public cmdGive(id, level, cid)
{
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED;
	}
	
	new arg[32], name[32];
	read_argv(1, arg, 31)
	get_user_name(id, name, 31)
	
	new jucator = cmd_target(id, arg, 31)
	
	if(!jucator)
	{
		return PLUGIN_HANDLED
	}
	
	if(!is_user_connected(jucator))
	{
		return PLUGIN_HANDLED
	}
	
	new cant[4]
	read_argv(2, cant, 3)
	new golds = str_to_num(cant)
	PlayerGold[jucator] += golds
	color(id, ".v[%s].g Adminul.v %s.g ti-a dat.v %d.g puncte .vGold", TAG, name, golds)
	return PLUGIN_HANDLED;
}
public Reset_Gold(id, level, cid) {
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED;
	}
	
	new arg[32], name[32];
	read_argv(1, arg, 31)
	get_user_name(id, name, 31)
	
	new jucator = cmd_target(id, arg, 31)
	if(!jucator)
	{
		return PLUGIN_HANDLED
	}
	if(!is_user_connected(jucator))
	{
		return PLUGIN_HANDLED
	}
	PlayerGold[jucator] = 0
	color(id, ".v[%s].g Adminul.v %s.g ti-a luat toate punctele .vGold", TAG, name)
	return PLUGIN_HANDLED;
}

stock color(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, ".v", "^4")
	replace_all(msg, 190, ".g", "^1")
	replace_all(msg, 190, ".e", "^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();
		}
	}
}
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
- Y.M. snk_hacker
Skype. adam.ionut17
Server. preferat de cs 1.6
- Fury.evils.Ro | XP MOD CSO
Image
Image
Post Reply

Return to “AmxModX”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests