Cerere Life Menu Pe Credite

Categoria cu cereri de pluginuri si nu numai.

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 .
mamamea123
Membru, skill +1
Membru, skill +1
Posts: 103
Joined: 31 Jul 2013, 15:40
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 19 times
Been thanked: 1 time
Contact:

13 Sep 2013, 14:13

Vreau Si Eu Un Life Menu Pe credite Va Rog si sa pot modifica eu cu cat sa cumpar etc
RoyalServer 2
mamamea123
Membru, skill +1
Membru, skill +1
Posts: 103
Joined: 31 Jul 2013, 15:40
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 19 times
Been thanked: 1 time
Contact:

13 Sep 2013, 14:17

Esti tu sigur ca am spus cati fac???? Esti .... Oke cum vor ei sa ma ajute sau nu
User avatar
n0talaMa
Membru, skill +1
Membru, skill +1
Posts: 242
Joined: 10 Mar 2013, 11:36
Detinator Steam: Da
SteamID: Privat !!!
Location: Rominia
Has thanked: 9 times

13 Sep 2013, 14:18

vrei o poza cu ce ai zis??? :)) cred ca nu vrei =))
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

13 Sep 2013, 14:25

| Afiseaza codul
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < nvault >

#define PLUGIN_NAME      "Life-Shop"
#define PLUGIN_VERSION   "1.0"
#define PLUGIN_AUTHOR   "ExoTiQ"

#define MAXPLAYERS             32
#define MAX_STATS_SAVED         64

#define LIFE_COST               10  // Pretul cand cumperi viata
#define LIFE_SELL               5  // Pretul cand vinzi viata
#define LIFE_LIMIT               50  // Limita maxima vietilor in menu.

new g_Life[ MAXPLAYERS + 1 ]
new gName[ MAXPLAYERS ]
new vKey[ MAX_STATS_SAVED ]
new vData[ MAX_STATS_SAVED ]

native get_user_credits( id );
native set_user_credits( id, cantitate );

new gVault

public plugin_init ( )
{
	register_plugin ( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
	
	register_event( "DeathMsg", "EV_DeathMsg", "a" )
	register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged");
	register_clcmd("say /vieti", "Life_Shop")
	register_clcmd("say /life", "Life_Shop")
}

public client_connect( id )
	load_client_Life( id )

public client_disconnect( id )
	save_client_Life( id )


public EV_DeathMsg() {
	new iVictim = read_data( 2 );
	new iTeam = get_user_team( iVictim );
	new iKiller = read_data( 1 );
	
	if( iKiller != iVictim && get_user_team(iKiller) != iTeam ) {
		Life_Shop( iVictim )
	}
	
}
public Life_Shop( id ) 
{
	new szText[ 1024 char ];
	
	formatex( szText, charsmax( szText ), "\yAveti\w: \r%d\y $^nAveti\w: \r%d\y vieti" ,get_user_credits(id) , g_Life[id] );
	
	new menu = menu_create( szText, "Life_handler" );
	
	formatex( szText, charsmax( szText ), "Cumpara 1 viata \y-  \w%d\y $" ,LIFE_COST);
	menu_additem( menu, szText, "1", 0 );
	
	
	formatex( szText, charsmax( szText ), "Vinde 1 viata \y+ \w%d\y $" ,LIFE_SELL);
	menu_additem( menu, szText, "2", 0 );
	
	formatex( szText, charsmax( szText ), "Foloseste \y- \r1\w Viata" );
	menu_additem( menu, szText, "3", 0 );
	
	menu_setprop(menu, MPROP_EXITNAME, "Iesire")
	
	menu_display(id, menu, 0)
}

public Life_handler (id , menu , item ) {
	
	if (item == MENU_EXIT)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	new s_Data[6], s_Name[64], i_Access, i_Callback
	
	menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
	
	new i_Key = str_to_num(s_Data)
	
	
	new bani = get_user_credits(id)
	
	switch(i_Key)
	{
		case 1:
		{
			if (bani < LIFE_COST)
			{
				Color_Print(id,  "!g[Life-Menu] !yNu ai destui bani pentru a cumpara !gviata." )            
				return PLUGIN_HANDLED
			}
			
			if ( g_Life[id] >= LIFE_LIMIT )
			{
				Color_Print(id,  "!g[Life-Menu] !yAi ajuns la limita !gmaxima." )
				return PLUGIN_HANDLED
			}
			
			Color_Print(id,  "!g[Life-Menu] !yAi cumparat !g1 Viata")
			
			g_Life[id] += 1
			
			set_user_credits(id, bani - LIFE_COST)
			Life_Shop( id ) 
		}
		case 2:
		{
			if ( g_Life[id] == 0 )
			{
				Color_Print(id,  "!g[Life-Menu] !yNu ai nici o !gviata.")
				return PLUGIN_HANDLED
			}
			
			Color_Print(id,  "!g[Life-Menu] !yAi vandut !g1 Viata.")
			
			g_Life[id] -= 1
			
			set_user_credits(id, bani + LIFE_SELL)
			Life_Shop( id ) 
		}
		case 3:
		{
			if ( is_user_alive( id ) )
			{
				Color_Print(id,  "!g[Life-Menu] !yTrebuie sa fii !gmort !y, pentru a folosi viata.")
				return PLUGIN_HANDLED
			}
			
			if ( g_Life[id] == 0 )
			{
				Color_Print(id,  "!g[Life-Menu] !yNu ai nici o !gviata.")
				return PLUGIN_HANDLED
			}
			
			g_Life[id] -= 1
			
			Color_Print(id,  "!g[Life-Menu] !yAi folosit !g1 viata si ai primit !grespawn.")
			
			ExecuteHam(Ham_CS_RoundRespawn, id)
		}
	}
	menu_destroy(menu)
	return PLUGIN_HANDLED
}
stock save_client_Life( index )
{
	gVault = nvault_open( "Life_Save" )
	
	if( gVault == INVALID_HANDLE )
	{
		set_fail_state( "[Life-Shop] nValut ERROR: =-> Invalid-Handle" )
	}
	
	get_user_name( index, gName, charsmax( gName ) )
	//get_user_name(index,gName,32);
	
	formatex( vKey, charsmax( vKey ), "%sLife",gName )
	formatex( vData, charsmax( vData ), "%d", g_Life[ index ] )
	nvault_set( gVault, vKey, vData )
	nvault_close( gVault )
}

stock load_client_Life( index )
{
	gVault = nvault_open( "Life_Save" )
	
	if( gVault == INVALID_HANDLE )
	{
		set_fail_state( "[Life-Shop] nValut ERROR: =-> Invalid-Handle" )
	}
	
	get_user_name( index, gName, charsmax( gName ) )
	//get_user_name(index,gName,32);
	
	formatex( vKey, charsmax( vKey ), "%sLife",gName )
	g_Life[ index ] = nvault_get( gVault, vKey )
	nvault_close( gVault )
}

public fwClientUserInfoChanged(id, buffer) {
	if (!is_user_connected(id)) {
		return FMRES_IGNORED;
	}
	static val[32];
	static name[32];
	get_user_name(id, name, 31);
	engfunc(EngFunc_InfoKeyValue, buffer, "name", val, sizeof val- 1);
	if (equal(val, name)) {
		return FMRES_IGNORED;
	}
	engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", name);
	Color_Print(id,  "!g[Life-Menu] !teamNU este permisa schimbarea nick-ului pe server !")
	console_print(id,"NU este permisa schimbarea nick-ului pe server !");
	return PLUGIN_HANDLED;
}

stock Color_Print(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!team", "^3") // Team Color
	
	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();
			}
		}
	}
}

Code: Select all

#define LIFE_COST               10  // Pretul cand cumperi viata
#define LIFE_SELL               5  // Pretul cand vinzi viata
#define LIFE_LIMIT               50  // Limita maxima vietilor in menu.
E pe credite (deposit_money.amxx) al lui Aragon* !
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
User avatar
KrAiD.
Fost moderator
Fost moderator
Posts: 866
Joined: 15 Jun 2013, 12:14
Detinator Steam: Da
CS Status: Cat de cat activ :D
Detinator server CS: Nu
Reputatie: Fost Moderator ajutator
0.7 / 3
Has thanked: 14 times
Been thanked: 131 times
Contact:

13 Sep 2013, 14:26

cu toate ca nu sti sa vorbesti , vorbesti cam urat nu ar trebui sa te ajut ...
| Afiseaza codul
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < nvault >

#define PLUGIN_NAME      "Life-Shop"
#define PLUGIN_VERSION   "1.0"
#define PLUGIN_AUTHOR   "ExoTiQ"

#define MAXPLAYERS             32
#define MAX_STATS_SAVED         64

#define LIFE_COST               50  // Pretul cand cumperi viata
#define LIFE_SELL               20  // Pretul cand vinzi viata
#define LIFE_LIMIT               50  // Limita maxima vietilor in menu.

new g_Life[ MAXPLAYERS + 1 ]
new gName[ MAXPLAYERS ]
new vKey[ MAX_STATS_SAVED ]
new vData[ MAX_STATS_SAVED ]

native get_user_credits( id );
native set_user_credits( id, cantitate );

new gVault

public plugin_init ( )
{
	register_plugin ( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
	
	register_event( "DeathMsg", "EV_DeathMsg", "a" )
	register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged");
	register_clcmd("say /vieti", "Life_Shop")
	register_clcmd("say /life", "Life_Shop")
}

public client_connect( id )
	load_client_Life( id )

public client_disconnect( id )
	save_client_Life( id )


public EV_DeathMsg() {
	new iVictim = read_data( 2 );
	new iTeam = get_user_team( iVictim );
	new iKiller = read_data( 1 );
	
	if( iKiller != iVictim && get_user_team(iKiller) != iTeam ) {
		Life_Shop( iVictim )
	}
	
}
public Life_Shop( id ) 
{
	new szText[ 1024 char ];
	
	formatex( szText, charsmax( szText ), "\yAveti\w: \r%d\y $^nAveti\w: \r%d\y vieti" ,get_user_credits(id) , g_Life[id] );
	
	new menu = menu_create( szText, "Life_handler" );
	
	formatex( szText, charsmax( szText ), "Cumpara 1 viata \y-  \w%d\y $" ,LIFE_COST);
	menu_additem( menu, szText, "1", 0 );
	
	
	formatex( szText, charsmax( szText ), "Vinde 1 viata \y+ \w%d\y $" ,LIFE_SELL);
	menu_additem( menu, szText, "2", 0 );
	
	formatex( szText, charsmax( szText ), "Foloseste \y- \r1\w Viata" );
	menu_additem( menu, szText, "3", 0 );
	
	menu_setprop(menu, MPROP_EXITNAME, "Iesire")
	
	menu_display(id, menu, 0)
}

public Life_handler (id , menu , item ) {
	
	if (item == MENU_EXIT)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	new s_Data[6], s_Name[64], i_Access, i_Callback
	
	menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
	
	new i_Key = str_to_num(s_Data)
	
	
	new bani = get_user_credits(id)
	
	switch(i_Key)
	{
		case 1:
		{
			if (bani < LIFE_COST)
			{
				Color_Print(id,  "!g[Life-Menu] !yNu ai destui bani pentru a cumpara !gviata." )            
				return PLUGIN_HANDLED
			}
			
			if ( g_Life[id] >= LIFE_LIMIT )
			{
				Color_Print(id,  "!g[Life-Menu] !yAi ajuns la limita !gmaxima." )
				return PLUGIN_HANDLED
			}
			
			Color_Print(id,  "!g[Life-Menu] !yAi cumparat !g1 Viata")
			
			g_Life[id] += 1
			
			set_user_credits(id, bani - LIFE_COST)
			Life_Shop( id ) 
		}
		case 2:
		{
			if ( g_Life[id] == 0 )
			{
				Color_Print(id,  "!g[Life-Menu] !yNu ai nici o !gviata.")
				return PLUGIN_HANDLED
			}
			
			Color_Print(id,  "!g[Life-Menu] !yAi vandut !g1 Viata.")
			
			g_Life[id] -= 1
			
			set_user_credits(id, bani + LIFE_SELL)
			Life_Shop( id ) 
		}
		case 3:
		{
			if ( is_user_alive( id ) )
			{
				Color_Print(id,  "!g[Life-Menu] !yTrebuie sa fii !gmort !y, pentru a folosi viata.")
				return PLUGIN_HANDLED
			}
			
			if ( g_Life[id] == 0 )
			{
				Color_Print(id,  "!g[Life-Menu] !yNu ai nici o !gviata.")
				return PLUGIN_HANDLED
			}
			
			g_Life[id] -= 1
			
			Color_Print(id,  "!g[Life-Menu] !yAi folosit !g1 viata si ai primit !grespawn.")
			
			ExecuteHam(Ham_CS_RoundRespawn, id)
		}
	}
	menu_destroy(menu)
	return PLUGIN_HANDLED
}
stock save_client_Life( index )
{
	gVault = nvault_open( "Life_Save" )
	
	if( gVault == INVALID_HANDLE )
	{
		set_fail_state( "[Life-Shop] nValut ERROR: =-> Invalid-Handle" )
	}
	
	get_user_name( index, gName, charsmax( gName ) )
	//get_user_name(index,gName,32);
	
	formatex( vKey, charsmax( vKey ), "%sLife",gName )
	formatex( vData, charsmax( vData ), "%d", g_Life[ index ] )
	nvault_set( gVault, vKey, vData )
	nvault_close( gVault )
}

stock load_client_Life( index )
{
	gVault = nvault_open( "Life_Save" )
	
	if( gVault == INVALID_HANDLE )
	{
		set_fail_state( "[Life-Shop] nValut ERROR: =-> Invalid-Handle" )
	}
	
	get_user_name( index, gName, charsmax( gName ) )
	//get_user_name(index,gName,32);
	
	formatex( vKey, charsmax( vKey ), "%sLife",gName )
	g_Life[ index ] = nvault_get( gVault, vKey )
	nvault_close( gVault )
}

public fwClientUserInfoChanged(id, buffer) {
	if (!is_user_connected(id)) {
		return FMRES_IGNORED;
	}
	static val[32];
	static name[32];
	get_user_name(id, name, 31);
	engfunc(EngFunc_InfoKeyValue, buffer, "name", val, sizeof val- 1);
	if (equal(val, name)) {
		return FMRES_IGNORED;
	}
	engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", name);
	Color_Print(id,  "!g[Life-Menu] !teamNU este permisa schimbarea nick-ului pe server !")
	console_print(id,"NU este permisa schimbarea nick-ului pe server !");
	return PLUGIN_HANDLED;
}

stock Color_Print(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!team", "^3") // Team Color
	
	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();
			}
		}
	}
}
mamamea123
Membru, skill +1
Membru, skill +1
Posts: 103
Joined: 31 Jul 2013, 15:40
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 19 times
Been thanked: 1 time
Contact:

13 Sep 2013, 14:30

mersi kraid tot respectu si imi cer scuze :P
mamamea123
Membru, skill +1
Membru, skill +1
Posts: 103
Joined: 31 Jul 2013, 15:40
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 19 times
Been thanked: 1 time
Contact:

13 Sep 2013, 14:38

Va rog eu datimi amxx ca nu mg sal copilez
User avatar
KrAiD.
Fost moderator
Fost moderator
Posts: 866
Joined: 15 Jun 2013, 12:14
Detinator Steam: Da
CS Status: Cat de cat activ :D
Detinator server CS: Nu
Reputatie: Fost Moderator ajutator
0.7 / 3
Has thanked: 14 times
Been thanked: 131 times
Contact:

13 Sep 2013, 14:40

poftim Click!
User avatar
R1kKk-
Membru, skill +1
Membru, skill +1
Posts: 178
Joined: 12 Apr 2013, 16:57
Detinator Steam: Da
CS Status: Batman!
Detinator server CS: HNS.JOINET.RO
SteamID: Privat...
Has thanked: 20 times
Been thanked: 17 times
Contact:

13 Sep 2013, 17:02

mamamea123 wrote:Va rog eu datimi amxx ca nu mg sal copilez
E foarte greu sa compilezi un plugin...

Daca ai addons ai in amxmodx/scripting fisierul compile.exe.
Tii click-ul pe fisierul .sma pe care vrei sa il compilezi si il tragi in compile.exe . Aceasta va face amxx-ul in folderul compiled.(mentionez ca fisierul .sma trebuie sa fie in folderul scripting.)

Iar daca iti da eroare, iti arata acolo mura-n gura de ce nu merge, doar ca tre sa stii si ceva engleza :-/ /:)
Last edited by R1kKk- on 13 Sep 2013, 17:10, edited 1 time in total.
Image Image Image
User avatar
R1kKk-
Membru, skill +1
Membru, skill +1
Posts: 178
Joined: 12 Apr 2013, 16:57
Detinator Steam: Da
CS Status: Batman!
Detinator server CS: HNS.JOINET.RO
SteamID: Privat...
Has thanked: 20 times
Been thanked: 17 times
Contact:

13 Sep 2013, 17:02

scuze, citat in loc de edit...
Last edited by R1kKk- on 13 Sep 2013, 17:10, edited 1 time in total.
Image Image Image
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 825
Joined: 01 Oct 2012, 02:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

13 Sep 2013, 17:06

Iar daca esti prost foloseste butonu' de EDIT, mamamea123 lafel ai buton de edit.

@R1kKk- Pe forumu asta exista niste reguli O_o Ai buton de EDIT iti fac video tutorial daca nu sti unde este plasat ;)
Last edited by FlyingSnow on 13 Sep 2013, 19:30, edited 1 time in total.
User avatar
R1kKk-
Membru, skill +1
Membru, skill +1
Posts: 178
Joined: 12 Apr 2013, 16:57
Detinator Steam: Da
CS Status: Batman!
Detinator server CS: HNS.JOINET.RO
SteamID: Privat...
Has thanked: 20 times
Been thanked: 17 times
Contact:

13 Sep 2013, 17:09

Din greseala am dat citat, si prost esti tu poate.
Tu faci off doar pentru a te afla in treaba altora.
Image Image Image
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests