←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

Nowy granat?

Zablokowany

  • +
  • -
ReKsiu - zdjęcie ReKsiu 13.12.2009

Jak otrzymać efekt ,abym po wpisaniu komendy /suphe
Dostał HE z innym modelem i większym DMG. (zabija od razu)
Komendę możemy sobie pominąć ale jak utworzyć takie coś.
Poprosiłbym o poradniczek albo jakieś wskazówki jak to wykonać.
Ma być tylko dla tego 1 Granata po wpisaniu komendy.
Odpowiedz

  • +
  • -
Adi^ - zdjęcie Adi^ 13.12.2009

Żeby zmienić obrażenia, najlepiej przeczytaj ten poradnik.
Odpowiedz

  • +
  • -
ReKsiu - zdjęcie ReKsiu 13.12.2009

No tak to wiem ,ale jak zdefiniować że to jest ten granat?
Jak go przedstawić? Użyć zmiennej globalnej której na początku nadać 0.
Potem gdy kupi nadać 1. I odnosić się do broni i zmiennej?
Odpowiedz

  • +
  • -
Knopers - zdjęcie Knopers 13.12.2009

Tak zrobić najlepiej , Zmienna Globalna typu bool = false , gracz kupił granata dostaje granat zmieniasz wartość na true, przy evencie cur weapon sprawdz czy gracz wybrał granat , jeśli tak to sprawdź czy zmienna jest true czy false ,jesli true to zmień model,
w evencie zadawania obrażeń sprawdź czy atakujący zadał obrażenia z granatu , jeśli tak to sprawdź czy atakujący miał zmienna true czy false , jeśli true to zwieksz obrażenia ,jeśli false to zostaw takie jakie są .
Odpowiedz

  • +
  • -
Misiaczek ;c - zdjęcie Misiaczek ;c 13.12.2009

wystarczy poszperac w google :P

/********************************************************************************
* Super HE Grenades
* By pcboy
* Version 1.1
*
* For Counter-Strike 1.6 ONLY
* Category: Fun Stuff
*
* E-mail: [email protected] (DO NOT SPAM)
* MSN: [email protected]
* ICQ: 145-143-474 (Need to be authorized)
*
*********************************************************************************
* This plugin was created under the encouragements by Charming and Mini_Midget. *
* Without you, I won't script plugins anymore. *
* People who discourage me please get away and don't use this plugin. *
*********************************************************************************
*
************************************ Credits ************************************
* T(+)rget
* Helped me, with the extra damage in he grenades
*********************************************************************************
*
******************************* What does this do *******************************
This plugin lets you to buy super HE grenades. Super HE grenades are with
higher damage.
*********************************************************************************
*
************************************* CVARs *************************************
* amx_supnades
* Values avaliable: 0 or 1 only
* Default: 1
*
* amx_suphecost
* Values avaliable: Any integers
* Default: 600
* The cost of a super HE grenade.
*********************************************************************************
*
******************************** Client Commands ********************************
* say /showprices
* Flags needed: User (Anyone)
* Show the prices of a super HE grenade and a super flashbang.
*
* say /buyhe
* Flags needed: User (Anyone)
* Buy a super HE grenade
*********************************************************************************
*
*********************************** Changelog ***********************************
* 1.0.2
* Minor update. Just added suphe_version cvar for finding server easily.
*
* 1.0.1
* Fixed buy time bug
*
* 1.0
* Initial Release
********************************************************************************/

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <engine>

new bool:hasHE[33]
new price
new bool:buy_allow[33]
new bool:buying
// new gmsgDeathMsg // For 1.1 use

public plugin_init() {
register_plugin("Super HE Grenades", "1.0.2", "pcboy")

// gmsgDeathMsg = get_user_msgid("DeathMsg") // For 1.1 use

register_cvar("suphe_version", "1.0.2")
register_cvar("amx_supnades", "1")
register_cvar("amx_suphecost", "600")

register_clcmd("say /showprices", "showPrices")
register_clcmd("say /buyhe", "buyHe")

register_event("ResetHUD", "advertiseSupHE", "b")
register_event("Damage", "Damage_event", "b", "2>0")

set_task(1.0, "checkCost")

register_event("StatusIcon", "buyzone_icon", "be", "2=buyzone")
register_event("RoundTime", "RoundTime_event", "bc")
}

public client_connect(id) {
hasHE[id] = false
}

public client_disconnect(id) {
hasHE[id] = false
}

public checkCost() {
price = get_cvar_num("amx_suphecost")
if (price <= 0) {
set_cvar_num("amx_suphecost", 600)
server_print("[i][Super HE Grenades] The cost of a super HE grenade has been changed to $600 due to the value is too low.")
}
if (price > 16000) {
set_cvar_num("amx_suphecost", 600)
server_print("[i][Super HE Grenades] The cost of a super HE grenade has been changed to $600 due to the value is too high.")
}

set_task(1.0, "checkCost")
}

public advertiseSupHE(id) {
price = get_cvar_num("amx_suphecost")

if(!get_cvar_num("amx_supnades")) return PLUGIN_HANDLED

client_print(id, print_chat, "[i] Super HE Grenades is enabled on this server.")
client_print(id, print_chat, "[i] 1 Super HE Grenade costs $%i.", price)
client_print(id, print_chat, "[i] Say ^"/buyhe^" to buy one.")

return PLUGIN_HANDLED
}

public showPrices(id) {
price = get_cvar_num("amx_suphecost")

if (!get_cvar_num("amx_supnades")) {
client_print(id, print_chat, "[X] The plugin is disabled!")
return PLUGIN_HANDLED
}

client_print(id, print_chat, "[i] A super HE Grenade costs $%i.", price)
client_print(id, print_chat, "[i] Say ^"/buyhe^" to buy one.")

return PLUGIN_HANDLED
}

public buyHe(id) {
price = get_cvar_num("amx_suphecost")

if (!get_cvar_num("amx_supnades")) {
client_print(id, print_chat, "[X] The plugin is disabled!")
return PLUGIN_HANDLED
}

if(!is_user_alive(id)) {
client_print(id, print_chat, "[X] Dead men buy nothing.")
return PLUGIN_HANDLED
}

new myMoney = cs_get_user_money(id)
new myMoneyleft = myMoney-price

if (price > myMoney) {
client_print(id , print_center , "You have insufficient funds!")
client_print(id, print_chat, "[X] You can't buy a super HE Grenade because you don't have enough money.")
client_print(id, print_chat, "[i] A super HE Grenade costs $%i.", price)

return PLUGIN_HANDLED
}

if (cs_get_user_bpammo(id, CSW_HEGRENADE) == 1) {
client_print(id, print_center, "You cannot carry anymore!")

return PLUGIN_HANDLED
}

if(buying && buy_allow[id])
{
cs_set_user_money(id, myMoneyleft)
hasHE[id] = true

client_print(id, print_chat, "[i] You have just bought a super HE grenade for $%i.", price)

give_item(id, "weapon_hegrenade")
}
else if(!buying) engclient_print(id, engprint_center, "%i seconds have passed.^nYou can't buy anything now!", floatround(get_cvar_float("mp_buytime") * 60))

return PLUGIN_HANDLED
}


public Damage_event(id) {
new wpn, body, attacker = get_user_attacker(id, wpn, body)
// Its a Grenade
if(wpn == 4 && hasHE[attacker])
{
new Float:hp = float(get_user_health(id))
new Float:dmg = float(read_data(2))
dmg *= 0.5

new damage = floatround(hp - dmg)
set_user_health(id, damage)
}
}

public buyzone_icon(id)
{
if(read_data(1))
{
if(!buying) buy_allow[id] = false
else buy_allow[id] = true
}
else buy_allow[id] = false
}

public RoundTime_event()
{
new Float:roundtime = get_cvar_float("mp_roundtime") * 60.0
new rtime = read_data(1)

if(get_cvar_num("mp_freezetime") == rtime)
{
if(task_exists(5681)) remove_task(5681)
}
buying = true

if(roundtime == rtime)
{
new Float:buy_time = get_cvar_float("mp_buytime") * 60
set_task(buy_time, "buy_task", 5681)
}
}

public buy_task()
{
buying = false
}

Odpowiedz

  • +
  • -
ReKsiu - zdjęcie ReKsiu 13.12.2009

Dziękuje za podpowiedzi i za ten plugin :P
Fajnie wszystko objaśnione teraz mogę kontynuować pracę.
@UP
Dzięki za pliczek i nawet jest o DMG bez szynki chyba.
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 13.12.2009

Co do obrazen bez szynki... metoda dodatkowych obrazen nie daje fraga, kasy czy informacji w rogu kto zabil ;)
Odpowiedz
Zablokowany