It is currently 18 Feb 2019 04:49






Reply to topic  [ 4 posts ] 
 Modificare Shop! 
Author Message
Membru, skill 0
Membru, skill 0

Joined: 21 Nov 2015 11:02
Posts: 32
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Salut! Cine poate sa imi adauge si mie la plugins asta jos de tot ultimul inca un knife furien!
Primele doua knife sa ramana pe money $ iar ultimul pe credite !
Si dmg la knife sa fie diferit primul knife sa aiba dmg mai scazut iar al doilea mai ridicat si ultimul la fel!

Shop sursa :
| Afiseaza codul
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>

// Limitele HP si AP
#define MAX_HP 250
#define MAX_AP 250

new bool:g_noflash[33], g_superknife[33], g_msg_screenfade;

// Aici modifici ca urmatoarele. Prima este numele, a 2 pretul, a 3 echipa (0 fiind pentru ambele echipe), a 4 a mesajul eroare.
new const item_names[][] =
{
"Super Knife",
"Super Knife 2",
"50 HP",
"50 AP",
"He Grenade",
"No Flash"
}

new const item_cost[] =
{
16000,
16000,
3000,
2000,
3000,
1000
}

new const item_team[] =
{
1,
1,
0,
0,
0,
0
}

new const item_error[][] =
{
"Ai deja Super Knife!",
"Ai deja Super Knife 2!",
"Nu poti cumpara mai mult de 250 HP!",
"Nu poti cumpara mai mult de 250 AP!",
"Ai deja o grenada!",
"Ai deja No Flash!"
}

new const superknife[][] =
{
"models/furien/superknife.mdl",
"models/furien/superknife2.mdl"
}

public plugin_init()
{
register_plugin("Simple Shop", "1.0", "cyby");
RegisterHam(Ham_Spawn, "player", "spawn_post", 1);
RegisterHam(Ham_TakeDamage, "player", "ham_take_damage", 0);
register_event("DeathMsg", "death_msg", "a");
register_event("CurWeapon", "current_weapon", "be", "1=1");
g_msg_screenfade = get_user_msgid("ScreenFade");
register_message(g_msg_screenfade, "msg_screenfade");
register_clcmd("say /shop", "shop_cmd");
register_clcmd("say shop", "shop_cmd");
}

public plugin_precache()
{
for(new i = 0; i < sizeof superknife; i++)
precache_model(superknife[i]);
}

public shop_cmd(id)
{
if(!is_user_alive(id))
{
client_print(id, print_center, "Doar jucatorii care sunt in viata pot accesa shopul!");
return PLUGIN_HANDLED;
}
new menu_item[128], menu, tasta[2];
formatex(menu_item, charsmax(menu_item), "\yShop\r Furien.Ro^n\yBanuti:\r %d$", cs_get_user_money(id));
menu = menu_create(menu_item, "shop_handler");
for(new i = 0; i < sizeof item_names; i++)
{
switch(item_team[i])
{
case 0: formatex(menu_item, charsmax(menu_item), "\y%s\R%d$", item_names[i], item_cost[i]);
case 1:
{
if(get_user_team(id) != 1)
formatex(menu_item, charsmax(menu_item), "\d%s\R%d$", item_names[i], item_cost[i]);
else
formatex(menu_item, charsmax(menu_item), "\y%s\R%d$", item_names[i], item_cost[i]);
}
case 2:
{
if(get_user_team(id) != 2)
formatex(menu_item, charsmax(menu_item), "\d%s\R%d$", item_names[i], item_cost[i]);
else
formatex(menu_item, charsmax(menu_item), "\y%s\R%d$", item_names[i], item_cost[i]);
}
}
tasta[0] = i;
tasta[1] = 0;
menu_additem(menu, menu_item, tasta);
}
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}

public shop_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}

if(!is_user_alive(id))
{
client_print(id, print_center, "Nu poti folosi shopul cat esti mort!");
return PLUGIN_HANDLED;
}

if(item_team[item] != 0 && get_user_team(id) != item_team[item])
{
client_print(id, print_center, "Nu poti cumpara acest item la echipa ta!");
menu_destroy(menu);
return PLUGIN_HANDLED;
}

if(cs_get_user_money(id) < item_cost[item])
{
client_print(id, print_center, "Nu ai destui bani pentru a cumpara acest item!");
menu_destroy(menu);
return PLUGIN_HANDLED;
}

switch(item)
{
case 0:
{
if(g_superknife[id] > 0)
{
error_message(id, menu, item);
return PLUGIN_HANDLED;
}
g_superknife[id] = 1, current_weapon(id);
}
case 1:
{
if(g_superknife[id] > 0)
{
error_message(id, menu, item);
return PLUGIN_HANDLED;
}
g_superknife[id] = 2, current_weapon(id);
}
case 2:
{
if(get_user_health(id) == 250)
{
error_message(id, menu, item);
return PLUGIN_HANDLED;
}
set_user_health(id, clamp(get_user_health(id) + 50, 0, MAX_HP));
}
case 3:
{
if(get_user_armor(id) == 250)
{
error_message(id, menu, item);
return PLUGIN_HANDLED;
}
set_user_armor(id, clamp(get_user_armor(id) + 50, 0, MAX_AP));
}
case 4:
{
if(user_has_weapon(id, CSW_HEGRENADE))
{
error_message(id, menu, item);
return PLUGIN_HANDLED;
}
give_item(id, "weapon_hegrenade");
}
case 5:
{
if(g_noflash[id])
{
error_message(id, menu, item);
return PLUGIN_HANDLED;
}
g_noflash[id] = true;
}
}
client_print(id, print_center, "Ai cumparat %s", item_names[item]);
cs_set_user_money(id, cs_get_user_money(id) - item_cost[item]);
menu_destroy(menu);
return PLUGIN_HANDLED;
}

public client_putinserver(id)
{
g_noflash[id] = false;
g_superknife[id] = 0;
}

public spawn_post(id)
{
if(!is_user_alive(id))
return;

g_noflash[id] = false;
if(get_user_team(id) == 2)
g_superknife[id] = 0;
}

public ham_take_damage(vic, inf, att, Float:dmg, dmgbits)
{
if(!is_user_alive(att))
return HAM_IGNORED;

// fixeaza dmg-ul dublu dat pe grenada
if(get_user_team(att) == 1 && (g_superknife[att] > 0 && g_superknife[att] < 3) && !(dmgbits & (1<<24)))
dmg *= 2.0;

SetHamParamFloat(4, dmg);
return HAM_IGNORED;
}

public death_msg()
{
new victim = read_data(2);
g_noflash[victim] = false;
g_superknife[victim] = 0;
}

public current_weapon(id)
{
if(!is_user_alive(id))
return;

if(get_user_team(id) == 1 && get_user_weapon(id) == CSW_KNIFE && (g_superknife[id] > 0 && g_superknife[id] < 3))
set_pev(id, pev_viewmodel2, superknife[g_superknife[id] - 1]);
}

public msg_screenfade(msgid, dest, id)
{
if(g_noflash[id])
{
new date[4];
date[0] = get_msg_arg_int(4);
date[1] = get_msg_arg_int(5);
date[2] = get_msg_arg_int(6);
date[3] = get_msg_arg_int(7);

if(date[0] == 255 && date[1] == 255 && date[2] == 255 && date[3] > 199)
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}

stock error_message(id, menu, item)
{
if(!is_user_alive(id))
menu_destroy(menu);
client_print(id, print_center, "%s", item_error[item]);
menu_destroy(menu);
}

Va multumesc!


05 Dec 2018 23:50
Profile multumesc WWW
Membru, skill 0
Membru, skill 0

Joined: 21 Nov 2015 11:02
Posts: 32
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Up!! Nu trebuie neaparat pe credite ca sa fie mai usor.Va rog frumos!


06 Dec 2018 23:52
Profile multumesc WWW
Membru, skill 0
Membru, skill 0

Joined: 21 Nov 2015 11:02
Posts: 32
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Rezolvat!!


Last edited by Pymbor on 16 Dec 2018 02:50, edited 1 time in total.

Atentie la dublu post



16 Dec 2018 01:55
Profile multumesc WWW
Moderator ajutator
Moderator ajutator

Joined: 16 Feb 2014 16:28
Posts: 1534
Detinator Steam: Nu
CS Status: N-avem!
Detinator server CS: Zm.Darkcs.ro
Reputatie: Moderator Ajutator
Fond eXtream: 0
Redeschis poate mai are cineva nevoie de ajutor.
Pune si rezolvarea poate o mai vrea cineva

_________________
Inactiv pana dupa bac.


18 Dec 2018 19:30
Profile multumesc
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron

În cazul în care aveți probleme cu contul trimiteți un email sau mesaj la servicii_extream[arond]yahoo[punct]com

Powered by phpBB® Forum Software © phpBB Group