Cerere plugin: Life system [REZOLVAT].

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

User avatar
roberteeel
Membru eXtream
Membru eXtream
Posts: 4438
Joined: 05 Sep 2012, 11:39
Detinator Steam: Nu
Reputatie: Nick anterior: QAZW, Robert.ultrasFarul, CT 18 ROS
Restrictie schimbare nume
Fost moderator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 313 times
Been thanked: 357 times

27 Jan 2014, 13:56

As dori si eu un plugin de life. Dupa ce mori, sa iti apara un meniu:

1. Cumpara o viata (14000$).
2. Foloseste viata.
3. Vinde o viata (5000$).

Deasupra la astea sa-ti apara: Ai x vieti.

Sa poti folosi doar o viata pe runda.
Foloseam plugin-ul lui ExotiQ, dar nu permitea schimbarea nick-ului pe server si l-am scos.
Vreau sa poti sa-ti schimbi numele.
Last edited by roberteeel on 27 Jan 2014, 22:30, edited 3 times in total.
RoyalServer 2
#Vali
Fost moderator
Fost moderator
Posts: 2611
Joined: 24 Jan 2012, 11:00
Detinator Steam: Da
SteamID: id/spryt3
Reputatie: Fost Moderator
Fost Scripter eXtreamCS.com
1.2 / 3
Location: root
Has thanked: 81 times
Been thanked: 144 times
Contact:

27 Jan 2014, 14:02

QAZW wrote:As dori si eu un plugin de life. Dupa ce mori, sa iti apara un meniu:

1. Cumpara o viata (14000$).
2. Foloseste viata.
3. Vinde o viata (5000$).

Deasupra la astea sa-ti apara: Ai x vieti.

Sa poti folosi doar o viata pe runda.
Foloseam plugin-ul lui ExotiQ, dar nu permitea schimbarea nick-ului pe server si l-am scos.
Vreau sa poti sa-ti schimbi numele.
Posteaza ala al lui Exo si iti scot eu restrictia
User avatar
roberteeel
Membru eXtream
Membru eXtream
Posts: 4438
Joined: 05 Sep 2012, 11:39
Detinator Steam: Nu
Reputatie: Nick anterior: QAZW, Robert.ultrasFarul, CT 18 ROS
Restrictie schimbare nume
Fost moderator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 313 times
Been thanked: 357 times

27 Jan 2014, 14:05

| Afiseaza codul
/*
*   Plugin facut la cerere , Forum : cereri-cs/idei-pluginuri-t24614-900.html
*    Plugin: Life-Shop
*    Versiunea: 1.0
*    Author: ExoTiQ
*
*    Multumesc lui Bos93 pentru o metoda noua.
*    Functia cu Anti-Change Nick am folosit de la spuf.
*    Am folosit alt Stock de culori pentru ca vechi facea probleme.
*/

#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

#if cellbits ==                   32 
#define OFFSET_CSMONEY       115 
#else 
#define OFFSET_CSMONEY       140 
#endif 

#define OFFSET_LINUX             5

#define LIFE_COST               8000
#define LIFE_SELL               5000
#define LIFE_LIMIT               50

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

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" ,fm_cs_get_user_money(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 = fm_cs_get_user_money(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
         
         fm_cs_set_user_money(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
         
         fm_cs_set_user_money(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 folosit 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 fm_cs_set_user_money(id, money, flash = 1) 
{ 
   set_pdata_int(id, OFFSET_CSMONEY, money, OFFSET_LINUX)
   
   message_begin(MSG_ONE, get_user_msgid("Money"), {0,0,0}, id)
   write_long(money)
   write_byte(flash)
   message_end()
}

stock fm_cs_get_user_money(id) 
   return get_pdata_int(id, OFFSET_CSMONEY, OFFSET_LINUX)


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();
      }
   }
}
}
#Vali
Fost moderator
Fost moderator
Posts: 2611
Joined: 24 Jan 2012, 11:00
Detinator Steam: Da
SteamID: id/spryt3
Reputatie: Fost Moderator
Fost Scripter eXtreamCS.com
1.2 / 3
Location: root
Has thanked: 81 times
Been thanked: 144 times
Contact:

27 Jan 2014, 14:09

| Afiseaza codul
/*
*   Plugin facut la cerere , Forum : cereri-cs/idei-pluginuri-t24614-900.html
*    Plugin: Life-Shop
*    Versiunea: 1.0
*    Author: ExoTiQ
*
*    Multumesc lui Bos93 pentru o metoda noua.
*    Functia cu Anti-Change Nick am folosit de la spuf.
*    Am folosit alt Stock de culori pentru ca vechi facea probleme.
*/

#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

#if cellbits ==                   32 
#define OFFSET_CSMONEY       115 
#else 
#define OFFSET_CSMONEY       140 
#endif 

#define OFFSET_LINUX             5

#define LIFE_COST               8000
#define LIFE_SELL               5000
#define LIFE_LIMIT               50

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

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" ,fm_cs_get_user_money(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 = fm_cs_get_user_money(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
			
			fm_cs_set_user_money(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
			
			fm_cs_set_user_money(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 folosit 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 )
}
stock fm_cs_set_user_money(id, money, flash = 1) 
	{ 
	set_pdata_int(id, OFFSET_CSMONEY, money, OFFSET_LINUX)
	
	message_begin(MSG_ONE, get_user_msgid("Money"), {0,0,0}, id)
	write_long(money)
	write_byte(flash)
	message_end()
}

stock fm_cs_get_user_money(id) 
	return get_pdata_int(id, OFFSET_CSMONEY, OFFSET_LINUX)


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();
			}
		}
	}
}
User avatar
roberteeel
Membru eXtream
Membru eXtream
Posts: 4438
Joined: 05 Sep 2012, 11:39
Detinator Steam: Nu
Reputatie: Nick anterior: QAZW, Robert.ultrasFarul, CT 18 ROS
Restrictie schimbare nume
Fost moderator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 313 times
Been thanked: 357 times

27 Jan 2014, 14:14

Poti pune sa poti folosi viata doar o data pe runda?
#Vali
Fost moderator
Fost moderator
Posts: 2611
Joined: 24 Jan 2012, 11:00
Detinator Steam: Da
SteamID: id/spryt3
Reputatie: Fost Moderator
Fost Scripter eXtreamCS.com
1.2 / 3
Location: root
Has thanked: 81 times
Been thanked: 144 times
Contact:

27 Jan 2014, 14:17

| Afiseaza codul
/*
*   Plugin facut la cerere , Forum : cereri-cs/idei-pluginuri-t24614-900.html
*    Plugin: Life-Shop
*    Versiunea: 1.0
*    Author: ExoTiQ
*
*    Multumesc lui Bos93 pentru o metoda noua.
*    Functia cu Anti-Change Nick am folosit de la spuf.
*    Am folosit alt Stock de culori pentru ca vechi facea probleme.
*/

#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

#if cellbits ==                   32 
#define OFFSET_CSMONEY       115 
#else 
#define OFFSET_CSMONEY       140 
#endif 

#define OFFSET_LINUX             5

#define LIFE_COST               8000
#define LIFE_SELL               5000
#define LIFE_LIMIT               50

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

new gVault
new limita[33]

public plugin_init ( )
	{
	register_plugin ( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
	
	register_event( "DeathMsg", "EV_DeathMsg", "a" )
	register_logevent("runda_noua", 2, "1=Round_Start")
	register_clcmd("say /vieti", "Life_Shop")
	register_clcmd("say /life", "Life_Shop")
}
public runda_noua(id)
{
	for(new i=1;i<=sizeof(limita);i++)
	{
		limita = 0;
	}
	return PLUGIN_CONTINUE;
}
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" ,fm_cs_get_user_money(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 = fm_cs_get_user_money(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
			
			fm_cs_set_user_money(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
			
			fm_cs_set_user_money(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 folosit viata.")
				return PLUGIN_HANDLED
			}
			
			if ( g_Life[id] == 0 )
				{
				Color_Print(id,  "!g[Life-Menu] !yNu ai nici o !gviata.")
				return PLUGIN_HANDLED
			}
			if(limita[id] >= 1)
			{
				Color_Print(id,  "!g[Life-Menu] !yPoti folosi doar o viata pe runda.")
				return PLUGIN_HANDLED;
			}
			g_Life[id] -= 1
			
			Color_Print(id,  "!g[Life-Menu] !yAi folosit !g1 viata si ai primit !grespawn.")
			limita[id] +=1;
			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 )
}
stock fm_cs_set_user_money(id, money, flash = 1) 
	{ 
	set_pdata_int(id, OFFSET_CSMONEY, money, OFFSET_LINUX)
	
	message_begin(MSG_ONE, get_user_msgid("Money"), {0,0,0}, id)
	write_long(money)
	write_byte(flash)
	message_end()
}

stock fm_cs_get_user_money(id) 
	return get_pdata_int(id, OFFSET_CSMONEY, OFFSET_LINUX)


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();
			}
		}
	}
}
gino21gino2004
Membru, skill 0
Membru, skill 0
Posts: 49
Joined: 06 Feb 2008, 16:20
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: strike.cs16.ro
Location: giurgiu
Has thanked: 1 time

27 Jan 2014, 14:54

ai putea aduga sa poti sa dai viata la un coechipier :) /revive cost 5000
am o problema in plus cand imi dau viata ma da neutru si pot omor orce jucator plus dupa ce mor ma pune spec
Last edited by gino21gino2004 on 27 Jan 2014, 15:05, edited 1 time in total.
#Vali
Fost moderator
Fost moderator
Posts: 2611
Joined: 24 Jan 2012, 11:00
Detinator Steam: Da
SteamID: id/spryt3
Reputatie: Fost Moderator
Fost Scripter eXtreamCS.com
1.2 / 3
Location: root
Has thanked: 81 times
Been thanked: 144 times
Contact:

27 Jan 2014, 15:02

gino21gino2004 wrote:ai putea aduga sa poti sa dai viata la un coechipier :) /revive cost 5000
Pai se poate vinde viata nu inteleg ce vrei sa respawnezi tu un coechipier cu viata ta?
gino21gino2004
Membru, skill 0
Membru, skill 0
Posts: 49
Joined: 06 Feb 2008, 16:20
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: strike.cs16.ro
Location: giurgiu
Has thanked: 1 time

27 Jan 2014, 15:07

em am testat acest plugin prima oara https://forums.alliedmods.net/showthread.php?t=190895
dar patesc aceasi problema ca la si acest plugin de viata, imi iau viata , pot omora si tero si ct dupa ce se termina runda sau mor ma da spec.
doar daca sunt admin
#Vali
Fost moderator
Fost moderator
Posts: 2611
Joined: 24 Jan 2012, 11:00
Detinator Steam: Da
SteamID: id/spryt3
Reputatie: Fost Moderator
Fost Scripter eXtreamCS.com
1.2 / 3
Location: root
Has thanked: 81 times
Been thanked: 144 times
Contact:

27 Jan 2014, 15:08

gino21gino2004 wrote:em am testat acest plugin prima oara https://forums.alliedmods.net/showthread.php?t=190895
dar patesc aceasi problema ca la si acest plugin de viata, imi iau viata , pot omora si tero si ct dupa ce se termina runda sau mor ma da spec.
doar daca sunt admin
E din cauza admin_free_lock
gino21gino2004
Membru, skill 0
Membru, skill 0
Posts: 49
Joined: 06 Feb 2008, 16:20
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: strike.cs16.ro
Location: giurgiu
Has thanked: 1 time

27 Jan 2014, 15:17

si nu se poate face nimic? daca il scot presupun ca nu se mai poate uita pe toti playeri care iar e naspa
#Vali
Fost moderator
Fost moderator
Posts: 2611
Joined: 24 Jan 2012, 11:00
Detinator Steam: Da
SteamID: id/spryt3
Reputatie: Fost Moderator
Fost Scripter eXtreamCS.com
1.2 / 3
Location: root
Has thanked: 81 times
Been thanked: 144 times
Contact:

27 Jan 2014, 15:19

gino21gino2004 wrote:si nu se poate face nimic? daca il scot presupun ca nu se mai poate uita pe toti playeri care iar e naspa
Eu nu stiu vreo metoda , acceasi problema o am si eu pe un sv de furien la un shop , daca scoti restrictia de spectoator nu se da respawn calumea
Post Reply

Return to “Modificari pluginuri”

  • Information