[POMOC] Ako scriptovať v jazyku Pawn?

Veškeré návody, pluginy, atd.. ohledně Counter-Strike 1.6.
Odpovědět
Uživatelský avatar
Javierko
Zákaznická podpora
Příspěvky: 80
Registrován: 09 bře 2019 19:24
Bydliště: OnGameFrame()
Kontaktovat uživatele:

Re: [POMOC] Ako scriptovať v jazyku Pawn?

Příspěvek od Javierko » 10 zář 2019 16:24

Zkuste.

Kód: Vybrat vše

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

public plugin_init()
{
	register_plugin("JB Herne Mody", "1.0", "RayCodeCSC")

	register_clcmd("say /herneemody", "herne_mody_menu")
	register_clcmd("say /hm", "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, "Prestrelka")
		menu_additem(herne_mody, "Schovavacka")
		menu_additem(herne_mody, "AWP")
		menu_additem(herne_mody, "Zombie")
		menu_additem(herne_mody, "Granaty")
		menu_additem(herne_mody, "Nahanacka")

		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 herny mod!")
	}
}

public herne_mody_menu_selection(id, menu, item)
{
	switch(item)
	{
		case MENU_EXIT:
		{
			menu_destroy(menu)
			
			return PLUGIN_HANDLED
		}
		
		case 0: //Scout
		{
			new iPlayers[32], iPlayersCount, iPlayer
			get_players(iPlayers, iPlayersCount)
			
			for(new i = 0; i < iPlayersCount; i++)
			{
				iPlayer = iPlayers[i]
				
				if(cs_get_user_team(iPlayer) == CS_TEAM_T)
				{
					give_item(iPlayer, "weapon_scout")
					cs_set_user_bpammo(iPlayer, CSW_SCOUT, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Scout !")
				}
				else if(cs_get_user_team(iPlayer) == CS_TEAM_CT)
				{
					strip_user_weapons(iPlayer)
					give_item(iPlayer, "weapon_scout")
					cs_set_user_bpammo(iPlayer, CSW_SCOUT, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Scout !")
				}
			}
		}

		case 1: //Prestrelka
		{
			new iPlayers[32], iPlayersCount, iPlayer
			get_players(iPlayers, iPlayersCount)
			
			for(new i = 0; i < iPlayersCount; i++)
			{
				iPlayer = iPlayers[i]
				
				if(cs_get_user_team(iPlayer) == CS_TEAM_T)
				{
					give_item(iPlayer, "weapon_m4a1")
					give_item(iPlayer, "weapon_deagle")
	
					cs_set_user_bpammo(iPlayer, CSW_M4A1, 32)
					cs_set_user_bpammo(iPlayer, CSW_DEAGLE, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Prestrelka !")
				}
				else if(cs_get_user_team(iPlayer) == CS_TEAM_CT)
				{
					strip_user_weapons(iPlayer)
					give_item(iPlayer, "weapon_m4a1")
					give_item(iPlayer, "weapon_deagle")
	
					cs_set_user_bpammo(iPlayer, CSW_M4A1, 32)
					cs_set_user_bpammo(iPlayer, CSW_DEAGLE, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Prestrelka !")
				}
			}
		}
	}
	
	menu_destroy(menu)
	
	return PLUGIN_HANDLED
}
Pawn, SourcePawn, Web development, MySQL, Lua, ...

YouTube: https://www.youtube.com/c/Javierko21
Twitch: https://twitch.tv/javierko

Projects:
https://steamid.cz
https://hexmania.eu/

RayCodeCSC
Příspěvky: 48
Registrován: 11 črc 2019 23:52

Příspěvek od RayCodeCSC » 19 zář 2019 12:10

Javierko píše:
10 zář 2019 16:24
Zkuste.

Kód: Vybrat vše

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

public plugin_init()
{
	register_plugin("JB Herne Mody", "1.0", "RayCodeCSC")

	register_clcmd("say /herneemody", "herne_mody_menu")
	register_clcmd("say /hm", "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, "Prestrelka")
		menu_additem(herne_mody, "Schovavacka")
		menu_additem(herne_mody, "AWP")
		menu_additem(herne_mody, "Zombie")
		menu_additem(herne_mody, "Granaty")
		menu_additem(herne_mody, "Nahanacka")

		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 herny mod!")
	}
}

public herne_mody_menu_selection(id, menu, item)
{
	switch(item)
	{
		case MENU_EXIT:
		{
			menu_destroy(menu)
			
			return PLUGIN_HANDLED
		}
		
		case 0: //Scout
		{
			new iPlayers[32], iPlayersCount, iPlayer
			get_players(iPlayers, iPlayersCount)
			
			for(new i = 0; i < iPlayersCount; i++)
			{
				iPlayer = iPlayers[i]
				
				if(cs_get_user_team(iPlayer) == CS_TEAM_T)
				{
					give_item(iPlayer, "weapon_scout")
					cs_set_user_bpammo(iPlayer, CSW_SCOUT, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Scout !")
				}
				else if(cs_get_user_team(iPlayer) == CS_TEAM_CT)
				{
					strip_user_weapons(iPlayer)
					give_item(iPlayer, "weapon_scout")
					cs_set_user_bpammo(iPlayer, CSW_SCOUT, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Scout !")
				}
			}
		}

		case 1: //Prestrelka
		{
			new iPlayers[32], iPlayersCount, iPlayer
			get_players(iPlayers, iPlayersCount)
			
			for(new i = 0; i < iPlayersCount; i++)
			{
				iPlayer = iPlayers[i]
				
				if(cs_get_user_team(iPlayer) == CS_TEAM_T)
				{
					give_item(iPlayer, "weapon_m4a1")
					give_item(iPlayer, "weapon_deagle")
	
					cs_set_user_bpammo(iPlayer, CSW_M4A1, 32)
					cs_set_user_bpammo(iPlayer, CSW_DEAGLE, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Prestrelka !")
				}
				else if(cs_get_user_team(iPlayer) == CS_TEAM_CT)
				{
					strip_user_weapons(iPlayer)
					give_item(iPlayer, "weapon_m4a1")
					give_item(iPlayer, "weapon_deagle")
	
					cs_set_user_bpammo(iPlayer, CSW_M4A1, 32)
					cs_set_user_bpammo(iPlayer, CSW_DEAGLE, 10)
	
					client_print(iPlayer, print_chat, "Zacal sa herny mod: Prestrelka !")
				}
			}
		}
	}
	
	menu_destroy(menu)
	
	return PLUGIN_HANDLED
}
A nejaká ľahšia možnosť by nebola? :)

Uživatelský avatar
Javierko
Zákaznická podpora
Příspěvky: 80
Registrován: 09 bře 2019 19:24
Bydliště: OnGameFrame()
Kontaktovat uživatele:

Příspěvek od Javierko » 19 zář 2019 19:49

Záleží, co konkrétně chcete mít lehčí :D Minimálně si můžete vytvořit funkci na to givování zbraní.
Pawn, SourcePawn, Web development, MySQL, Lua, ...

YouTube: https://www.youtube.com/c/Javierko21
Twitch: https://twitch.tv/javierko

Projects:
https://steamid.cz
https://hexmania.eu/

RayCodeCSC
Příspěvky: 48
Registrován: 11 črc 2019 23:52

Příspěvek od RayCodeCSC » 20 zář 2019 10:14

Tak som nakoniec skúsil ten script, ktorý ste mi napísal, a nefunguje. Cez compiler to prejde, ale na serveri to hráčom nedá zbrane.

Script: (trocha upravený)

Kód: Vybrat vše

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

#define AUTHOR "RayCodeCSC"
#define VERSION "1.0"
#define PLUGIN "Herne Mody"

new iPlayers[32], num, i, allPlayers

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

	register_clcmd("say /hernemody", "herne_mody_menu")
	register_clcmd("say /hm", "herne_mody_menu")
}

public herne_mody_menu(id)
{
	if(is_user_alive(id))
	{
		if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			new menu1 = menu_create("Vyber si herny mod:", "herne_mody_selection")

			menu_additem(menu1, "Scout")
			menu_additem(menu1, "Shark")

			menu_display(id, menu1)
		}
		else if(cs_get_user_team(id) == CS_TEAM_T)
		{
			client_print(id, print_chat, "[HERNE-MODY] Nie si dozorca!")
		}
	}
}

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

	switch(item)
	{
		case 0:
		{
			for(i = 0; i < num; i++)
			{
				get_players(iPlayers, num)
				allPlayers = iPlayers[i]

				if(is_user_alive(allPlayers))
				{
					if(cs_get_user_team(allPlayers) == CS_TEAM_T)
					{
						strip_user_weapons(allPlayers)
						give_item(allPlayers, "weapon_scout")
						cs_set_user_bpammo(allPlayers, CSW_SCOUT, 250)
					}
					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, 250)
					}
				}
			}
			client_print(allPlayers, print_chat, "[HERNE-MODY] Zacal sa herny mod: Scout!")
		}

		case 1:
		{
			for(i = 0; i < num; i++)
			{
				get_players(iPlayers, num)
				allPlayers = iPlayers[i]

				if(is_user_alive(allPlayers))
				{
					if(cs_get_user_team(allPlayers) == CS_TEAM_T)
					{
						strip_user_weapons(allPlayers)
						set_user_noclip(allPlayers, 1)
					}
					else if(cs_get_user_team(allPlayers) == CS_TEAM_CT)
					{
						set_user_health(allPlayers, 100)
						set_user_armor(allPlayers, 0)
					}
				}
			}
		}
	}
}

Uživatelský avatar
Escanor
Příspěvky: 16
Registrován: 17 zář 2019 21:52

Příspěvek od Escanor » 20 zář 2019 23:54

Skús toto.

Kód: Vybrat vše

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

#define AUTHOR "RayCodeCSC"
#define VERSION "1.0"
#define PLUGIN "Herne Mody"

new online_Players[33], numOfPlayers, playerID;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("say /hernemody", "herne_mody_menu")
	register_clcmd("say /hm", "herne_mody_menu")
}

public herne_mody_menu(id)
{
	if(is_user_alive(id))
	{
		if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			new menu1 = menu_create("Vyber si herny mod:", "herne_mody_selection")
			
			menu_additem(menu1, "Scout")
			menu_additem(menu1, "Shark")
			
			menu_display(id, menu1)
		}
		else if(cs_get_user_team(id) == CS_TEAM_T)
		{
			client_print(id, print_chat, "[HERNE-MODY] Nie si dozorca!")
		}
	}
}

public herne_mody_selection(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	switch(item)
	{
		case 0:
		{
			get_players(online_Players, numOfPlayers, "a");
			
			for(new i = 0; i < numOfPlayers; i++)
			{
				playerID = online_Players[i];
				if(is_user_connected(playerID) && is_user_alive(playerID)) {
					if(cs_get_user_team(playerID) == CS_TEAM_T)
					{
						strip_user_weapons(playerID)
						give_item(playerID, "weapon_scout")
						cs_set_user_bpammo(playerID, CSW_SCOUT, 250)
					}
					else if(cs_get_user_team(playerID) == CS_TEAM_CT)
					{
						strip_user_weapons(playerID)
						give_item(playerID, "weapon_scout")
						cs_set_user_bpammo(playerID, CSW_SCOUT, 250)
					}
				}
			}
			client_print(0, print_chat, "[HERNE-MODY] Zacal sa herny mod: Scout!")
		}
		
		case 1:
		{
			get_players(online_Players, numOfPlayers, "a");
			
			for(new i = 0; i < numOfPlayers; i++)
			{
				playerID = online_Players[i];
				if(is_user_connected(playerID) && is_user_alive(playerID)) {
					if(cs_get_user_team(playerID) == CS_TEAM_T)
					{
						strip_user_weapons(playerID)
						set_user_noclip(playerID, 1)
					}
					else if(cs_get_user_team(playerID) == CS_TEAM_CT)
					{
						set_user_health(playerID, 100)
						set_user_armor(playerID, 0)
					}
				}
			}
			client_print(0, print_chat, "[HERNE-MODY] Zacal sa herny mod: Shark!")
		}
	}
	return PLUGIN_HANDLED;
}
A toto už nikdy nerob!!!!

Kód: Vybrat vše

for(i = 0; i < num; i++)
{
	get_players(iPlayers, num)

Odpovědět