Existing user? Sign in
Sign up
Games
Servers
Useful
User
Pass
2FA
[rezolvat]Ajutor plugin armura si viata
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins - Help / Support
Author
Message
889
IceCreamCandy
[Banned user]
Status: Offline
(since 03-05-2015 20:37)
Joined: 02 Jul 2014
Posts: 844
,
Topics: 115
Location:
Unknown
Reputation:
48.8
Votes
: 83
Posted: 03-05-2015, 15:22:37
| Translate post to:
... (
Click for more languages
)
La armura am pluginul asta
Spoiler:
/*================================================================================
[Modules Required]
=================================================================================*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplaguesupreme>
#include <hamsandwich>
#include <fun>
/*===============================================================================*/
/*================================================================================
[Plugin Settings]
(default : cost=5, amount=50, max=100)
=================================================================================*/
//Name of extra item
new const g_item_name[] = { "Armura Anti-Infectie" }
//Armor price
const g_item_cost = 5
//Sound played when buyed armor
new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" }
//Amount of armor will you get when you buy it
const g_armor_amount = 100
//Maximum of armor that is possible to have
const g_armor_limit = 999
/*===============================================================================*/
new g_itemid_humanarmor
public plugin_precache()
{
precache_sound(g_sound_buyarmor)
}
public plugin_init()
{
register_plugin("[ZP] Extra: Anti-Infection Armor", "1.5", "IceCreamCandy")
g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)
}
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid_humanarmor)
{
set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit)))
engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
public buy_armor(player)
{
if (zp_get_user_zombie(player) == false)
{
if ( get_user_armor(player) == g_armor_limit )
{
ChatColor(player, "!n[!gZMP!n] Ai maximum de !gArmura!n.")
return PLUGIN_CONTINUE
}
zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) - g_item_cost)
set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit)))
engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!n", "^1")
replace_all(msg, 190, "!t", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
pentru armura, problema e ca atunci cand ajung la 999 armura tot pot sa mai cumpar si nu apare mesajul "Ai maximum de armura", deci va rog sa-l faceti sa nu mai pot cumpara armura daca am 999 armura si cand ajung la 999 sa apara mesajul ala.
La viata am pluginul asta:
Spoiler:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplaguesupreme>
#include <hamsandwich>
#include <fun>
new const item_name[] = "1.000 HP!"
new g_itemid_buyhp
new hpamount
public plugin_init()
{
register_plugin("[ZP] Buy Health Points", "1.0", "IceCreamCandy")
hpamount = register_cvar("zp_buyhp_amount", "1000")
g_itemid_buyhp = zp_register_extra_item(item_name, 10, ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
}
public zp_extra_item_selected(id,itemid)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED;
if(itemid==g_itemid_buyhp)
{
set_user_health(id,get_user_health(id)+get_pcvar_num(hpamount));
ChatColor(id, "!n[!gZMP!n] Ai cumparat !g1.000 HP!n!");
}
return PLUGIN_CONTINUE;
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!n", "^1")
replace_all(msg, 190, "!t", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
, vreau ca sa pot cumpara doar 15.000 armura pe runda, iar la fiecare 1.000 cumparata sa apara in chat: Ai cumparat 1.000 hp, ai cumparat 2.000
HP
pana la 15k, iar cand vrea sa cumpere 16k sa zica: Ai cumparat maximum de hp.
0
0
Back to top
destroi112
[DEV]
Status: Offline
(since 12-03-2020 22:13)
Joined: 24 May 2014
Posts: 4042
,
Topics: 119
Location:
---------
Reputation:
515.9
Votes
: 118
Posted: 03-05-2015, 16:25:04
| Translate post to:
... (
Click for more languages
)
Armura modifici:
Code:
if ( get_user_armor(player) >= g_armor_limit )
{
ChatColor(player, "!n[!gZMP!n] Ai maximum de !gArmura!n.")
return PLUGIN_HANDLED
}
si la
HP
pui:
Code:
public zp_extra_item_selected(id,itemid)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED;
if(itemid==g_itemid_buyhp)
{
if(get_user_health(id) >=15000)
{
ChatColor(id, "!n[!gZMP!n] Ai cumparat !g1.000 HP!n!")
return PLUGIN_HANDLED;
}else{
set_user_health(id,get_user_health(id)+get_pcvar_num(hpamount));
ChatColor(id, "!n[!gZMP!n] Ai cumparat !gmaximul de HP!n!");
}
}
return PLUGIN_CONTINUE;
}
Retired from Amxmodx
0
0
Back to top
IceCreamCandy
[Banned user]
Status: Offline
(since 03-05-2015 20:37)
Joined: 02 Jul 2014
Posts: 844
,
Topics: 115
Location:
Unknown
Reputation:
48.8
Votes
: 83
Posted: 03-05-2015, 19:57:35
| Translate post to:
... (
Click for more languages
)
destroi112 wrote:
Armura modifici:
Code:
if ( get_user_armor(player) >= g_armor_limit )
{
ChatColor(player, "!n[!gZMP!n] Ai maximum de !gArmura!n.")
return PLUGIN_HANDLED
}
si la
HP
pui:
Code:
public zp_extra_item_selected(id,itemid)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED;
if(itemid==g_itemid_buyhp)
{
if(get_user_health(id) >=15000)
{
ChatColor(id, "!n[!gZMP!n] Ai cumparat !g1.000 HP!n!")
return PLUGIN_HANDLED;
}else{
set_user_health(id,get_user_health(id)+get_pcvar_num(hpamount));
ChatColor(id, "!n[!gZMP!n] Ai cumparat !gmaximul de HP!n!");
}
}
return PLUGIN_CONTINUE;
}
Mesalele trebuiau puse invers si imi da ho si cand zice ca am maximul de armura.
Si, daca sunt primul zm si am 30k
HP
si vreau sa mai cumpar presupun ca nu pot ca limita de de 15k, vreau ca la zm sa le apara in chat cand vor sa cumpere: Nu poti cumpara
HP
pentru ca ai peste 15k hp.
Ce mi-ai dat la armura n-am mai probat pentru ca gasisem pe allien 1 care mergea.
Asta e ce am gasit acolo:
Spoiler:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
/*================================================================================
[Plugin Customization]
=================================================================================*/
new const g_item_name1[] = "100 Armura Anti-Infectie"
new const g_sound_buyarmor[] = "items/ammopickup2.wav"
const g_item_cost = 5
/*===============================================================================*/
// Item IDs
new g_itemid_humanarmor1
new cvar_armor_amount1, cvar_armor_limit
public plugin_init()
{
register_plugin("[ZP] Extra Item: Anti-Infection Armor", "1.1", "IceCreamCandy")
g_itemid_humanarmor1 = zp_register_extra_item(g_item_name1, g_item_cost, ZP_TEAM_HUMAN)
cvar_armor_amount1 = register_cvar("zp_armor_amount1", "100")
cvar_armor_limit = register_cvar("zp_armor_limit", "999")
}
public plugin_precache()
{
precache_sound(g_sound_buyarmor)
}
public zp_extra_item_selected(id, itemid)
{
if (itemid == g_itemid_humanarmor1)
{
if ((pev(id, pev_armorvalue)) >= get_pcvar_num(cvar_armor_limit))
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_item_cost)
ChatColor(id, "!n[!gZMP!n] Ai maximul de armura!")
return;
}
set_pev(id, pev_armorvalue, float(min(pev(id, pev_armorvalue) + get_pcvar_num(cvar_armor_amount1), get_pcvar_num(cvar_armor_limit))))
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!n", "^1")
replace_all(msg, 190, "!t", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
poate reusesti sa faci dupa asta si pe cel de hp, eu am incercat 2 ore si nu am reusit.
0
0
Back to top
destroi112
[DEV]
Status: Offline
(since 12-03-2020 22:13)
Joined: 24 May 2014
Posts: 4042
,
Topics: 119
Location:
---------
Reputation:
515.9
Votes
: 118
Posted: 03-05-2015, 20:39:35
| Translate post to:
... (
Click for more languages
)
Nu o sa poate daca are peste 15 k e conditie si nu inteleg cu sunt puse invers ti-am pus clar acolo .
Retired from Amxmodx
0
0
Back to top
Topic locked
Topic is closed, you cannot post any messages in it anymore
Locked by
-P!C@-
, 03 May 2015 20:00
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins - Help / Support
The time now is 10-05-2024, 02:02:46
Copyright info
Based on phpBB
ro
/
com
B
Login
I forgot my password
World of Warcraft
Login for more...
Download WoW 7.3.5
Misc
eSports
Achievements
Buy reputation with votes
Reputation trades
Forum rules
Ban list
Members list
User guide (FAQ)
World of Warcraft
View details