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
0
Jak pobrać id gracza znajdującego się na celowniku
Started By MarWit, 14.06.2011 17:18
10 replies to this topic
#1
Posted 14.06.2011 17:18
Mam małe pytanie a dokładniej jak pobrać id gracza znajdującego na obszarze celownika. Potrzebne mi to do pluginu typu: "Gdy klikniesz klawiszem E na graczu z drużyny przeciwnej zostaje on zamorzony na x sec"
#3
Posted 14.06.2011 17:54
hmm.. wiec uzycie tego na przykład tak powinno normalnie dzialac?
P.S. Mam jeszcze male pyt. odbiegające od tematu, a dokładniej jak zrobić nieskaczonosc magazynków.
new cel, body, distance = get_user_aiming(id, cel, body, distance)
if(cel != 0 && cel != id && button & IN_USE)
{
client_print(cel, print_center, "Gracz %s klikna na ciebie klawiszem E", id)
}
P.S. Mam jeszcze male pyt. odbiegające od tematu, a dokładniej jak zrobić nieskaczonosc magazynków.
Edited by MarWit, 14.06.2011 17:59.
#4
Posted 14.06.2011 18:09
Szukajmy gotowych rozwiązań
Attached Files
-
codperk_zwinnepalce.sma 1.8KB
42 downloads
codperk_zwinnepalce.amxx
Edited by kamioool, 14.06.2011 18:09.
#5
Posted 15.06.2011 11:32
@Kamibool thx.
Mógłby ktos napisać jak zastosować get_user_aiming w praktyce ?
Mógłby ktos napisać jak zastosować get_user_aiming w praktyce ?
Edited by MarWit, 15.06.2011 11:33.
#6
Posted 15.06.2011 22:24
new ent, body;
get_user_aiming(id, ent, body);
ent = id gracza obserwowanego
#7
Posted 16.06.2011 14:45
@diablix thx. Wiec mam male pytanie, czemu mi nie dziala cos takiego ??
#include <amxmodx>
#include <codmod>
#include <engine>
#include <fun>
#include <fakemeta>
#include <cstrike>
new const perk_name[] = "Hipnoza";
new const perk_desc[] = "Po wcisnieciu klawisza E na wrogu, zostaje zahipnotyzowany i nie moze poruszac sie przez 5sec.";
new bool:ma_perk[33]
new ilosc_uzyc[33] = 1 // Ilosc uzyc na runde
new czas_trwania = 5; //Czas trwania hipnozy
new bool:hipnoza[33] = false
new Float:stara_grawitacja, Float:stary_speed
public plugin_init()
{
register_plugin(perk_name, "1.0", ".:Vitek:.");
cod_register_perk(perk_name, perk_desc);
register_forward(FM_PlayerPreThink, "PlayerPreThink")
register_forward(FM_UpdateClientData, "UpdateClientData_Post", 1)
register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
}
public cod_perk_enabled(id)
{
ma_perk[id] = true
}
public cod_perk_disabled(id)
{
ma_perk[id] = false
}
public client_PreThink(id)
{
new cel, body, dystans
get_user_aiming(id, cel, body, dystans)
new button = get_user_button(id)
if(cel != 0 && cel != id && button & IN_USE && ma_perk[id] == true && hipnoza[cel] == false && ilosc_uzyc[id] > 0 && hipnoza[id] == false)
{
stara_grawitacja = get_user_gravity(cel)
stary_speed = get_user_maxspeed(cel)
set_user_gravity(cel, 3.0)
set_user_maxspeed(cel, 0.1)
hipnoza[cel] = true
ilosc_uzyc[id] = ilosc_uzyc[id] - 1
czas_trwania --
if(czas_trwania == 0)
{
set_user_gravity(cel, stara_grawitacja)
set_user_maxspeed(cel, stary_speed)
hipnoza[cel] = false
}
}
return PLUGIN_HANDLED
}
public PlayerPreThink(id)
{
if(!is_user_alive(id) || !(hipnoza[id] == true))
return FMRES_IGNORED
set_pev(id, pev_button, pev(id,pev_button) & ~IN_ATTACK)
return FMRES_HANDLED
}
public UpdateClientData_Post(id, sendweapons, cd_handle)
{
if(!is_user_alive(id) || !(hipnoza[id] == true))
return FMRES_IGNORED
set_cd(cd_handle, CD_ID, 0)
return FMRES_HANDLED
}
public Poczatek_Rundy()
{
ilosc_uzyc[0] = 1
}
Edited by MarWit, 16.06.2011 14:56.
#8
Posted 16.06.2011 17:38
public plugin_init(id)
{
register_plugin(perk_name, "1.0", ".:Vitek:.");
cod_register_perk(perk_name, perk_desc);
register_forward(FM_PlayerPreThink, "PlayerPreThink")
register_forward(FM_UpdateClientData, "UpdateClientData_Post", 1)
register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
register_forward(FM_CmdStart, "CmdStart");
}
public CmdStart(id, uc_handle)
{
if(!is_user_alive(id))
return FMRES_IGNORED;
new cel, body
get_user_aiming(id, cel, body)
new button = get_user_button(id)
// Jakim cudem id moze byc celem?
//if(cel != 0 && cel != id && button & IN_USE && ma_perk[id] == true && hipnoza[cel] == false && ilosc_uzyc[id] > 0 && hipnoza[id] == false)
if(cel != 0 && button & IN_USE && ma_perk[id] && !hipnoza[cel] && ilosc_uzyc[id] && !hipnoza[id])
{
stara_grawitacja = get_user_gravity(cel)
stary_speed = get_user_maxspeed(cel)
set_user_gravity(cel, 3.0)
set_user_maxspeed(cel, 0.1)
hipnoza[cel] = true
ilosc_uzyc[id]--
set_task(czas_trwania, "TaskRemoveHipnoza", cel + 123)
//Ustaw czas swoj
}
return FMRES_IGNORED;
}
public TaskRemoveHipnoza(cel)
{
cel -= 123
set_user_gravity(cel, stara_grawitacja)
set_user_maxspeed(cel, stary_speed)
hipnoza[cel] = false
}
Edited by ^Grzyboo, 16.06.2011 17:55.
#9
Posted 16.06.2011 19:12
Dzięki, jak ktoś może mi jeszcze powiedzieć co robi ten forward "CmdStart" będę wdzięczny
P.S. Nie ogarniam jeszcze fakemety
P.S. Nie ogarniam jeszcze fakemety
#10
Posted 17.06.2011 22:38
CmdStart = rozpoczęcie komendy, wywoływane jest gdy gracz użyje daną komendę bądź klawisz
#11
Posted 18.06.2011 11:16
Dziękuję wszystkim.
Temat do zamknięcia.
Temat do zamknięcia.