#include <amxmodx>
#include <cstrike>
#include <fakemeta_util> // wymagany modul
#define WAIT 5.0
new PLUG[] = "HNSExtras"
new VERS[] = "1.2"
new AUTH[] = "Stewie! Modifited by silversurfer"
new hnse_on;
new nade_on;
public plugin_init()
{
register_plugin(PLUG, VERS, AUTH);
register_cvar("HNSExtras", VERS, FCVAR_SERVER|FCVAR_UNLOGGED);
register_logevent("round_start", 2, "1=Round_Start");
register_forward(FM_ClientKill, "client_kill")
hnse_on = register_cvar("hnse_on", "1");
nade_on = register_cvar("hnse_nade_on", "1", ADMIN_ADMIN);
}
public round_start()
{
set_task(WAIT, "strip");
}
public strip()
{
if(get_pcvar_num(hnse_on))
{
new players[32], num;
get_players(players, num, "ah");
new player;
for(new i = 0; i < num; i++)
{
player = players[i];
cs_set_user_money(player, 0);
fm_give_item(player, "weapon_knife");
}
}
set_task(WAIT, "weapon_chance");
}
public weapon_chance()
{
new Players[32], playerCount, i, id;
get_players(Players, playerCount, "ah");
for(i=0; i<playerCount; i++)
{
id = Players[i];
new number = random_num(0, 100);
switch(number)
{
case 0 .. 49:
{
if(get_pcvar_num(nade_on))
{
new nade = fm_give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
cs_set_weapon_ammo(nade, 1);
client_print(id, print_chat, "[HE][50%%] Twoja nagroda to 1 granat HE!")
}
}
case 50 .. 100:
{
}
}
}
}
public client_kill(id)
{
if(is_user_alive(id))
{
console_print(id, "Nie mozesz sie teraz zabic!");
return PLUGIN_HANDLED;
}
else
{
console_print(id, "Mozesz zabic sie tylko wtedy gdy jestes zywy!")
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
50 % HE dla TT
Temat rozp. Kubaczek <3, 02.03.2010 10:50
7 odpowiedzi w tym temacie
#1
Napisano 02.03.2010 10:50
Cześć Chce zrobic aby TT mieli 50% szans na HE, ale nie idzie mi to. Jak dorobic do tego sprawdzanie czy gracz jest TT?
#2
Napisano 02.03.2010 11:00
Po co
Daj samo
Aby sprawdzić drużynę :
case 50 .. 100: { }?
Daj samo
case 0 .. 49: { if(get_pcvar_num(nade_on)) { new nade = fm_give_item(id, "weapon_hegrenade"); cs_set_user_bpammo(id, CSW_HEGRENADE, 0); cs_set_weapon_ammo(nade, 1); client_print(id, print_chat, "[HE][50%%] Twoja nagroda to 1 granat HE!") } }
Aby sprawdzić drużynę :
get_user_team(id) == 1 // TT get_user_team(id) == 2 // CT
#3
Napisano 02.03.2010 11:41
W ogóle po co takie wielkie losowanie ?
Jak 50% szans to wystarczy 0 i 1
Jak 50% szans to wystarczy 0 i 1
#4
Napisano 02.03.2010 15:36
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util> // wymagany modul
#define WAIT 5.0
new PLUG[] = "HNSExtras"
new VERS[] = "1.2"
new AUTH[] = "Stewie! Modifited by silversurfer"
new hnse_on;
new nade_on;
public plugin_init()
{
register_plugin(PLUG, VERS, AUTH);
register_cvar("HNSExtras", VERS, FCVAR_SERVER|FCVAR_UNLOGGED);
register_logevent("round_start", 2, "1=Round_Start");
register_forward(FM_ClientKill, "client_kill")
hnse_on = register_cvar("hnse_on", "1");
nade_on = register_cvar("hnse_nade_on", "1", ADMIN_ADMIN);
}
public round_start()
{
set_task(WAIT, "strip");
}
public strip()
{
if(get_pcvar_num(hnse_on))
{
new players[32], num;
get_players(players, num, "ah");
new player;
for(new i = 0; i < num; i++)
{
player = players[i];
cs_set_user_money(player, 0);
fm_give_item(player, "weapon_knife");
}
}
set_task(WAIT, "weapon_chance");
}
public weapon_chance()
{
new Players[32], playerCount, i, id;
get_players(Players, playerCount, "ah");
for(i=0; i<playerCount; i++)
{
id = Players[i];
new number = random_num(0, 1);
switch(number)
{
case 0:
{
if(get_pcvar_num(nade_on)&get_user_team(id) == 1)
{
new nade = fm_give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
cs_set_weapon_ammo(nade, 1);
client_print(id, print_chat, "[HE][50%%] Twoja nagroda to 1 granat HE!")
}
}
case 1:
{
}
}
}
}
public client_kill(id)
{
if(is_user_alive(id))
{
console_print(id, "Nie mozesz sie teraz zabic!");
return PLUGIN_HANDLED;
}
else
{
console_print(id, "Mozesz zabic sie tylko wtedy gdy jestes zywy!")
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
Tak może być ?
Użytkownik kubaku4 edytował ten post 02.03.2010 15:36
#5
Napisano 02.03.2010 15:45
Po co dawać
case 1:
{
}
jak w tym nic nie ma?
Jak będzie zero to normalnie pominie także nie musisz tego dodawać.
W client_kill(id) dajesz return FMRES_SUPERCEDE; nie return PLUGIN_HANDLED
case 1:
{
}
jak w tym nic nie ma?
Jak będzie zero to normalnie pominie także nie musisz tego dodawać.
W client_kill(id) dajesz return FMRES_SUPERCEDE; nie return PLUGIN_HANDLED
#include <amxmodx> #include <cstrike> #include <fakemeta_util> // wymagany modul #define WAIT 5.0 new PLUG[] = "HNSExtras" new VERS[] = "1.2" new AUTH[] = "Stewie! Modifited by silversurfer" new hnse_on; new nade_on; public plugin_init() { register_plugin(PLUG, VERS, AUTH); register_cvar("HNSExtras", VERS, FCVAR_SERVER|FCVAR_UNLOGGED); register_logevent("round_start", 2, "1=Round_Start"); register_forward(FM_ClientKill, "client_kill") hnse_on = register_cvar("hnse_on", "1"); nade_on = register_cvar("hnse_nade_on", "1", ADMIN_ADMIN); } public round_start() { set_task(WAIT, "strip"); } public strip() { if(get_pcvar_num(hnse_on)) { new players[32], num; get_players(players, num, "ah"); new player; for(new i = 0; i < num; i++) { player = players[i]; cs_set_user_money(player, 0); fm_give_item(player, "weapon_knife"); } } set_task(WAIT, "weapon_chance"); } public weapon_chance() { new Players[32], playerCount, i, id; get_players(Players, playerCount, "ah"); new number for(i=0; i<playerCount; i++) { id = Players[i]; number = random_num(0, 1); switch(number) { case 0: { if(get_pcvar_num(nade_on)&get_user_team(id) == 1) { new nade = fm_give_item(id, "weapon_hegrenade"); cs_set_user_bpammo(id, CSW_HEGRENADE, 0); cs_set_weapon_ammo(nade, 1); client_print(id, print_chat, "[HE][50%%] Twoja nagroda to 1 granat HE!") } } } } } public client_kill(id) { if(is_user_alive(id)) { console_print(id, "Nie mozesz sie teraz zabic!"); return FMRES_SUPERCEDE; // Handle nic nie da. } else { console_print(id, "Mozesz zabic sie tylko wtedy gdy jestes zywy!") return FMRES_SUPERCEDE; } return PLUGIN_CONTINUE; }
#6
Napisano 02.03.2010 16:25
Nie wiem po co wy sobie życie komplikujecie i jeszcze błędy robicie w if'ie nie & tylko &&
a poza tym nie łatwiej tak ?
i po co jeszcze to ?
wyjdzie na to samo
ew. jak tak bardzo chcesz ten napis w konsoli to
a poza tym nie łatwiej tak ?
if(get_pcvar_num(nade_on) && get_user_team(id) == 1 && !(random_num(0, 1)))
{
new nade = fm_give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
cs_set_weapon_ammo(nade, 1);
client_print(id, print_chat, "[HE][50%%] Twoja nagroda to 1 granat HE!")
}
i po co jeszcze to ?
public client_kill(id)jak i tak zawsze zwracasz FMRES_SUPERCEDE wystarczy
{
if(is_user_alive(id))
{
console_print(id, "Nie mozesz sie teraz zabic!");
return FMRES_SUPERCEDE; // Handle nic nie da.
}
else
{
console_print(id, "Mozesz zabic sie tylko wtedy gdy jestes zywy!")
return FMRES_SUPERCEDE;
}
return PLUGIN_CONTINUE;
}
public client_kill(id) return FMRES_SUPERCEDE;
wyjdzie na to samo
ew. jak tak bardzo chcesz ten napis w konsoli to
public client_kill(id)
{
console_print(id, "Nie mozesz sie teraz zabic!");
return FMRES_SUPERCEDE;
}
#7
Napisano 02.03.2010 16:38
Knopers:
get_pcvar_num(nade_on) - po co to w tym samym if'ie co przy kazdym graczu, skoro tak szybko sie cvary nie zmieniaja :F raz na funkcje starczy.
!(random_num(0, 1)) - nom negacja sprawia ze mamy 50% bo bez negaci by było nie te 50% co nam chodzi
get_pcvar_num(nade_on) - po co to w tym samym if'ie co przy kazdym graczu, skoro tak szybko sie cvary nie zmieniaja :F raz na funkcje starczy.
!(random_num(0, 1)) - nom negacja sprawia ze mamy 50% bo bez negaci by było nie te 50% co nam chodzi
#8
Napisano 02.03.2010 16:44
!(random_num(0, 1)) - nom negacja sprawia ze mamy 50% bo bez negaci by było nie te 50% co nam chodzi
On koniecznie chciał 0 to nich ma
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych