Page 1 of 1

Cerere plugin supplybox[Furien]!

Posted: 19 Apr 2019, 00:28
by puNx
Salut all !
As dori si eu daca se poate sa imi faceti compilarea la acest plugin de supplybox
Eroarea:
| Afiseaza codul
supplybox.sma(8) : fatal error 100: cannot read from file: "levels"

Compilation aborted.
1 Error.
Done.
SMA:
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <cstrike>
#include <xs>
#include <fun>
#include <levels>
#include <dhudmessage>
#include <zombie_escape>

#define PLUGIN "SupplyBox"
#define VERSION "1.1"
#define AUTHOR "Dias"

#define SUPPLYBOX_CLASSNAME "supplybox"
#define TASK_SUPPLYBOX 128256
#define TASK_SUPPLYBOX2 138266
#define TASK_SUPPLYBOX_HELP 129257
#define TASK_SUPPLYBOX_WAIT 130259

const MAX_SUPPLYBOX_ENT = 100
new const supplybox_spawn_file[] = "%s/ze_supplybox/%s.cfg"
//new const supplybox_icon_spr[] = "sprites/icon_supplybox.spr"
new const supplybox_model[][] = {
	"models/EN-Resources/supplybox.mdl"
}
new const supplybox_drop_sound[][] = {
	"EN-Resources/MSns/supplybox_drop.wav"
}
new const supplybox_pickup_sound[][] = {
	"EN-Resources/MSns/supplybox_pickup.wav"
}

// Below here is hard code. Don't edit anything except cvars
new g_supplybox_num, g_supplybox_wait[33], supplybox_count, Array:supplybox_item, 
supplybox_ent[MAX_SUPPLYBOX_ENT], /*g_supplybox_icon_id,*/ Float:g_supplybox_spawn[MAX_SUPPLYBOX_ENT][3],
g_total_supplybox_spawn
new cvar_supplybox_icon, cvar_supplybox_max, cvar_supplybox_num, cvar_supplybox_totalintime, 
cvar_supplybox_time, cvar_supplybox_delaytime, cvar_supplybox_icon_size, cvar_supplybox_icon_light
new bool:made_supplybox, Float:g_icon_delay[33], g_newround, g_endround

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	register_event("HLTV", "event_newround", "a", "1=0", "2=0")
	register_logevent("logevent_round_end", 2, "1=Round_End")
	
	register_forward(FM_Touch, "fw_supplybox_touch")
	
	cvar_supplybox_max = register_cvar("supplybox_max", "10")
	cvar_supplybox_num = register_cvar("supplybox_num", "2")
	cvar_supplybox_totalintime = register_cvar("supplybox_totalintime", "30")
	cvar_supplybox_time = register_cvar("supplybox_time", "30")
	cvar_supplybox_icon = register_cvar("supplybox_icon", "1")
	cvar_supplybox_delaytime = register_cvar("supplybox_icon_delay_time", "0.03")	
	cvar_supplybox_icon_size = register_cvar("supplybox_icon_size", "2")
	cvar_supplybox_icon_light = register_cvar("supplybox_icon_light", "100")
	
	set_task(2.0, "update_radar", _, _, _, "b")
}

public plugin_precache()
{
	supplybox_item = ArrayCreate(64, 1)
	
	load_supplybox_spawn()
	load_supplybox_item()
	
	static i
	for(i = 0; i < sizeof(supplybox_model); i++)
		engfunc(EngFunc_PrecacheModel, supplybox_model)
	for(i = 0; i < sizeof(supplybox_drop_sound); i++)
		engfunc(EngFunc_PrecacheSound, supplybox_drop_sound)		
	for(i = 0; i < sizeof(supplybox_pickup_sound); i++)
		engfunc(EngFunc_PrecacheSound, supplybox_pickup_sound)
		
	//g_supplybox_icon_id = engfunc(EngFunc_PrecacheModel, supplybox_icon_spr)
}

public plugin_cfg()
{
	set_task(0.5, "event_newround")
}

public load_supplybox_spawn()
{
	// Check for spawns points of the current map
	new cfgdir[32], mapname[32], filepath[100], linedata[64]
	get_configsdir(cfgdir, charsmax(cfgdir))
	get_mapname(mapname, charsmax(mapname))
	formatex(filepath, charsmax(filepath), supplybox_spawn_file, cfgdir, mapname)
	
	// Load spawns points
	if (file_exists(filepath))
	{
		new file = fopen(filepath,"rt"), row[4][6]
		
		while (file && !feof(file))
		{
			fgets(file, linedata, charsmax(linedata))
			
			// invalid spawn
			if(!linedata[0] || str_count(linedata,' ') < 2) continue;
			
			// get spawn point data
			parse(linedata,row[0],5,row[1],5,row[2],5)
			
			// origin
			g_supplybox_spawn[g_total_supplybox_spawn][0] = floatstr(row[0])
			g_supplybox_spawn[g_total_supplybox_spawn][1] = floatstr(row[1])
			g_supplybox_spawn[g_total_supplybox_spawn][2] = floatstr(row[2])

			g_total_supplybox_spawn++
			if (g_total_supplybox_spawn >= MAX_SUPPLYBOX_ENT) 
				break
		}
		if (file) fclose(file)
	}
}

public load_supplybox_item() 
{
	new filepath[64]
	get_configsdir(filepath, charsmax(filepath))
	
	new line[1024], key[64], value[960]
	new file = fopen(filepath, "rt")
	
	while (!feof(file) && file)
	{
		fgets(file, line, charsmax(line));
		replace(line, charsmax(line), "^n", "")
		
		if (!line[0] || line[0] == ';')
			continue
		
		strtok(line, key, charsmax(key), value, charsmax(value), '=')
		trim(key)
		trim(value)
		
		if (equali(key, "SUPPLYBOX_ITEM")) 
		{
			while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ',')) 
			{
				trim(key)
				trim(value)
				ArrayPushString(supplybox_item, key)
			}
		}
	}
}

public update_radar()
{	
	for (new id = 1; id <= get_maxplayers(); id++)
	{
		if (!is_user_alive(id) || !supplybox_count || (cs_get_user_team(id) == CS_TEAM_T)) 
			continue
		
		static i, next_ent
		i = 1
		while(i <= supplybox_count)
		{
			next_ent = supplybox_ent
			if (next_ent && is_valid_ent(next_ent))
			{
				static Float:origin[3]
				pev(next_ent, pev_origin, origin)
				
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("HostagePos"), {0,0,0}, id)
				write_byte(id)
				write_byte(i)		
				write_coord(floatround(origin[0]))
				write_coord(floatround(origin[1]))
				write_coord(floatround(origin[2]))
				message_end()
			
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("HostageK"), {0,0,0}, id)
				write_byte(i)
				message_end()
			}

			i++
		}
	}
}

public event_newround()
{
	made_supplybox = false
	g_newround = 1
	g_endround = 0
	
	remove_supplybox()
	supplybox_count = 0
	
	if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
	if(task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
	if(task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)
}

public logevent_round_end() g_endround = 1

public ze_gamestart(START_ZOMBIE_APPEAR)
{
	if(!made_supplybox)
	{
		g_newround = 0
		made_supplybox = true
		
		if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
		
		if(!g_total_supplybox_spawn)
		{
			client_print(0, print_console, "[SupplyBox][Error] Spawn Point Not Found. Please Create Spawn Point")
		} else {
			set_task(get_pcvar_float(cvar_supplybox_time), "create_supplybox", TASK_SUPPLYBOX)
		}
	}
}

public client_PostThink(id)
{
	if (!get_pcvar_num(cvar_supplybox_icon) || !is_user_alive(id) || (cs_get_user_team(id) == CS_TEAM_T))
		return
	if((g_icon_delay[id] + get_pcvar_float(cvar_supplybox_delaytime)) > get_gametime())
		return
		
	g_icon_delay[id] = get_gametime()

	/*if (supplybox_count)
	{
		static i, box_ent
		i = 1
		
		while (i <= supplybox_count)
		{
			box_ent = supplybox_ent
			create_icon_origin(id, box_ent, g_supplybox_icon_id)
			i++
		}
	}*/
}

public create_supplybox()
{
	if (supplybox_count >= get_pcvar_num(cvar_supplybox_max) || g_newround || g_endround) 
		return

	if (task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
	set_task(get_pcvar_float(cvar_supplybox_time), "create_supplybox", TASK_SUPPLYBOX)
	
	if (get_total_supplybox() >= get_pcvar_num(cvar_supplybox_totalintime)) 
		return
	
	g_supplybox_num = 0
	create_supplybox2()
	
	static random_sound
	random_sound = random_num(0, charsmax(supplybox_drop_sound))
	client_cmd(0, "spk ^"%s^"", supplybox_drop_sound[random_sound])
	
	for(new i = 0; i < get_maxplayers(); i++)
	{
		if(is_user_alive(i) && is_user_connected(i) && (cs_get_user_team(i) == CS_TEAM_CT))
		{
			/*set_dhudmessage(random(256), random(256), random(256), -1.0, -0.80, 2, 4.0, 3.0, 0.1, 0.1)
			show_dhudmessage(i, "Supplybox has appeared. Find it.")*/
		}
	}
	
	if (task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)
	set_task(7.0, "show_supplybox_help", TASK_SUPPLYBOX_HELP)

	if (task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
	set_task(0.5, "create_supplybox2", TASK_SUPPLYBOX2, _, _, "b")	
}

public create_supplybox2()
{
	if (supplybox_count >= get_pcvar_num(cvar_supplybox_max)
	|| get_total_supplybox() >= get_pcvar_num(cvar_supplybox_totalintime) || g_newround || g_endround)
	{
		remove_task(TASK_SUPPLYBOX2)
		return
	}
	
	supplybox_count++
	g_supplybox_num++

	static item
	item = random(ArraySize(supplybox_item))

	new ent = create_entity("info_target")
	
	entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME)
	entity_set_model(ent, supplybox_model[random_num(0, charsmax(supplybox_model))])	
	entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
	entity_set_int(ent,EV_INT_solid,1)
	entity_set_int(ent,EV_INT_movetype,6)
	entity_set_int(ent, EV_INT_iuser1, item)
	entity_set_int(ent, EV_INT_iuser2, supplybox_count)
	
	static Float:Origin[3]
	collect_spawn_point(Origin)
	engfunc(EngFunc_SetOrigin, ent, Origin)
	
	supplybox_ent[supplybox_count] = ent

	if ((g_supplybox_num >= get_pcvar_num(cvar_supplybox_num)) && task_exists(TASK_SUPPLYBOX2)) 
		remove_task(TASK_SUPPLYBOX2)
}

public get_total_supplybox()
{
	new total
	for (new i = 1; i <= supplybox_count; i++)
	{
		if (supplybox_ent) total += 1
	}
	return total
}

public show_supplybox_help()
{
	for(new i = 0; i < get_maxplayers(); i++)
	{
		if(is_user_alive(i) && is_user_connected(i) && (cs_get_user_team(i) == CS_TEAM_CT))
		{
			set_dhudmessage(random(256), random(256), random(256), -1.0, -0.80, 2, 4.0, 3.0, 0.1, 0.1)
			show_dhudmessage(i, "You can see Supplybox Location in the Radar.")
		}
	}
}

public remove_supplybox()
{
	remove_ent_by_class(SUPPLYBOX_CLASSNAME)
	new supplybox_ent_reset[MAX_SUPPLYBOX_ENT]
	supplybox_ent = supplybox_ent_reset
}

public fw_supplybox_touch(ent, id)
{
	if (!pev_valid(ent) || !is_user_alive(id) || (cs_get_user_team(id) == CS_TEAM_T) || g_supplybox_wait[id]) 
		return FMRES_IGNORED
	
	static classname[32]
	entity_get_string(ent,EV_SZ_classname,classname,31)
	
	if (equal(classname, SUPPLYBOX_CLASSNAME))
	{	
		static name[32]
		get_user_name(id, name, sizeof(name))
		new xp = get_user_xp(id)
		
		switch(random_num(0,7))
		{
			case 0:
			{
				give_item(id, "weapon_hegrenade")
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !tFire Nade!y!!!", name)
			}
			case 1:
			{
				give_item(id, "weapon_flashbang")
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !tForst Nade!y!!!", name)
			}
			case 2:
			{
				set_user_xp(id, xp + 5)
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !t+5 XP!y!!!", name)
				check_level_xp(id)
			}
			case 3:
			{
				set_user_xp(id, xp + 10)
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !t+10 XP!y!!!", name)
				check_level_xp(id)
			}
			case 4:
			{
				set_user_xp(id, xp + 15)
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !t+15 XP!y!!!", name)
				check_level_xp(id)
			}
			case 5:
			{
				set_user_xp(id, xp + 20)
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !t+20 XP!y!!!", name)
				check_level_xp(id)
			}
			case 6:
			{
				client_cmd(id,"llirdgsgnikcuff")
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !tSgdrill !y!!!", name)
				check_level_xp(id)
			}
			case 7:
			{
				client_cmd(id,"amsalpgnikcuff")
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !tPlasmaGun y!!!", name)
				check_level_xp(id)
			}
		}
		
		static random_sound
		random_sound = random_num(0, charsmax(supplybox_pickup_sound))
		emit_sound(id, CHAN_VOICE, supplybox_pickup_sound[random_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)

		new num_box = entity_get_int(ent, EV_INT_iuser2)
		supplybox_ent[num_box] = 0
		remove_entity(ent)

		g_supplybox_wait[id] = 1
		if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
		set_task(2.0, "remove_supplybox_wait", id+TASK_SUPPLYBOX_WAIT)
	}
	
	return FMRES_IGNORED
}

public remove_supplybox_wait(id)
{
	id -= TASK_SUPPLYBOX_WAIT
	
	g_supplybox_wait[id] = 0
	if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
}

stock collect_spawn_point(Float:origin[3])
{
	for (new i = 1; i <= g_total_supplybox_spawn *3 ; i++)
	{
		origin = g_supplybox_spawn[random(g_total_supplybox_spawn)]
		if (check_spawn_box(origin)) return 1;
	}

	return 0;
}
stock check_spawn_box(Float:origin[3])
{
	new Float:originE[3], Float:origin1[3], Float:origin2[3]
	new ent = -1
	while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", SUPPLYBOX_CLASSNAME)) != 0)
	{
		pev(ent, pev_origin, originE)
		
		// xoy
		origin1 = origin
		origin2 = originE
		origin1[2] = origin2[2] = 0.0
		if (vector_distance(origin1, origin2) <= 32.0) return 0;
	}
	return 1;
}

stock create_icon_origin(id, ent, sprite)
{
	if (!pev_valid(ent)) return;
	
	new Float:fMyOrigin[3]
	entity_get_vector(id, EV_VEC_origin, fMyOrigin)
	
	new target = ent
	new Float:fTargetOrigin[3]
	entity_get_vector(target, EV_VEC_origin, fTargetOrigin)
	fTargetOrigin[2] += 40.0
	
	if (!is_in_viewcone(id, fTargetOrigin)) return;

	new Float:fMiddle[3], Float:fHitPoint[3]
	xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
	trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
							
	new Float:fWallOffset[3], Float:fDistanceToWall
	fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
	normalize(fMiddle, fWallOffset, fDistanceToWall)
	
	new Float:fSpriteOffset[3]
	xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
	new Float:fScale
	fScale = 0.01 * fDistanceToWall
	
	new scale = floatround(fScale)
	scale = max(scale, 1)
	scale = min(scale, get_pcvar_num(cvar_supplybox_icon_size))
	scale = max(scale, 1)

	te_sprite(id, fSpriteOffset, sprite, scale, get_pcvar_num(cvar_supplybox_icon_light))
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness)
{	
	message_begin(MSG_ONE, SVC_TEMPENTITY, _, id)
	write_byte(TE_SPRITE)
	write_coord(floatround(origin[0]))
	write_coord(floatround(origin[1]))
	write_coord(floatround(origin[2]))
	write_short(sprite)
	write_byte(scale) 
	write_byte(brightness)
	message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul)
{
	new Float:fLen = xs_vec_len(fIn)
	xs_vec_copy(fIn, fOut)
	
	fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
	fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}

stock str_count(const str[], searchchar)
{
	new count, i, len = strlen(str)
	
	for (i = 0; i <= len; i++)
	{
		if(str == searchchar)
			count++
	}
	
	return count;
}

stock remove_ent_by_class(classname[])
{
	new nextitem  = find_ent_by_class(-1, classname)
	while(nextitem)
	{
		remove_entity(nextitem)
		nextitem = find_ent_by_class(-1, classname)
	}
}

stock client_print_color(const id, const input[], any:...)  
{  
    new count = 1, players[32];  
    static msg[191];  
    vformat(msg, 190, input, 3);  

    replace_all(msg, 190, "!g", "^x04"); // Green Color  
    replace_all(msg, 190, "!y", "^x01"); // Default Color  
    replace_all(msg, 190, "!t", "^x03"); // 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();  
            }  
        }  
    }  
}

Si daca ati putea va rog sa imi scoateti aceste linii:
| Afiseaza codul
			client_cmd(id,"llirdgsgnikcuff")
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !tSgdrill !y!!!", name)
				check_level_xp(id)
			}
			case 7:
			{
				client_cmd(id,"amsalpgnikcuff")
				client_print_color(0, "!y[!gSupply!y-!gBox!y] !t%s !ghas received !tPlasmaGun y!!!", name)
				check_level_xp(id)

Doar sa raman cu grenadele si xp-ul si daca ati putea sa adaugati si bani sa pice la drop...
As fii recunoscator ! :D :)

Re: Cerere plugin supplybox[Furien]!

Posted: 19 Apr 2019, 00:54
by levin
ai nevoie de fișierele levels.inc / zombie_escape.inc / dhudmessage.inc , compilarea o faci locală...
pentru cineva care a făcut un addons, și te-ai pus la autor peste unele plugine, trebuia să ai habar de asta, de engleză..(la ce oferi suport??)

Re: Cerere plugin supplybox[Furien]!

Posted: 19 Apr 2019, 13:11
by puNx
Stiu ma vere ce am de facut,numai ca eu nu gasesc fisierele
App smr daca am auzit de tine vreodata
Si nu m am pus autor la unele plugin-uri aiurea deoarece ele sunt facute de mine

Re: Cerere plugin supplybox[Furien]!

Posted: 19 Apr 2019, 13:20
by levin
de ce să auzi de mine? =)))) ce gândire
arată 1 plugin făcut de tine, tu nu poți să compilezi un plugin..da să faci unu:)))
eu, spre deosebire de tine, știu engleză, și știu să mă documtez, să folosesc search, la 1 search am găsit - https://forums.alliedmods.net/showthread.php?t=175372
a da, nu-s văr cu tine :face_unequal_eyes:

Re: Cerere plugin supplybox[Furien]!

Posted: 19 Apr 2019, 13:27
by puNx
Pleaca ma de aici 😂😂😂 auzi la el ma eu , tot ce am acum e privat din plugin-uri
Documenteaza te si despre mine ca vad ca esti priceput" mestere"

Re: Cerere plugin supplybox[Furien]!

Posted: 19 Apr 2019, 16:47
by faKe91
puNx wrote:
19 Apr 2019, 13:11
Si nu m am pus autor la unele plugin-uri aiurea deoarece ele sunt facute de mine
post2740844.html#p2740844
post1705060.html#p1705060
https://www.diffchecker.com/KH09VL1h