[Modificare Plugin] Points - AutoSave

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori

Post Reply
User avatar
S3xTy
Membru, skill 0
Membru, skill 0
Posts: 22
Joined: 22 Feb 2019, 05:06
Detinator Steam: Da
CS Status: Never give up!
Fond eXtream: 0
Contact:

22 Jul 2019, 22:39

Salutari ExtreamCS! Ma poate ajuta cineva in modificarea urmatorului plugin de autosave? Am incercat printr-un nou public insa nu a mers... Vreau sa se salveze in felul urmator: Daca un jucator cu numele "X" (200 points) intra pe server si isi schimba numele in "Y" , sa-i dea suma de puncte pusa ca default cand intra un player nou (cu nume nou) adica 50 points. Daca isi schimba iar numele in "X" sa-i dea punctele precedente (200 points)
| Afiseaza codul
#include <amxmodx> 
#include <fvault>
#include <fakemeta>
#include <zombieplague> 
#include <points> 

#define PLUGIN "ZP Points Autosave" 
#define VERSION "1.0" 
#define AUTHOR "Korab"

#define SAVEPOINTS_INTERVAL 20 //Set autosave interval in second

new const g_vault_name[] = "points_save"
new g_PointsAutoSave
new g_maxplayers

#define is_user_valid(%1) (!is_user_hltv(%1) && !is_user_bot(%1) && is_user_connected(%1))

public plugin_init() 
{ 
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	g_PointsAutoSave = register_cvar("Points_autosave_max", "100000")
	
	g_maxplayers = get_maxplayers()
} 

public client_putinserver(id) 
{
	if( is_user_valid( id ) )
	{     
		LoadPoints(id)
	} 
} 

public client_disconnect(id) 
{   
	if( is_user_valid( id ) )
	{ 
		SavePoints(id)
	} 
}

public zp_round_ended()
{
	for(new id = 1; id <= g_maxplayers; id++) 
	{ 
		if( is_user_valid(id) ) SavePoints(id)
	} 
}

public plugin_end() 
{ 
	for(new id = 1; id <= g_maxplayers; id++) 
	{ 
		if( is_user_valid(id) ) SavePoints(id)
	} 
} 

LoadPoints(id) 
{ 
	new name2[35]
	get_user_name(id, name2, sizeof(name2) - 1)
	
	new data[16]; 
	if(fvault_get_data(g_vault_name, name2, data, sizeof(data) - 1)) 
	set_user_point(id,  str_to_num(data) ) // loaded points
	else 
	set_user_point(id, 50) // default start.
} 

SavePoints(id) 
{ 
	new name2[35]
	get_user_name(id, name2, sizeof(name2) - 1)
	
	if(get_user_point(id) > get_pcvar_num(g_PointsAutoSave))
	{
		set_user_point(id, get_pcvar_num(g_PointsAutoSave))
	}
	
	new data[16]
	num_to_str(get_user_point(id), data, sizeof(data) - 1)
	
	fvault_set_data(g_vault_name, name2, data)
}
eXtreamSHOP
User avatar
S3xTy
Membru, skill 0
Membru, skill 0
Posts: 22
Joined: 22 Feb 2019, 05:06
Detinator Steam: Da
CS Status: Never give up!
Fond eXtream: 0
Contact:

10 Aug 2019, 23:18

Aceasta problema am rezolvat-o printr-o metoda mai simpla , am adaugat un plugin de blocarea schimbarii de nume in joc pentru a nu cauza alte probleme. Este naspa ca atunci cand intra cineva cu nume tip reclama , nu puteti sa folositi comanda amx_nick , efectul de schimbare nu se face in joc ci doar dupa ce-i dati kick. Puteti da T/C
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests