Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Potrzebuje pomocynie moge skomplikowac


  • Zamknięty Temat jest zamknięty
8 odpowiedzi w tym temacie

#1 bogery15

    Profesjonalista

  • Zbanowany

Reputacja: -3
Nowy

  • Postów:202
  • Lokalizacja:Polska
Offline

Napisano 01.05.2010 20:45

Potrzebuje osoby ktora skomplikuje mi to:
nazwa pluginu: zp_bank.amxx

KOD .sma
// ZP Bank - allows saving of ammo packs
/*	cvars

zp_bank 1				//<0/1> set whether plugin enabled or not
zp_bank_limit 1000000	//maximium storage capacity of each person's account
zp_bank_blockstart 1	//<0/1> set whether bank blocks zombie plague from giving the initial 5 ammo packs on start if user has an account

*/

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
#include <zombieplague>

static const version[] = "0.3";
static const plugin[] = "ZP Bank";

enum pcvar
{
	enable = 0,
	cap,
	start
}
new pcvars[pcvar];
new bankstorage[33];

new gvault, thinkobj;

public plugin_init()
{
	register_plugin(plugin, version, "Random1");
	
	gvault = nvault_open("Zombie Bank");
	
	pcvars[enable] =			register_cvar("zp_bank", "1");
	pcvars[cap] =				register_cvar("zp_bank_limit", "1000000");
	pcvars[start] =				register_cvar("zp_bank_blockstart", "1");
	
	if ( get_pcvar_num(pcvars[cap]) > 2147483646 )
	{
		set_pcvar_num(pcvars[cap], 2147483646);
		server_print("[%s] Due to a 32 bit restriction in perl zp_ammo_limit reset based on restriction", plugin);
	}
	
	register_clcmd("say", "handle_say");
	register_clcmd("say_team", "handle_say");
	
	thinkobj = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
	if ( pev_valid(thinkobj) )
	{
		set_pev(thinkobj, pev_classname, "advertisement_loop");
		set_pev(thinkobj, pev_nextthink, get_gametime() + 240.0);
		register_forward(FM_Think, "fourmin_think");
	}
}
public fourmin_think(ent)
{
	if ( ent != thinkobj ) return FMRES_IGNORED;
	
	if ( !get_pcvar_num(pcvars[enable]) ) return FMRES_IGNORED;
	
	client_print(0, print_chat, "[%s]Enabled. %d To maksymalna liczba ammo w banku", plugin, get_pcvar_num(pcvars[cap]));
	client_print(0, print_chat, "[%s] Aby Wplacic Ammo do banku wpisz ^"\wplac <Liczba ammo>^".", plugin);
	client_print(0, print_chat, "[%s] Aby Wyplacic Ammo z Banku Wpisz ^"\wyplac <liczba ammo>^"", plugin);
	
	set_pev(ent, pev_nextthink, get_gametime() + 240.0);
	
	return FMRES_HANDLED;	
}
public plugin_end()
	nvault_close(gvault);
	
public handle_say(id)
{
	if ( !get_pcvar_num(pcvars[enable]) ) return PLUGIN_CONTINUE;
	
	new text[70], arg1[32], arg2[32], arg3[6];
	read_args(text, sizeof(text)-1);
	remove_quotes(text);
	arg1[0] = '^0';
	arg2[0] = '^0';
	arg3[0] = '^0';
	parse(text, arg1, sizeof(arg1)-1, arg2, sizeof(arg2)-1, arg3, sizeof(arg3)-1);
	//dbg_log("cmd_say() arg1:#%s# arg2:#%s# arg3:#%s#", arg1, arg2, arg3);

	// if the chat line has more than 2 words, we're not interested at all
	if (arg3[0] == 0)
	{
		//strip forward slash if present
		if ( equali(arg1, "/", 1) ) format(arg1, 31, arg1[1]);
		
		if ( equali(arg1, "wplac", 7) || equali(arg1, "send", 4) || equali(arg1, "store", 5) )
		{
			if ( isdigit(arg2[0]) || (arg2[0] == '-' && isdigit(arg2[1])) ) 
			{
				new value = str_to_num(arg2);
				store_cash(id, value);
				return PLUGIN_HANDLED;
			}
			else if ( equali(arg2, "all") )
			{
				store_cash(id, -1);
				return PLUGIN_HANDLED;
			}				
			else if ( arg2[0] == 0 )
				client_print(id, print_chat, "[%s] Zeby Wlozyc Ammo Paki do banku wpisz \wplac <Liczba ammo>", plugin);
			
			return PLUGIN_CONTINUE;
		}
		else if ( equali(arg1, "wyplac", 8) || equali(arg1, "take", 4) || equali(arg1, "retrieve", 8) )
		{
			if ( isdigit(arg2[0]) || (arg2[0] == '-' && isdigit(arg2[1])) ) 
			{
				new value = str_to_num(arg2);
				take_cash(id, value);
				return PLUGIN_HANDLED;
			}
			else if ( equali(arg2, "all") )
			{
				take_cash(id, -1);
				return PLUGIN_HANDLED;
			}
			else if ( arg2[0] == 0 )
				client_print(id, print_chat, "[%s]Zeby Wyplacic Ammo Paki z banku wpisz \wyplac <Liczba Ammo>", plugin);
			
			return PLUGIN_CONTINUE;
		}
		else if ( equali(arg1, "mybank", 6) || equali(arg1, "account", 7) || equali(arg1, "bank", 4) )
		{
			if ( arg2[0] == 0 ) {
				client_print(id, print_chat, "[%s]  w swoim Banku Ammo pakow masz %d ammo ",plugin, bankstorage[id]);
				return PLUGIN_HANDLED;
			}
			else {
				new player = cmd_target(id,arg2,2);
				if ( !player ) return PLUGIN_CONTINUE;
				client_print(id, print_chat, "[%s] %s posiada %d ammo pakow", plugin, arg2, bankstorage[player]);
				return PLUGIN_HANDLED;
			}
		}
	}
	else if ( equali( arg1, "donate", 6 ) )
	{
		give_cmd(id, arg2, arg3);
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}
give_cmd(id, target[], amnt[])
{
	new temp = str_to_num(amnt);
	if ( temp < 0 )
	{
		client_print(id, print_chat, "[%s] The ^"amount^" argument passed is negative, either overflowed or your trying to cheat", plugin );
		return;
	}
	new player = cmd_target(id, target, 8);
	if ( !player ) return;
	
	new temp2 = bankstorage[id] + zp_get_user_ammo_packs(id);
	if ( temp > temp2 )
	{
		client_print(id, print_chat, "[%s] Nie masz wystarczajaco ammo pakow zeby dac , masz ammo %d out dla %d specified",plugin,
			temp2, temp);
		
		return;
	}
	static playername[32], givename[32];
	get_user_name(player, playername, 31);
	get_user_name(id, givename, 31);
	client_print(id, print_chat, "[%s] You just donated %d ammo packs to %s", plugin, temp, playername);
	client_print(player, print_chat, "[%s] %s just donated %d ammo packs dla ciebie", plugin, givename, temp);
	bankstorage[player] += temp;
	if ( bankstorage[id] > temp ) bankstorage[id] -= temp;
	else
	{
		temp -= bankstorage[id];
		bankstorage[id] = 0;
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - temp);
	}
}
//public zp_user_disconnect_pre(id)
public client_disconnect(id)
	if ( bankstorage[id] > 0 ) save_data(id);

//public zp_user_connect_post(id)
public client_connect(id)
{	
	bankstorage[id] = 0;	//clear residual before loading
	retrieve_data(id);
}

store_cash(id, amnt)
{
	if ( !get_pcvar_num(pcvars[enable]) ) return;
	
	if ( amnt == -1 )
	{
		bankstorage[id] += zp_get_user_ammo_packs(id);
		zp_set_user_ammo_packs(id, 0);
		checkmax(id);
	}
	else if ( amnt > 0 )
	{		
		new temp = zp_get_user_ammo_packs(id);
		new limit = get_pcvar_num(pcvars[cap]);
		if ( temp >= amnt )
		{			
			if ( bankstorage[id] + amnt <= limit )
			{
				bankstorage[id] += amnt
				zp_set_user_ammo_packs(id, temp - amnt);
			}
			else
			{
				new overflow = bankstorage[id] + amnt - limit;
				bankstorage[id] = limit;
				zp_set_user_ammo_packs(id, temp - amnt + overflow);
				client_print(id, print_chat, "[%s] Your bank account has reached it's maximium capacity of %d", plugin, limit);
				client_print(id, print_chat, "[%s] Only %d of the %d you specified to wplac has been deposited", plugin,
				amnt - overflow, amnt);
			}
		}
		else
			client_print(id, print_chat, "[%s] Amount specified(%d) is greater than current ammo pack count(%d)", plugin,
			amnt, temp);			
	}
	else
		take_cash(id, -amnt);
}

take_cash(id, amnt)
{
	if ( !get_pcvar_num(pcvars[enable]) ) return;
	
	if ( amnt == 0 ) return;	//otherwise a non terminal loop is possible
	
	if ( amnt == -1 )
	{
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + bankstorage[id])
		bankstorage[id] = 0;
	}
	else if ( amnt > 0 )
	{
		if ( bankstorage[id] >= amnt )
		{
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + amnt);
			bankstorage[id] -= amnt;
		}
		else {
			client_print(id, print_chat, "[%s] Amount specified(%d) is greater than whats in bank(%d)", plugin,
			amnt, bankstorage[id]);		
		}	
	}
	else store_cash(id, -amnt);
}

save_data(id)
{
	new AuthID[35];
	get_user_authid(id,AuthID,34);
	new vaultkey[40],vaultdata[13];
	
	formatex( vaultkey, 39, "__%s__", AuthID);
	formatex( vaultdata, 12, "%i", bankstorage[id] );

	nvault_set(gvault, vaultkey, vaultdata); 
}

retrieve_data(id)
{
	new AuthID[35]; 
	get_user_authid(id,AuthID,34); 
	new vaultkey[40], vaultdata[13]; 
	
	format(vaultkey, 39, "__%s__", AuthID);

	nvault_get(gvault, vaultkey, vaultdata, 12); 
		
	bankstorage[id] = str_to_num(vaultdata);
	checkmax(id);	
	
	// If they have an account don't allow zombie mod to give them 5 ammo packs at beggining
	if ( get_pcvar_num(pcvars[start]) && bankstorage[id] > 0 ) 
		zp_set_user_ammo_packs(id, 0);
}

checkmax(id)
{
	if ( bankstorage[id] > get_pcvar_num(pcvars[cap]) )
		bankstorage[id] = get_pcvar_num(pcvars[cap]);
		
	else if ( bankstorage[id] < 0 )
		bankstorage[id] = 0;
}


#2 Kusek

    z Wikipedii

  • Power User

Reputacja: 446
Wszechobecny

  • Postów:1 655
  • Imię:Krystian
Offline

Napisano 01.05.2010 20:50

łap pan :)

Załączone pliki


  • +
  • -
  • 0

#3 bogery15

    Profesjonalista

  • Autor tematu
  • Zbanowany

Reputacja: -3
Nowy

  • Postów:202
  • Lokalizacja:Polska
Offline

Napisano 01.05.2010 21:01

a moge wiedzieć gdzie to komplikujesz? bo ja chcialem tutaj:
AMX Mod X - Half-Life Scripting for Pros!
i gdy chce skomplikowac wyskakuje mi:
Your plugin failed to compile! Read the errors below:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/groups/amxmodx/tmp3/textjIpdvP.sma(14) : fatal error 100: cannot read from file: "zombieplague"

Compilation aborted.
1 Error.


#4 Change

    Super Hero

  • Użytkownik

Reputacja: 129
Zaawansowany

  • Postów:1 161
  • Lokalizacja:Konin
Offline

Napisano 01.05.2010 21:11

Musisz lokalnie z

#include <zombieplague>

w includach :)

Użytkownik Change edytował ten post 01.05.2010 21:12

  • +
  • -
  • 0

#5 Kusek

    z Wikipedii

  • Power User

Reputacja: 446
Wszechobecny

  • Postów:1 655
  • Imię:Krystian
Offline

Napisano 01.05.2010 21:13

tak jak kolega wyżej napisał, brakuje Ci
#include <zombieplague>

pobierz sobie zombie plague z forum, i tam masz scripting i wypakuj go do swojego scripting :)
  • +
  • -
  • 0

#6 bogery15

    Profesjonalista

  • Autor tematu
  • Zbanowany

Reputacja: -3
Nowy

  • Postów:202
  • Lokalizacja:Polska
Offline

Napisano 01.05.2010 21:14

co? a gdzie to dodac, aha juz ide szukac ;d

a gdzie to znajde? mozesz zapodać linka ^^? bo w szukaj duzo bardzo wyskoczylo

Użytkownik bogery15 edytował ten post 01.05.2010 21:16


#7 Abes Mapper

    Repulsion Gel

  • Przyjaciel

Reputacja: 2 017
Godlike

  • Postów:7 356
  • Steam:steam
  • Imię:Sebastian
  • Lokalizacja:Sulejówek
Offline

Napisano 01.05.2010 21:27

1. Ściągnij AMX Mod X Base i wypakuj na pulpit.
2. Ściągnij Counter-Strike Addon i wypakuj na pulput (tak aby nadpisać folder z pkt. 1)
3. Oczywiście ściągnij to pod windowsa
4. Wejdź do addons/amxmodx/scripting i tam wrzucasz wszystkie .sma i inne pliki a potem włączasz plik compile.exe
  • +
  • -
  • 0

#8 hardbot

    Banned

  • Zbanowany

Reputacja: 0
Nowy

  • Postów:3 049
Offline

Napisano 01.05.2010 23:34

Proszę tutaj w załączinku masz

#include <zombieplauge>

wklejasz to do scripting

Załączone pliki



#9 bogery15

    Profesjonalista

  • Autor tematu
  • Zbanowany

Reputacja: -3
Nowy

  • Postów:202
  • Lokalizacja:Polska
Offline

Napisano 02.05.2010 05:20

Wkleilem to i nic!! To moj caly amx studio! pomozcie mi z tym ;P

02 maj 2010 - 05:37:
ok juz dziala do zamkniecia




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych