Raised This Month: $32 Target: $400
 8% 

Level with reward


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GaBy96
Member
Join Date: Oct 2012
Location: Spain
Old 09-27-2020 , 02:03   Level with reward
Reply With Quote #1

I have this plugin
Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <nvault>
#include <fun>

static const
	PLUGIN[] = "Simple Level Mod",
	VERSION[] = "2.0",
	AUTHOR[] = "scosmyn";

#define MAX_LEVELS	4

new const Kills[MAX_LEVELS] =
{
	0,						//1
	1000,					//2
	4000,					//3
	99999999				//nu se sterge
}

new const szTag[MAX_LEVELS][] =
{
	"Unachieved",
	"Bronz",
	"Argint",
	"Aur"

}

new Level[33],Kill[33],szName[32],g_vault,g_sync
new pcvar_hs,pcvar_kill,pcvar_knife,pcvar_he,pcvar_efect,pcvar_r,pcvar_g,pcvar_b,pcvar_hp_lvl,pcvar_ap_lvl

public plugin_init() {
	register_plugin(PLUGIN,VERSION,AUTHOR)
	register_event("DeathMsg","ev_msg","a")
	RegisterHam(Ham_Spawn,"player","player_spawn",1)
	
	pcvar_hs = register_cvar("cvar_hs_bonus","1")
	pcvar_kill = register_cvar("cvar_normal_bonus","1")
	pcvar_knife = register_cvar("cvar_knife_bonus","1")
	pcvar_he = register_cvar("cvar_he_bonus","1")
	pcvar_efect = register_cvar("cvar_effect_lvl","1")
	pcvar_r = register_cvar("cvar_red","0")
	pcvar_g = register_cvar("cvar_green","255")
	pcvar_b = register_cvar("cvar_blue","0")
	pcvar_hp_lvl = register_cvar("cvar_hp_lvl","5")
	pcvar_ap_lvl = register_cvar("cvar_ap_lvl","10")
	
	g_vault = nvault_open("simple_lvl_mod")
	g_sync = CreateHudSyncObj()
	
	if(g_vault == INVALID_HANDLE)
		set_fail_state("Eroare la deschiderea bazei de date din vault.")
}

public player_spawn(id) {
	if(!is_user_alive(id) || is_user_bot(id))
		return HAM_HANDLED
	
	if(Level[id] < 1)
		Level[id] = 1

	set_user_health(id,get_user_health(id) + get_pcvar_num(pcvar_hp_lvl) * Level[id])
	set_user_armor(id,get_user_armor(id) + get_pcvar_num(pcvar_ap_lvl) * Level[id])
	return HAM_HANDLED
}

public ev_msg( ) {
	static kiler; 	kiler = read_data(1)
	static hs; 		hs = read_data(3)
	
	if(kiler == read_data(2) || !is_user_alive(kiler))
		return

	if(hs)
		Kill[kiler]+= get_pcvar_num(pcvar_hs)
	else
		Kill[kiler]+= get_pcvar_num(pcvar_kill)
	
	if(get_user_weapon(kiler) == CSW_KNIFE && !hs)
		Kill[kiler]+= get_pcvar_num(pcvar_knife)
	if(get_user_weapon(kiler) == CSW_HEGRENADE && !hs)
		Kill[kiler]+= get_pcvar_num(pcvar_he)

	if(Level[kiler] < MAX_LEVELS)
	{
		while(Kill[kiler] >= Kills[Level[kiler]])
		{
			Level[kiler]++
			color(kiler,"!teamFelicitari,ai primit o medalie de !g%s!team.",szTag[Level[kiler]])
			screen_fade(kiler, get_pcvar_num(pcvar_efect), get_pcvar_num(pcvar_r), get_pcvar_num(pcvar_g), get_pcvar_num(pcvar_b), 115)
			return
		}
	}
	SaveData(kiler)
}

public client_putinserver(id) {
	if(!is_user_bot(id))
	{
		LoadData(id)
		set_task(1.0,"show_hud",id+0x4332,_,_,"b")
	}
}

public client_disconnect(id) {
	remove_task(id+0x4332)
	SaveData(id)
}

public show_hud(id) {
	id-=0x4332
	get_user_name(id,szName,charsmax(szName))

	if(is_user_alive(id))
	{
		set_hudmessage(random(256), random(256), random(256), 0.8, 0.18, 0, 0.00, 1.00, 0.00, 0.00, 4)
		ShowSyncHudMsg(id,g_sync,"Medalie: %s",szTag[Level[id]])
	}
}

public SaveData(id)
{
	new name[32],vaultkey[64],vaultdata[256]
	get_user_name(id,name,charsmax(name))
	formatex(vaultkey,63,"%s-Mod",name)
	formatex(vaultdata,255,"%i#%i#",Kill[id],Level[id])
	nvault_set(g_vault,vaultkey,vaultdata)
}

public LoadData(id)
{
	new name[32],vaultkey[64],vaultdata[256]
	get_user_name(id,name,charsmax(name))
	formatex(vaultkey,63,"%s-Mod",name)
	formatex(vaultdata,255,"%i#%i#",Kill[id],Level[id])
	nvault_get(g_vault,vaultkey,vaultdata,255)
	replace_all(vaultdata, 255, "#", " ")

	new kill[32],level[32]
	parse(vaultdata, kill, 31, level, 31)
	Kill[id] = str_to_num(kill)
	Level[id] = str_to_num(level)
}
public plugin_end() nvault_close(g_vault)
stock screen_fade(id,holdtime,r,g,b,a)
{
   message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("ScreenFade"),{ 0, 0, 0 },id);
   write_short(seconds_to_units(holdtime));
   write_short(seconds_to_units(holdtime));
   write_short(0);
   write_byte(r);
   write_byte(g);
   write_byte(b);
   write_byte(a);
   message_end();
}

stock seconds_to_units(time)
{
   return((1 << 12) * (time))
}

stock color( const id, const input[ ], any:... )
{
	new count = 1, players[ 32 ]

	static msg[ 191 ]
	vformat( msg, 190, input, 3 )

	replace_all( msg, 190, "!g", "^4" ) //- verde
	replace_all( msg, 190, "!y", "^1" ) //- galben
	replace_all( msg, 190, "!team", "^3" ) //- echipa
	replace_all( msg, 190, "!n", "^0" ) //- normal

	if( id ) players[ 0 ] = id; else get_players( players, count, "ch" )
	{
		for( new i = 0; i < count; i++ )
		{
			if( is_user_connected( players[ i ] ) )
			{
				message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
				write_byte( players[ i ] );
				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 }
*/

At each level passed to give you a random skin

Code:
register_native("randomcsgo", "randomcsgo", 1)
	register_native("randomskin", "ChestOpen", 1)
	register_native("give_key", "native_key", 1)
	register_native("give_chest", "native_chest", 1)
	register_native("give_bet", "native_bet", 1)
	register_native("bett", "native_bett", 1)
	register_native("betct", "native_betct", 1)
	register_native("get_user_puncte", "native_get_pct", 1)
	register_native("set_user_puncte", "native_set_pct", 1)
	register_native("get_user_key", "native_get_key", 1)
	register_native("set_user_key", "native_set_key", 1)
	register_native("get_user_chest", "native_get_chest", 1)
	register_native("set_user_chest", "native_set_chest", 1)
	register_native("set_chest", "native_set_chests", 1)
	register_native("get_name","get_namee",1)
__________________

We have over 400 skins on weapons and 5 types for hands!
Costumes for players!
New style for Top15 and stats!
Kill marks, molotov!
And many more are waiting for you to play!

Last edited by GaBy96; 09-27-2020 at 06:42.
GaBy96 is offline
Send a message via Skype™ to GaBy96
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-27-2020 , 07:52   Re: Level with reward
Reply With Quote #2

Do you see any natives for giving skins in there?

I strongly suggest you switch to a better level plugin - https://forums.alliedmods.net/showthread.php?t=308540
__________________

Last edited by OciXCrom; 09-27-2020 at 07:53.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
GaBy96
Member
Join Date: Oct 2012
Location: Spain
Old 09-27-2020 , 08:55   Re: Level with reward
Reply With Quote #3

I have cs go remake by zorken and your level system is not for this mod
__________________

We have over 400 skins on weapons and 5 types for hands!
Costumes for players!
New style for Top15 and stats!
Kill marks, molotov!
And many more are waiting for you to play!
GaBy96 is offline
Send a message via Skype™ to GaBy96
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-27-2020 , 13:43   Re: Level with reward
Reply With Quote #4

There is nothing in the plugin you provided that makes it work with a specific mod only. It's just a poorly coded plugin that works with any mod and can be easily replaced with a better alternative.
__________________

Last edited by OciXCrom; 09-27-2020 at 13:43.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
GaBy96
Member
Join Date: Oct 2012
Location: Spain
Old 09-28-2020 , 10:42   Re: Level with reward
Reply With Quote #5

Well, chat tags like the one in the next picture can stop them because the way I use them has its own tags.

__________________

We have over 400 skins on weapons and 5 types for hands!
Costumes for players!
New style for Top15 and stats!
Kill marks, molotov!
And many more are waiting for you to play!
GaBy96 is offline
Send a message via Skype™ to GaBy96
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-28-2020 , 13:14   Re: Level with reward
Reply With Quote #6

Those tags are not a part of the plugin by default. They require my Chat Manager plugin in order to work. Without it, there are no modifications in the chat whatsoever so you can use it without worry.
__________________

Last edited by OciXCrom; 09-28-2020 at 13:14.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode