Jump to content
  • 0
RayCode

pomoc "Všetci hráči..."

Dotaz

Zdravím, potreboval by som opäť poradiť s jazykom Pawn.

Ako vytvorím plugin, ktorí dá všetkým hráčom napr. AK-47 po stlačení tlačítka v menu?

Príklad:

Vytvorím menu, kde budú položky: AK47, M4A1, Deagle, Scout, A pokiaľ hráč zvolí napr. "Deagle", dá to všetkým hráčom, čo sú napr. v tíme T (terrorist) deagle zbraň.

Skúsil som to urobiť následne, cez kompiler to prešlo, ale na serveri to nefunguje:
 

#include <amxmisc>
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>

new allPlayers = get_players(players, allPlayers, "f")

public plugin_init()
{
	register_plugin("Zbrane", "1.0", "RayCodeCSC")

	register_clcmd("say /zbrane", "herne_mody_menu")
	register_clcmd("say /z", "herne_mody_menu")
}

public herne_mody_menu(id)
{
	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
		new herne_mody = menu_create("Vyber si herny mod:", "herne_mody_menu_selection")

		menu_additem(herne_mody, "Scout")
		menu_additem(herne_mody, "Test")

		menu_display(id, herne_mody)
	}
	else if(cs_get_user_team(id) == CS_TEAM_T)
	{
		client_print(id, print_chat, "[HERNE-MODY] Musis byt CT, aby si mohol dat zbrane!")
	}
}

public herne_mody_menu_selection(id, menu, item, allPlayers)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}

	switch(item)
	{
		case 0: //Scout
		{
			if(cs_get_user_team(allPlayers) == CS_TEAM_T)
			{
				give_item(allPlayers, "weapon_scout")
				cs_set_user_bpammo(allPlayers, CSW_SCOUT, 10)

				client_print(allPlayers, print_chat, "Dostal si zbran: Scout !")
			}
			else if(cs_get_user_team(allPlayers) == CS_TEAM_CT)
			{
				strip_user_weapons(allPlayers)
				give_item(allPlayers, "weapon_scout")
				cs_set_user_bpammo(allPlayers, CSW_SCOUT, 10)

				client_print(allPlayers, print_chat, "Dostal si zbran: Scout !")
			}
		}

		case 1: //Test
		{
			if(cs_get_user_team(allPlayers) == CS_TEAM_T)
			{
				give_item(allPlayers, "weapon_m4a1")
				give_item(allPlayers, "weapon_deagle")

				cs_set_user_bpammo(allPlayers, CSW_M4A1, 32)
				cs_set_user_bpammo(allPlayers, CSW_DEAGLE, 10)

				client_print(allPlayers, print_chat, "Testovanie !")
			}
			else if(cs_get_user_team(allPlayers) == CS_TEAM_CT)
			{
				strip_user_weapons(allPlayers)
				give_item(allPlayers, "weapon_m4a1")
				give_item(allPlayers, "weapon_deagle")

				cs_set_user_bpammo(allPlayers, CSW_M4A1, 32)
				cs_set_user_bpammo(allPlayers, CSW_DEAGLE, 10)

				client_print(allPlayers, print_chat, "Testovanie !")
			}
		}
	}
}

Čo teda chcem: Chcem len skrátka vysvetliť, ako sa pracuje so "všetkými hráčmi". Dať zbraň napr. sebe urobiť viem, ale ako ju dať všetkým čo sú na Serveri?

Sdílet tento příspěvek


Link to post
Share on other sites

0 odpovědí na tuto otázku

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Odpovědět na dotaz...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Obnovili jsme váš původní obsah (obsah napsaný před zavřením).   Smazat obnovený obsah

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...