Am nevoie de explicatie la acest script

Tutoriale scripting, cod si portiuni de cod.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
amxmodx
Membru, skill 0
Membru, skill 0
Posts: 11
Joined: 25 Sep 2012, 10:07
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Contact:

17 Mar 2018, 22:26

Salut.Va rog sa imi explicati si mie fiecare parte din acest plugin,pentru ca nu ma prind cum functioneaza...
*Este un bullet dmg shower
Si daca se poate sa imi spuneti ce sunt cifrele alea de la hud msg si ce inseamna variabila static

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>

#define PLUGIN "Advanced Bullet Damage"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

new g_type, g_enabled, g_recieved, bool:g_showrecieved, g_hudmsg1, g_hudmsg2

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")	
	register_event("HLTV", "on_new_round", "a", "1=0", "2=0")
	
	g_type = register_cvar("amx_bulletdamage","1")
	g_recieved = register_cvar("amx_bulletdamage_recieved","1")	
	
	g_hudmsg1 = CreateHudSyncObj()	
	g_hudmsg2 = CreateHudSyncObj()
}

public on_new_round()
{
	g_enabled = get_pcvar_num(g_type)
	if(get_pcvar_num(g_recieved)) g_showrecieved = true	
}

public on_damage(id)
{
	if(g_enabled)
	{		
		static attacker; attacker = get_user_attacker(id)
		static damage; damage = read_data(2)		
		if(g_showrecieved)
		{			
			set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
			ShowSyncHudMsg(id, g_hudmsg2, "%i^n", damage)		
		}
		if(is_user_connected(attacker))
		{
			switch(g_enabled)
			{
				case 1: {
					set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
					ShowSyncHudMsg(attacker, g_hudmsg1, "%i^n", damage)				
				}
				case 2: {
					if(fm_is_ent_visible(attacker,id))
					{
						set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
						ShowSyncHudMsg(attacker, g_hudmsg1, "%i^n", damage)				
					}
				}
			}
		}
	}
}
IG-BOOST.org - Instagram Followers Best, Cheap, Reliable
User avatar
faKe91
Moderator ajutator
Moderator ajutator
Posts: 1406
Joined: 07 Oct 2014, 17:49
Detinator Steam: Da
CS Status: I <3 Heavy Metal
SteamID: dogseatmypancreas
Reputatie: Moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Location: Republica Moldova, Chișinău
Has thanked: 5 times
Been thanked: 5 times

17 Mar 2018, 22:43

amxmodx wrote:ce sunt cifrele alea de la hud msg
https://www.amxmodx.org/api/amxmodx/set_hudmessage
amxmodx wrote:ce inseamna variabila static
https://forums.alliedmods.net/showthread.php?t=40340
Post Reply

Return to “Scripting”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest