Skocz do zawartości

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.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Jetpack


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
6 odpowiedzi w tym temacie

#1 PiraT_

    Pomocny

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:45
  • Imię:Robert
  • Lokalizacja:Polska
Offline

Napisano 15.01.2021 16:34

Witam!

 

Czy ktoś mógłby dodać mi do jetpacka limit raz na mapę dla każdego gracza, oraz zakaz korzystania z jetpacka na trybie nemesis?

 

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <zombieplague>
#include <xs>
 
//Uncomment this if your server is running ZP50 and above.
//#define UseZP50
 
#if defined UseZP50
#tryinclude <zp50_core>
#tryinclude <zp50_items>
#tryinclude <zp50_ammopacks>
#tryinclude <zp50_class_survivor>
#else
#tryinclude <zombieplague>
#endif
 
new bool:bIsAlive[33], iGas[33], SprSmoke, iMaxClients, iItem
#define JpPower 400
#define JpUp 200.0
#define MaxGas 20
#define ClassnameJp "n4d_jetpack"
#define ModelJp "models/zs/p_jp2.mdl"
#define SoundFly "zs/fly2.wav"
#define SoundBlow "zs/blow.wav"
#define ItemName "ML_JETPACK"
#define ItemCost 50
 
public plugin_precache()
{
SprSmoke = precache_model("sprites/smoke.spr")
precache_model(ModelJp)
precache_sound(SoundFly)
precache_sound(SoundBlow)
}
 
public plugin_init()
{
register_plugin(ItemName, "0.0.1", "wbyokomo")
 
RegisterHam(Ham_Spawn, "player", "OnSpawnPost", 1)
RegisterHam(Ham_Killed, "player", "OnKilled")
register_forward(FM_ClientDisconnect, "OnClientDisconnect")
register_think(ClassnameJp, "OnThinkJetPack")
 
iMaxClients = get_maxplayers()
 
#if defined UseZP50
iItem = zp_items_register(ItemName, ItemCost)
#else
iItem = zp_register_extra_item(ItemName, ItemCost, ZP_TEAM_HUMAN)
#endif
 
register_clcmd("say /jp","CmdBuyJetPack")
register_dictionary("zombie_plague.txt")
}
 
//this forward is from CSBot_Init API by [email protected], see http://forums.alliedmods.net/showpost.php?s=3faa8633e3e2573157f4cd48fbd4e19e&p=2080292&postcount=15
public CSBot_Init(id)
{
RegisterHamFromEntity(Ham_Spawn, id, "OnSpawnPost", 1)
RegisterHamFromEntity(Ham_Killed, id, "OnKilled")
}
 
public OnClientDisconnect(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnSpawnPost(id)
{
if(!is_user_alive(id)) return;
 
bIsAlive[id] = true
}
 
public OnKilled(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnThinkJetPack(ent)
{
if(ent < 1) return;
 
static id; id = entity_get_edict(ent, EV_ENT_owner);
if(!(1<=id<=iMaxClients)) return;
if(!bIsAlive[id]) return;
 
static button; button = entity_get_int(id, EV_INT_button);
if((iGas[id] > 0) && (button & IN_DUCK) && (button & IN_JUMP))
{
static Float:Velocity[3], Float:Origin[3]
velocity_by_aim(id, JpPower, Velocity)
Velocity[2] = JpUp
entity_set_vector(id, EV_VEC_velocity, Velocity)
 
entity_get_vector(ent, EV_VEC_origin, Origin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_BEAMFOLLOW)
write_short(id)
write_short(SprSmoke)
write_byte(2)
write_byte(7)
write_byte(128)
write_byte(32)
write_byte(8)
write_byte(192)
message_end()
 
iGas[id]--
if(iGas[id] > 5) emit_sound(id, CHAN_WEAPON, SoundFly, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
else emit_sound(id, CHAN_WEAPON, SoundBlow, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
else
{
if((iGas[id] < MaxGas) && !(button & IN_DUCK) && !(button & IN_JUMP))
{
iGas[id]++
}
}
 
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}
 
public CmdBuyJetPack(id)
{
if(!bIsAlive[id]) return PLUGIN_HANDLED;
 
#if defined UseZP50
if(zp_core_is_zombie(id)) return PLUGIN_HANDLED;
if(zp_class_survivor_get(id)) return PLUGIN_HANDLED;
#else
if(zp_get_user_zombie(id)) return PLUGIN_HANDLED;
if(zp_get_user_survivor(id)) return PLUGIN_HANDLED;
#endif
 
static iAP
#if defined UseZP50
iAP = zp_ammopacks_get(id)
#else
iAP = zp_get_user_ammo_packs(id)
#endif
if(iAP < ItemCost) return PLUGIN_HANDLED;
if(IsPlayerHasJetPack(id)) return PLUGIN_HANDLED;
 
CreateJetPack(id)
#if defined UseZP50
zp_ammopacks_set(id, iAP-ItemCost)
#else
zp_set_user_ammo_packs(id, iAP-ItemCost)
#endif
client_print(id, print_chat, "[ZP] Kupiles JetPack, like a Boss. Przytrzymaj SKOK+KUCANIE aby poleciec.")
 
return PLUGIN_HANDLED;
}
 
#if defined UseZP50
public zp_fw_items_select_pre(id, item, ignorecost)
{
if(item != iItem) return ZP_ITEM_AVAILABLE;
if(zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW;
if(IsPlayerHasJetPack(id)) return ZP_ITEM_NOT_AVAILABLE;
 
return ZP_ITEM_AVAILABLE;
}
 
public zp_fw_items_select_post(id, item, ignorecost)
{
if(item != iItem) return;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
public zp_fw_core_infect_post(id)
{
ResetJetPack(id)
}
 
public zp_fw_core_cure_post(id)
{
ResetJetPack(id)
}
#else
public zp_extra_item_selected(id, item)
{
if(item == iItem)
{
if(IsPlayerHasJetPack(id)) return ZP_PLUGIN_HANDLED;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
return PLUGIN_CONTINUE;
}
 
public zp_user_infected_post(id)
{
ResetJetPack(id)
}
 
public zp_user_humanized_post(id)
{
ResetJetPack(id)
}
#endif
 
CreateJetPack(id)
{
new ent = create_entity("info_target")
if(ent < 1) return;
 
new Float:Origin[3]
entity_get_vector(id, EV_VEC_origin, Origin)
entity_set_string(ent, EV_SZ_classname, ClassnameJp)
entity_set_model(ent, ModelJp)
entity_set_origin(ent, Origin)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(ent, EV_ENT_aiment, id)
entity_set_int(ent, EV_INT_solid, SOLID_NOT)
entity_set_size(ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0})
entity_set_edict(ent, EV_ENT_owner, id)
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}
 
RemovePlayerJetPack(id)
{
new ent = -1
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) != id) continue;
 
entity_set_float(ent, EV_FL_nextthink, 0.0)
remove_entity(ent)
}
}
 
IsPlayerHasJetPack(id)
{
new ent = -1
new bHasJP = 0
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) == id)
{
bHasJP = 1
break;
}
}
 
return bHasJP;
}
 
ResetJetPack(id)
{
iGas[id] = MaxGas
RemovePlayerJetPack(id)
}

  • +
  • -
  • 0

#2 Vakos

    Wszechwidzący

  • Użytkownik

Reputacja: 51
Pomocny

  • Postów:237
  • GG:
  • Steam:steam
  • Imię:Marcin
  • Lokalizacja:Opolskie
Online

Napisano 15.01.2021 19:57

zakaz korzystania z jetpacka na trybie nemesis

 

Poszukaj w tej bibliotece (bądź jeżeli masz jeszcze jakieś inne do ZP to też):

#include <zombieplague>

Czy masz, gdzieś tam coś dodane w stylu:

zp_get_user_nemesis(id)

Albo coś podobnego co zarządza tym trybem.

Wtedy możesz zrobić np: if'a w którym na tym trybie blokujesz używania jetpacka.


Użytkownik Vakos edytował ten post 15.01.2021 19:57

  • +
  • -
  • 0

#3 dredek

    Wszechobecny

  • Użytkownik

Reputacja: 162
Profesjonalista

  • Postów:475
  • GG:
  • Imię:Dawid
  • Lokalizacja:OLK
Offline

Napisano 15.01.2021 20:34

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <zombieplague>
#include <xs>
 
//Uncomment this if your server is running ZP50 and above.
//#define UseZP50
 
#if defined UseZP50
#tryinclude <zp50_core>
#tryinclude <zp50_items>
#tryinclude <zp50_ammopacks>
#tryinclude <zp50_class_survivor>
#else
#tryinclude <zombieplague>
#endif
 
new bool:bIsAlive[33], iGas[33], SprSmoke, iMaxClients, iItem
#define JpPower 400
#define JpUp 200.0
#define MaxGas 20
#define ClassnameJp "n4d_jetpack"
#define ModelJp "models/zs/p_jp2.mdl"
#define SoundFly "zs/fly2.wav"
#define SoundBlow "zs/blow.wav"
#define ItemName "ML_JETPACK"
#define ItemCost 50

new bool:kupil[33]
 
public plugin_precache()
{
SprSmoke = precache_model("sprites/smoke.spr")
precache_model(ModelJp)
precache_sound(SoundFly)
precache_sound(SoundBlow)
}
 
public plugin_init()
{
register_plugin(ItemName, "0.0.1", "wbyokomo")
 
RegisterHam(Ham_Spawn, "player", "OnSpawnPost", 1)
RegisterHam(Ham_Killed, "player", "OnKilled")
register_forward(FM_ClientDisconnect, "OnClientDisconnect")
register_think(ClassnameJp, "OnThinkJetPack")
 
iMaxClients = get_maxplayers()
 
#if defined UseZP50
iItem = zp_items_register(ItemName, ItemCost)
#else
iItem = zp_register_extra_item(ItemName, ItemCost, ZP_TEAM_HUMAN)
#endif
 
register_clcmd("say /jp","CmdBuyJetPack")
register_dictionary("zombie_plague.txt")
}
 
//this forward is from CSBot_Init API by [email protected], see http://forums.alliedmods.net/showpost.php?s=3faa8633e3e2573157f4cd48fbd4e19e&p=2080292&postcount=15
public CSBot_Init(id)
{
RegisterHamFromEntity(Ham_Spawn, id, "OnSpawnPost", 1)
RegisterHamFromEntity(Ham_Killed, id, "OnKilled")
}
 
public OnClientDisconnect(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnSpawnPost(id)
{
if(!is_user_alive(id)) return;
 
bIsAlive[id] = true
}
 
public OnKilled(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnThinkJetPack(ent)
{
if(ent < 1) return;
 
static id; id = entity_get_edict(ent, EV_ENT_owner);
if(!(1<=id<=iMaxClients)) return;
if(!bIsAlive[id]) return;
 
static button; button = entity_get_int(id, EV_INT_button);
if((iGas[id] > 0) && (button & IN_DUCK) && (button & IN_JUMP))
{
static Float:Velocity[3], Float:Origin[3]
velocity_by_aim(id, JpPower, Velocity)
Velocity[2] = JpUp
entity_set_vector(id, EV_VEC_velocity, Velocity)
 
entity_get_vector(ent, EV_VEC_origin, Origin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_BEAMFOLLOW)
write_short(id)
write_short(SprSmoke)
write_byte(2)
write_byte(7)
write_byte(128)
write_byte(32)
write_byte(8)
write_byte(192)
message_end()
 
iGas[id]--
if(iGas[id] > 5) emit_sound(id, CHAN_WEAPON, SoundFly, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
else emit_sound(id, CHAN_WEAPON, SoundBlow, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
else
{
if((iGas[id] < MaxGas) && !(button & IN_DUCK) && !(button & IN_JUMP))
{
iGas[id]++
}
}
 
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}

 

public client_authorized(id)
{
    kupil[id] = false;
}
 
public CmdBuyJetPack(id)
{
if(!bIsAlive[id]) return PLUGIN_HANDLED;
 
#if defined UseZP50
if(zp_core_is_zombie(id)) return PLUGIN_HANDLED;
if(zp_class_survivor_get(id)) return PLUGIN_HANDLED;
#else
if(zp_get_user_zombie(id)) return PLUGIN_HANDLED;
if(zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
if(zp_get_user_survivor(id)) return PLUGIN_HANDLED;
if(kupil[id]) return PLUGIN_HANDLED;
#endif
 
static iAP
#if defined UseZP50
iAP = zp_ammopacks_get(id)
#else
iAP = zp_get_user_ammo_packs(id)
#endif
if(iAP < ItemCost) return PLUGIN_HANDLED;
if(IsPlayerHasJetPack(id)) return PLUGIN_HANDLED;

CreateJetPack(id)
#if defined UseZP50
zp_ammopacks_set(id, iAP-ItemCost)
#else
zp_set_user_ammo_packs(id, iAP-ItemCost)
#endif
client_print(id, print_chat, "[ZP] Kupiles JetPack, like a Boss. Przytrzymaj SKOK+KUCANIE aby poleciec.")

kupil[id] = true;
 
return PLUGIN_HANDLED;
}
 
#if defined UseZP50
public zp_fw_items_select_pre(id, item, ignorecost)
{
if(item != iItem) return ZP_ITEM_AVAILABLE;
if(zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW;
if(IsPlayerHasJetPack(id)) return ZP_ITEM_NOT_AVAILABLE;
 
return ZP_ITEM_AVAILABLE;
}
 
public zp_fw_items_select_post(id, item, ignorecost)
{
if(item != iItem) return;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
public zp_fw_core_infect_post(id)
{
ResetJetPack(id)
}
 
public zp_fw_core_cure_post(id)
{
ResetJetPack(id)
}
#else
public zp_extra_item_selected(id, item)
{
if(item == iItem)
{
if(IsPlayerHasJetPack(id)) return ZP_PLUGIN_HANDLED;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
return PLUGIN_CONTINUE;
}
 
public zp_user_infected_post(id)
{
ResetJetPack(id)
}
 
public zp_user_humanized_post(id)
{
ResetJetPack(id)
}
#endif
 
CreateJetPack(id)
{
new ent = create_entity("info_target")
if(ent < 1) return;
 
new Float:Origin[3]
entity_get_vector(id, EV_VEC_origin, Origin)
entity_set_string(ent, EV_SZ_classname, ClassnameJp)
entity_set_model(ent, ModelJp)
entity_set_origin(ent, Origin)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(ent, EV_ENT_aiment, id)
entity_set_int(ent, EV_INT_solid, SOLID_NOT)
entity_set_size(ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0})
entity_set_edict(ent, EV_ENT_owner, id)
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}
 
RemovePlayerJetPack(id)
{
new ent = -1
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) != id) continue;
 
entity_set_float(ent, EV_FL_nextthink, 0.0)
remove_entity(ent)
}
}
 
IsPlayerHasJetPack(id)
{
new ent = -1
new bHasJP = 0
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) == id)
{
bHasJP = 1
break;
}
}
 
return bHasJP;
}
 
ResetJetPack(id)
{
iGas[id] = MaxGas
RemovePlayerJetPack(id)
}
 


Użytkownik dredek edytował ten post 15.01.2021 20:39

  • +
  • -
  • 0

#4 PiraT_

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 1
Nowy

  • Postów:45
  • Imię:Robert
  • Lokalizacja:Polska
Offline

Napisano 15.01.2021 23:20

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <zombieplague>
#include <xs>
 
//Uncomment this if your server is running ZP50 and above.
//#define UseZP50
 
#if defined UseZP50
#tryinclude <zp50_core>
#tryinclude <zp50_items>
#tryinclude <zp50_ammopacks>
#tryinclude <zp50_class_survivor>
#else
#tryinclude <zombieplague>
#endif
 
new bool:bIsAlive[33], iGas[33], SprSmoke, iMaxClients, iItem
#define JpPower 400
#define JpUp 200.0
#define MaxGas 20
#define ClassnameJp "n4d_jetpack"
#define ModelJp "models/zs/p_jp2.mdl"
#define SoundFly "zs/fly2.wav"
#define SoundBlow "zs/blow.wav"
#define ItemName "ML_JETPACK"
#define ItemCost 50

new bool:kupil[33]
 
public plugin_precache()
{
SprSmoke = precache_model("sprites/smoke.spr")
precache_model(ModelJp)
precache_sound(SoundFly)
precache_sound(SoundBlow)
}
 
public plugin_init()
{
register_plugin(ItemName, "0.0.1", "wbyokomo")
 
RegisterHam(Ham_Spawn, "player", "OnSpawnPost", 1)
RegisterHam(Ham_Killed, "player", "OnKilled")
register_forward(FM_ClientDisconnect, "OnClientDisconnect")
register_think(ClassnameJp, "OnThinkJetPack")
 
iMaxClients = get_maxplayers()
 
#if defined UseZP50
iItem = zp_items_register(ItemName, ItemCost)
#else
iItem = zp_register_extra_item(ItemName, ItemCost, ZP_TEAM_HUMAN)
#endif
 
register_clcmd("say /jp","CmdBuyJetPack")
register_dictionary("zombie_plague.txt")
}
 
//this forward is from CSBot_Init API by [email protected], see http://forums.alliedmods.net/showpost.php?s=3faa8633e3e2573157f4cd48fbd4e19e&p=2080292&postcount=15
public CSBot_Init(id)
{
RegisterHamFromEntity(Ham_Spawn, id, "OnSpawnPost", 1)
RegisterHamFromEntity(Ham_Killed, id, "OnKilled")
}
 
public OnClientDisconnect(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnSpawnPost(id)
{
if(!is_user_alive(id)) return;
 
bIsAlive[id] = true
}
 
public OnKilled(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnThinkJetPack(ent)
{
if(ent < 1) return;
 
static id; id = entity_get_edict(ent, EV_ENT_owner);
if(!(1<=id<=iMaxClients)) return;
if(!bIsAlive[id]) return;
 
static button; button = entity_get_int(id, EV_INT_button);
if((iGas[id] > 0) && (button & IN_DUCK) && (button & IN_JUMP))
{
static Float:Velocity[3], Float:Origin[3]
velocity_by_aim(id, JpPower, Velocity)
Velocity[2] = JpUp
entity_set_vector(id, EV_VEC_velocity, Velocity)
 
entity_get_vector(ent, EV_VEC_origin, Origin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_BEAMFOLLOW)
write_short(id)
write_short(SprSmoke)
write_byte(2)
write_byte(7)
write_byte(128)
write_byte(32)
write_byte(8)
write_byte(192)
message_end()
 
iGas[id]--
if(iGas[id] > 5) emit_sound(id, CHAN_WEAPON, SoundFly, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
else emit_sound(id, CHAN_WEAPON, SoundBlow, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
else
{
if((iGas[id] < MaxGas) && !(button & IN_DUCK) && !(button & IN_JUMP))
{
iGas[id]++
}
}
 
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}

 

public client_authorized(id)
{
    kupil[id] = false;
}
 
public CmdBuyJetPack(id)
{
if(!bIsAlive[id]) return PLUGIN_HANDLED;
 
#if defined UseZP50
if(zp_core_is_zombie(id)) return PLUGIN_HANDLED;
if(zp_class_survivor_get(id)) return PLUGIN_HANDLED;
#else
if(zp_get_user_zombie(id)) return PLUGIN_HANDLED;
if(zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
if(zp_get_user_survivor(id)) return PLUGIN_HANDLED;
if(kupil[id]) return PLUGIN_HANDLED;
#endif
 
static iAP
#if defined UseZP50
iAP = zp_ammopacks_get(id)
#else
iAP = zp_get_user_ammo_packs(id)
#endif
if(iAP < ItemCost) return PLUGIN_HANDLED;
if(IsPlayerHasJetPack(id)) return PLUGIN_HANDLED;

CreateJetPack(id)
#if defined UseZP50
zp_ammopacks_set(id, iAP-ItemCost)
#else
zp_set_user_ammo_packs(id, iAP-ItemCost)
#endif
client_print(id, print_chat, "[ZP] Kupiles JetPack, like a Boss. Przytrzymaj SKOK+KUCANIE aby poleciec.")

kupil[id] = true;
 
return PLUGIN_HANDLED;
}
 
#if defined UseZP50
public zp_fw_items_select_pre(id, item, ignorecost)
{
if(item != iItem) return ZP_ITEM_AVAILABLE;
if(zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW;
if(IsPlayerHasJetPack(id)) return ZP_ITEM_NOT_AVAILABLE;
 
return ZP_ITEM_AVAILABLE;
}
 
public zp_fw_items_select_post(id, item, ignorecost)
{
if(item != iItem) return;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
public zp_fw_core_infect_post(id)
{
ResetJetPack(id)
}
 
public zp_fw_core_cure_post(id)
{
ResetJetPack(id)
}
#else
public zp_extra_item_selected(id, item)
{
if(item == iItem)
{
if(IsPlayerHasJetPack(id)) return ZP_PLUGIN_HANDLED;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
return PLUGIN_CONTINUE;
}
 
public zp_user_infected_post(id)
{
ResetJetPack(id)
}
 
public zp_user_humanized_post(id)
{
ResetJetPack(id)
}
#endif
 
CreateJetPack(id)
{
new ent = create_entity("info_target")
if(ent < 1) return;
 
new Float:Origin[3]
entity_get_vector(id, EV_VEC_origin, Origin)
entity_set_string(ent, EV_SZ_classname, ClassnameJp)
entity_set_model(ent, ModelJp)
entity_set_origin(ent, Origin)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(ent, EV_ENT_aiment, id)
entity_set_int(ent, EV_INT_solid, SOLID_NOT)
entity_set_size(ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0})
entity_set_edict(ent, EV_ENT_owner, id)
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}
 
RemovePlayerJetPack(id)
{
new ent = -1
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) != id) continue;
 
entity_set_float(ent, EV_FL_nextthink, 0.0)
remove_entity(ent)
}
}
 
IsPlayerHasJetPack(id)
{
new ent = -1
new bHasJP = 0
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) == id)
{
bHasJP = 1
break;
}
}
 
return bHasJP;
}
 
ResetJetPack(id)
{
iGas[id] = MaxGas
RemovePlayerJetPack(id)
}
 

Nie chce działać, możesz dać zamiast limitu na jedną mapę, to żeby po rundzie jetpack zniknął dla gracza?


  • +
  • -
  • 0

#5 Rivit

    Godlike

  • Support Team

Reputacja: 1 274
Godlike

  • Postów:4 290
Offline

Napisano 15.01.2021 23:33

 

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <zombieplague>
#include <xs>
 
//Uncomment this if your server is running ZP50 and above.
//#define UseZP50
 
#if defined UseZP50
#tryinclude <zp50_core>
#tryinclude <zp50_items>
#tryinclude <zp50_ammopacks>
#tryinclude <zp50_class_survivor>
#else
#tryinclude <zombieplague>
#endif
 
new bool:bIsAlive[33], iGas[33], SprSmoke, iMaxClients, iItem
#define JpPower 400
#define JpUp 200.0
#define MaxGas 20
#define ClassnameJp "n4d_jetpack"
#define ModelJp "models/zs/p_jp2.mdl"
#define SoundFly "zs/fly2.wav"
#define SoundBlow "zs/blow.wav"
#define ItemName "ML_JETPACK"
#define ItemCost 50

new bool:kupil[33]
 
public plugin_precache()
{
SprSmoke = precache_model("sprites/smoke.spr")
precache_model(ModelJp)
precache_sound(SoundFly)
precache_sound(SoundBlow)
}
 
public plugin_init()
{
register_plugin(ItemName, "0.0.1", "wbyokomo")
 
RegisterHam(Ham_Spawn, "player", "OnSpawnPost", 1)
RegisterHam(Ham_Killed, "player", "OnKilled")
register_forward(FM_ClientDisconnect, "OnClientDisconnect")
register_think(ClassnameJp, "OnThinkJetPack")
 
iMaxClients = get_maxplayers()
 
#if defined UseZP50
iItem = zp_items_register(ItemName, ItemCost)
#else
iItem = zp_register_extra_item(ItemName, ItemCost, ZP_TEAM_HUMAN)
#endif
 
register_clcmd("say /jp","CmdBuyJetPack")
register_dictionary("zombie_plague.txt")
}
 
//this forward is from CSBot_Init API by [email protected], see http://forums.alliedmods.net/showpost.php?s=3faa8633e3e2573157f4cd48fbd4e19e&p=2080292&postcount=15
public CSBot_Init(id)
{
RegisterHamFromEntity(Ham_Spawn, id, "OnSpawnPost", 1)
RegisterHamFromEntity(Ham_Killed, id, "OnKilled")
}
 
public OnClientDisconnect(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnSpawnPost(id)
{
if(!is_user_alive(id)) return;
 
bIsAlive[id] = true
}
 
public OnKilled(id)
{
bIsAlive[id] = false
ResetJetPack(id)
}
 
public OnThinkJetPack(ent)
{
if(ent < 1) return;
 
static id; id = entity_get_edict(ent, EV_ENT_owner);
if(!(1<=id<=iMaxClients)) return;
if(!bIsAlive[id]) return;
 
static button; button = entity_get_int(id, EV_INT_button);
if((iGas[id] > 0) && (button & IN_DUCK) && (button & IN_JUMP))
{
static Float:Velocity[3], Float:Origin[3]
velocity_by_aim(id, JpPower, Velocity)
Velocity[2] = JpUp
entity_set_vector(id, EV_VEC_velocity, Velocity)
 
entity_get_vector(ent, EV_VEC_origin, Origin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_BEAMFOLLOW)
write_short(id)
write_short(SprSmoke)
write_byte(2)
write_byte(7)
write_byte(128)
write_byte(32)
write_byte(8)
write_byte(192)
message_end()
 
iGas[id]--
if(iGas[id] > 5) emit_sound(id, CHAN_WEAPON, SoundFly, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
else emit_sound(id, CHAN_WEAPON, SoundBlow, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
else
{
if((iGas[id] < MaxGas) && !(button & IN_DUCK) && !(button & IN_JUMP))
{
iGas[id]++
}
}
 
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}

 

public client_authorized(id)
{
    kupil[id] = false;
}
 
public CmdBuyJetPack(id)
{
if(!bIsAlive[id]) return PLUGIN_HANDLED;
 
#if defined UseZP50
if(zp_core_is_zombie(id)) return PLUGIN_HANDLED;
if(zp_class_survivor_get(id)) return PLUGIN_HANDLED;
#else
if(zp_get_user_zombie(id)) return PLUGIN_HANDLED;
if(zp_get_user_nemesis(id)) return PLUGIN_HANDLED;
if(zp_get_user_survivor(id)) return PLUGIN_HANDLED;
if(kupil[id]) return PLUGIN_HANDLED;
#endif
 
static iAP
#if defined UseZP50
iAP = zp_ammopacks_get(id)
#else
iAP = zp_get_user_ammo_packs(id)
#endif
if(iAP < ItemCost) return PLUGIN_HANDLED;
if(IsPlayerHasJetPack(id)) return PLUGIN_HANDLED;

CreateJetPack(id)
#if defined UseZP50
zp_ammopacks_set(id, iAP-ItemCost)
#else
zp_set_user_ammo_packs(id, iAP-ItemCost)
#endif
client_print(id, print_chat, "[ZP] Kupiles JetPack, like a Boss. Przytrzymaj SKOK+KUCANIE aby poleciec.")

kupil[id] = true;
 
return PLUGIN_HANDLED;
}
 
#if defined UseZP50
public zp_fw_items_select_pre(id, item, ignorecost)
{
if(item != iItem) return ZP_ITEM_AVAILABLE;
if(zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW;
if(IsPlayerHasJetPack(id)) return ZP_ITEM_NOT_AVAILABLE;
 
return ZP_ITEM_AVAILABLE;
}
 
public zp_fw_items_select_post(id, item, ignorecost)
{
if(item != iItem) return;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
public zp_fw_core_infect_post(id)
{
ResetJetPack(id)
}
 
public zp_fw_core_cure_post(id)
{
ResetJetPack(id)
}
#else
public zp_extra_item_selected(id, item)
{
if(item == iItem)
{
if(IsPlayerHasJetPack(id)) return ZP_PLUGIN_HANDLED;
 
CreateJetPack(id)
client_print(id, print_chat, "[ZP] You just bought a JetPack, fly like a BOSS. Hold JUMP+DUCK to fly.")
}
 
return PLUGIN_CONTINUE;
}
 
public zp_user_infected_post(id)
{
ResetJetPack(id)
}
 
public zp_user_humanized_post(id)
{
ResetJetPack(id)
}
#endif
 
CreateJetPack(id)
{
new ent = create_entity("info_target")
if(ent < 1) return;
 
new Float:Origin[3]
entity_get_vector(id, EV_VEC_origin, Origin)
entity_set_string(ent, EV_SZ_classname, ClassnameJp)
entity_set_model(ent, ModelJp)
entity_set_origin(ent, Origin)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(ent, EV_ENT_aiment, id)
entity_set_int(ent, EV_INT_solid, SOLID_NOT)
entity_set_size(ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0})
entity_set_edict(ent, EV_ENT_owner, id)
entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1)
}
 
RemovePlayerJetPack(id)
{
new ent = -1
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) != id) continue;
 
entity_set_float(ent, EV_FL_nextthink, 0.0)
remove_entity(ent)
}
}
 
IsPlayerHasJetPack(id)
{
new ent = -1
new bHasJP = 0
while((ent = find_ent_by_class(ent, ClassnameJp)))
{
if(entity_get_edict(ent, EV_ENT_owner) == id)
{
bHasJP = 1
break;
}
}
 
return bHasJP;
}
 
ResetJetPack(id)
{
iGas[id] = MaxGas
RemovePlayerJetPack(id)
}
 

Nie chce działać, możesz dać zamiast limitu na jedną mapę, to żeby po rundzie jetpack zniknął dla gracza?

 

Polecam kod wstawiać w załącznik oraz nie cytować długich wiadomości, bo przegląda się to tragicznie.


  • +
  • -
  • 1

Na PW pomagam tylko odpłatnie. Przyjmuje zlecenia.

Wypociny: https://github.com/r...98/AMXX_plugins


#6 dredek

    Wszechobecny

  • Użytkownik

Reputacja: 162
Profesjonalista

  • Postów:475
  • GG:
  • Imię:Dawid
  • Lokalizacja:OLK
Offline

Napisano 15.01.2021 23:42

W jakim sensie zniknął? Żeby nie był widoczny w sklepie?


  • +
  • -
  • 0

#7 PiraT_

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 1
Nowy

  • Postów:45
  • Imię:Robert
  • Lokalizacja:Polska
Offline

Napisano 16.01.2021 11:58

W jakim sensie zniknął? Żeby nie był widoczny w sklepie?

Żeby po rundzie gdy gracz zakupił jetpacka zniknął z ekwipunku tej osoby (stracił go, i kupił sobie następny)


  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych


Coinsy CSGOAtse Za SMS, PSC , Przelew - CoinSell.pl