It is currently 17 Jan 2019 06:49






Reply to topic  [ 15 posts ]  Go to page 1, 2  Next
 Modificare shop 
Author Message
Membru, skill 0
Membru, skill 0

Joined: 26 Nov 2018 19:52
Posts: 69
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Salut, stie cineva sa adauge "Special Knife" in shop si meniul cu knife?

https://imgur.com/a/1I4OYNG
https://imgur.com/a/TGPLjpf

Special Knife sa fie initial in lista de la /knife, dar dezactivat gen:

Code:
6. Special Knife (OFF) - (si sa fie cu gri, adica dezactivat, sa se vada bine ca nu poti sa-l iei)


Odata achizitionat "Special Knife" sa sa salveze pe nick, iar in meniul de la /knife sa sa afiseze normal cu alb, cum e in poza de mai jos:
https://imgur.com/a/TGPLjpf

Code:
6. Special Knife (ON)


Sa aiba urmatoarele beneficii:
-400 Speed
-400 Gravity


Am cerut ajutorul unor scripteri de pe forum, ori au reusit dar multe buguri si nu au stiut sa le rezolve ori nu au stiut deloc :(



Plugin pentru /shop:
| Afiseaza codul
/*
Am cautat foarte mult un plugin sa fie cel putin asemanator cu ce vreau eu dar nu am gasit(am cautat pana si la rusi)

Vreau sa functioneze pe un sistem de credite cu urmatoarea structura:

/shop

Code:
1. +100HP - 1credit
2. Random weapon - 1credit
3. Surpriza -1credit

-Nr de credite din shop le modific eu
-Pentru "Random weapon" sa fie ales aleator o arma. (dintre ak47,AWP,m4a1)
-Pentru "Surpriza" sa fie aleator ales dintre (100% invizibilitate, +2credite, AWP, speed 1000, 5HE, GOD MODE 5sec)
(Pentru invizibilitate si speed sa functioneze doar o runda)

Creditele sa se faca pe kill si 1credit la 1h jucata.

Am pluginurile de register nick si orejucate pe server.
*/

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <dhudmessage>
#include <fakemeta>
#include <nvault>

#define PLUGIN_VERSION "1.0"

#define MAX_PLAYERS 32
#define TASK_GM 2199
#define TASK_TIMP 1298

// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------
#define HP 100
#define VITEZA 700
#define CREDITE_KILL 1
#define TAG "[~ ~ S H O P ~ ~]"
#define TIMP_SECUNDE 3600 // la cate secunde sa primesti X credite
#define CREDITE_TIMP 10 // cate credite primesti dupa ce trec secundele
// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------

new meniu;
new callback;
new bar;
new credite[MAX_PLAYERS+1];
new bool:viteza[MAX_PLAYERS+1];
new bool:invizibilitate[MAX_PLAYERS+1];
new bool:godmode[MAX_PLAYERS+1];
new bool:am_ales[MAX_PLAYERS+1];
new vault;

enum datas_
{
str[32],
info,
cost
};

/*
prima coloana: numele itemului
a doua coloana: cantitatea din item
ultima coloana: costul itemului

sa zicem ca X este un numar. Daca in numele itemului se afla X, pe acesta trebuie sa il inlocuiesti cu simbolul '#'. X reprezinta cantitatea din acel item. Mai jos ai exemplu.
pluginul creaza automat meniul si itemele, numele itemelor si cantitatatea itemelor se inlocuiesc automat, tu trebuie sa modifici mai jos matricea dupa bunul plac

daca in item nu se afla nicio cantitate, la a doua coloana scrii -1
*/
new const data_meniu[][datas_] =
{
// nume // cantitate // cost
{ "+#HP", HP, 1},
{ "Arma random", -1, 1},
{ "Surpriza !!!", -1, 1}
};

public plugin_init()
{
register_plugin("Shop", PLUGIN_VERSION, "YONTU");

register_event("HLTV", "event_newround", "a", "1=0", "2=0");
register_event("CurWeapon", "event_CurWeapon", "be", "1=1");

register_clcmd("say /shop", "cmd_shop");
register_clcmd("say_team /shop", "cmd_shop");
register_clcmd("drop", "cmd_use_power");

register_concmd("amx_credite", "cmd_credite", ADMIN_IMMUNITY, "<tinta/@all> <credite>");

bar = get_user_msgid("BarTime");

vault = nvault_open("credite");
if(vault == INVALID_HANDLE)
set_fail_state("Eroare la deschiderea bazei de date din foldeurul data/vault.");
}

public plugin_end()
{
nvault_close(vault);
}

public salveaza_credite(id)
{
new vaultdata[64];
format(vaultdata, charsmax(vaultdata), "%i#", credite[id]);

new nume[32];
get_user_name(id, nume, charsmax(nume));
nvault_set(vault, nume, vaultdata);
}

public incarca_credite(id)
{
new vaultdata[64], temp[MAX_PLAYERS+1];
format(vaultdata, charsmax(vaultdata), "%i#", credite[id]);

new nume[32];
get_user_name(id, nume, charsmax(nume));
nvault_get(vault, nume, vaultdata, charsmax(vaultdata));
replace_all(vaultdata, charsmax(vaultdata), "#", " ");

parse(vaultdata, temp, charsmax(temp));
credite[id] = str_to_num(temp);
}

public cmd_use_power(id)
{
if(is_user_alive(id) && godmode[id])
{
set_dhudmessage(255, 255, 0, -1.0, 0.78, 0, _, 2.0);
show_dhudmessage(id, "ESTI I N V I N C I B I L");

set_user_godmode(id, true);
godmode[id] = false;
ShakeScreen(id, 2.0);

message_begin(MSG_ONE_UNRELIABLE, bar, .player=id)
write_short(5);
message_end();

set_task(5.0, "opreste_godmode", id + TASK_GM);
return PLUGIN_HANDLED;
}

return PLUGIN_CONTINUE;
}

public opreste_godmode(id)
{
id -= TASK_GM;
set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
show_dhudmessage(id, "Nu mai esti invincibil...");
ColorChat(id, "!4%s!1 Nu mai esti invincibil. Puterea ti-a expirat.", TAG);
set_user_godmode(id, false);
ShakeScreen(id, 2.0);
}

public event_newround()
{
arrayset(am_ales, false, charsmax(am_ales));
arrayset(viteza, false, charsmax(viteza));
arrayset(godmode, false, charsmax(godmode));

new i, players[MAX_PLAYERS], num, id;
get_players(players, num);
for(i = 0; i < num; i++)
{
id = players[i];
if(!is_user_alive(id))
continue;

if(invizibilitate[id])
{
invizibilitate[id] = false;
set_user_rendering(id);
}

if(task_exists(id + TASK_GM))
remove_task(id + TASK_GM);
}
}

public event_CurWeapon(id)
{
if(is_user_alive(id))
{
if(get_user_maxspeed(id) != 1.0 && viteza[id] == true)
{
set_user_maxspeed(id, float(VITEZA));
}
}

return PLUGIN_CONTINUE;
}

public client_death(killer, victim, wpnindex, hitplace, tk)
{
if(!is_user_alive(killer))
return;

if(killer == victim)
return;

credite[killer] += CREDITE_KILL;
salveaza_credite(killer);

if(viteza[killer]) viteza[killer] = false;
if(godmode[killer]) godmode[killer] = false;
if(invizibilitate[killer])
{
invizibilitate[killer] = false;
set_user_rendering(killer);
}
}

public client_putinserver(id)
{
am_ales[id] = false;
viteza[id] = false;
invizibilitate[id] = false;
godmode[id] = false;
incarca_credite(id);
set_task(float(TIMP_SECUNDE), "primeste_credite", id + TASK_TIMP);
}

public primeste_credite(taskid)
{
static id;
id = taskid - TASK_TIMP;

credite[id] += CREDITE_TIMP;
ColorChat(id, "!4%s!1 Ai primit !4%d!1 credite pentru ca ai jucat!4 %d!1 minute.", TAG, CREDITE_TIMP, TIMP_SECUNDE/60);
set_task(float(TIMP_SECUNDE), "primeste_credite", id + TASK_TIMP);
}

public client_disconnected(id)
{
if(task_exists(id + TASK_GM))
remove_task(id + TASK_GM);

if(task_exists(id + TASK_TIMP))
remove_task(id + TASK_TIMP);

salveaza_credite(id);
}

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

if(!is_user_alive(id))
return ITEM_DISABLED;

if(am_ales[id])
return ITEM_DISABLED;

if(credite[id] < data_meniu[item][cost])
return ITEM_DISABLED;

return ITEM_ENABLED;
}

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

switch(item)
{
case 0:
{
set_user_health(id, get_user_health(id) + HP);
am_ales[id] = true;
ColorChat(id, "!4%s!1 Ai cumparat cu!3 %d!1 credit%s!4 %d HP!1.", TAG, data_meniu[item][cost], data_meniu[item][cost] == 1 ? "": "e", HP);
}
case 1:
{
ColorChat(id, "!4%s!1 Ai cumparat cu!3 %d!1 credit%s o arma random.", TAG, data_meniu[item][cost], data_meniu[item][cost] == 1 ? "": "e");
switch(random_num(0, 2))
{
case 0:
{
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
ColorChat(id, "!4%s!1 Arma este!3 AK-47", TAG);

}
case 1:
{
give_item(id, "weapon_awp");
cs_set_user_bpammo(id, CSW_AWP, 30);
ColorChat(id, "!4%s!1 Arma este!3 AWP", TAG);
}
case 2:
{
give_item(id, "weapon_m4a1");
cs_set_user_bpammo(id, CSW_M4A1, 90);
ColorChat(id, "!4%s!1 Arma este!3 M4A1", TAG);
}
}
am_ales[id] = true;
}
case 2: // (100% invizibilitate, +2credite, AWP, speed 1000, 5HE, GOD MODE 5sec)
{
ColorChat(id, "!4%s!1 Ai cumparat cu!3 %d!1 credit%s!4 o surpriza.", TAG, data_meniu[item][cost], data_meniu[item][cost] == 1 ? "": "e");
switch(random_num(0, 5))
{
case 0:
{
invizibilitate[id] = true;
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 25);
ColorChat(id, "!4%s!1 TAAADAAAM. Esti!3 i n v i z i b i l!1.", TAG);

ShakeScreen(id, 2.0);
}
case 1:
{
credite[id] += 2;
ColorChat(id, "!4%s!1 Bingooo !!! Ai castigat in plus!3 2 credite!1.", TAG);
}
case 2:
{
give_item(id, "weapon_awp");
cs_set_user_bpammo(id, CSW_AWP, 30);
ColorChat(id, "!4%s!3 AWP-ul!1 este surpriza! *Cand pun ochiul in luneta curat tot de pe planeta.*", TAG);
}
case 3:
{
viteza[id] = true;
set_user_maxspeed(id, float(VITEZA));
ColorChat(id, "!4%s!1 Sa fii tu oare!4 Speedy Gonzales!1??? Ai sansa acum sa-l intreci!! Ai devenit!3 ultra-rapid!1.", TAG);

ShakeScreen(id, 2.0);
}
case 4:
{
if(!user_has_weapon(id, CSW_HEGRENADE))
{
give_item(id, "weapon_hegrenade");
}
cs_set_user_bpammo(id, CSW_HEGRENADE, 5);
ColorChat(id, "!4%s!1 Ti se zice mai nou spaima-bombelor. Ti-am facut plinul cu!3 5 HE-uri!1.", TAG);
}
case 5:
{
godmode[id] = true;

new nume[32];
get_user_name(id, nume, charsmax(nume));
ColorChat(0, "!4[]!1 ATENTIE ATENTIE !!!!3 %s!1 a avut norocul sa devina invincibil.", TAG, nume);
ColorChat(id, "!4%s!1 Ai castigat!3 godmode!1. Apasta tasta!4 G!1 sa iti activezi puterea.", TAG);

set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
show_dhudmessage(id, "Fa-te invincibil prin apasarea tastei G.");
}
}
am_ales[id] = true;
}
}
credite[id] -= data_meniu[item][cost];
menu_destroy(menu);
return PLUGIN_HANDLED;
}

public cmd_shop(id)
{
static text[128], tasta[2], str_to_rpl[5], i;
formatex(text, charsmax(text), "Meniu Shop | Creditele tale:\r %d\w", credite[id]);
meniu = menu_create(text, "shop_handler");
callback = menu_makecallback("hook_shop");

for(i = 0; i < sizeof data_meniu; i++)
{
if(data_meniu[i][info] != -1)
{
num_to_str(data_meniu[i][info], str_to_rpl, charsmax(str_to_rpl));
copy(text, charsmax(text), data_meniu[i][str]);
replace(text, charsmax(text), "#", str_to_rpl);
formatex(text, charsmax(text), "%s -\r %d\w credit%s", text, data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
}
else
{
formatex(text, charsmax(text), "%s -\r %d\w credit%s", data_meniu[i][str], data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
}

tasta[0] = i;
tasta[1] = 0;
menu_additem(meniu, text, tasta, _, callback);
}
menu_setprop(meniu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, meniu);
return PLUGIN_CONTINUE;
}

public cmd_credite(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED;

new nume[32], cantitate[13];
read_argv(1, nume, charsmax(nume));
read_argv(2, cantitate, charsmax(cantitate));

new credite_ = str_to_num(cantitate);
if(credite_ <= 0)
{
client_cmd(id, "echo Numarul de credite trebuie sa fie mai mare decat 0.");
return PLUGIN_HANDLED;
}

new nume_admin[32];
get_user_name(id, nume_admin, charsmax(nume_admin));

if( nume[ 0 ] == '@' )
{
switch( nume[ 1 ] )
{
case 'A':
{
if( equal( nume, "@ALL" ) )
{
new iPlayers[ 32 ], iPlayersNum
get_players( iPlayers, iPlayersNum, "ch" );
if( iPlayersNum == 0 )
{
client_cmd( id, "echo NU se afla niciun jucator pe server !" );
return 1;
}

for( new i = 0; i < iPlayersNum ; i++ )
{
credite[ iPlayers[ i ] ] += credite_;
salveaza_credite(iPlayers[ i ]);
}

ColorChat(0, "!4%s!1 Adminul!4 %s!1 le-a dat!4 %i!1 credit%s tuturor!4 Jucatorilor!1 !",TAG, nume_admin, credite_, credite_ == 1 ? "" : "e" );
return 1;
}
}
}
}

new player = cmd_target(id, nume, 8);
if(!player || !is_user_connected(id))
{
client_cmd(id, "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
return PLUGIN_HANDLED;
}

credite[player] += credite_;
salveaza_credite(player);

new nume_jucator[32];
get_user_name(player, nume_jucator, charsmax(nume_jucator));

ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a dat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);

return PLUGIN_HANDLED;
}

public ShakeScreen(id, const Float:iSeconds)
{
static g_msg_SS = 0;
if(!g_msg_SS)
g_msg_SS = get_user_msgid("ScreenShake");

message_begin(MSG_ONE, g_msg_SS, _, id);
write_short(floatround(4096.0 * iSeconds, floatround_round));
write_short(floatround(4096.0 * iSeconds, floatround_round));
write_short(1<<13);
message_end();
}

stock ColorChat(id, String[], any:...)
{
static szMesage[192];
vformat(szMesage, charsmax(szMesage), String, 3);

replace_all(szMesage, charsmax(szMesage), "!1", "^1");
replace_all(szMesage, charsmax(szMesage), "!3", "^3");
replace_all(szMesage, charsmax(szMesage), "!4", "^4");

static g_msg_SayText = 0;
if(!g_msg_SayText)
g_msg_SayText = get_user_msgid("SayText");

new Players[32], iNum = 1, i;

if(id) Players[0] = id;
else get_players(Players, iNum, "ch");

for(--iNum; iNum >= 0; iNum--)
{
i = Players[iNum];

message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
write_byte(i);
write_string(szMesage);
message_end();
}
}


Plugin pentru /Knife:
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <fun>
#include <fakemeta>

#define PLUGIN "Knife Mod+"
#define VERSION "1.0"
#define AUTHOR "spunko,drastiq"
#define MAXPLAYERS 32
#define TASK_INTERVAL 4.0
#define MAX_HEALTH 255

#define m_pLastItem 375
#define m_pLastKnifeItem 370


new knife_model[33]
new g_Menu
new g_pVisiblity;

new CVAR_HIGHSPEED
new CVAR_LOWSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV
new CVAR_HEALTH_ADD
new CVAR_HEALTH_MAX
new CVAR_DAMAGE

public plugin_init() {

register_plugin(PLUGIN, VERSION, AUTHOR)

register_event( "Damage", "event_damage", "be" )
register_event("CurWeapon","EventCurWeapon","be","1=1")

g_Menu = register_menuid("Knife Mod")
register_menucmd(g_Menu, 1023, "knifemenu")
register_clcmd("say /knife", "display_knife")

CVAR_HIGHSPEED = register_cvar("km_highspeed","340")
CVAR_LOWSPEED = register_cvar("km_lowspeed","170")
CVAR_HEALTH_ADD = register_cvar("km_addhealth", "3")
CVAR_HEALTH_MAX = register_cvar("km_maxhealth", "75")
CVAR_DAMAGE = register_cvar("km_damage", "2")
CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400")
CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
g_pVisiblity = register_cvar( "km_invis", "150" ); // 255 = clearly visible

}

public plugin_precache() {
precache_model("models/knife-mod/v_Tactic.mdl")
precache_model("models/knife-mod/p_Tactic.mdl")
precache_model("models/knife-mod/v_OneKill.mdl")
precache_model("models/knife-mod/p_OneKill.mdl")
precache_model("models/knife-mod/v_Cobra.mdl")
precache_model("models/knife-mod/p_Cobra.mdl")
precache_model("models/knife-mod/v_hulk.mdl")
precache_model("models/knife-mod/v_knifeN.mdl")
precache_model("models/p_knife.mdl")
precache_model("models/knife-mod/v_claw.mdl")
}

public display_knife(id) {
// Codes makes it so only the dead can pick a knife.
if (is_user_alive(id) == 0){
client_print(id, print_chat, "Nu poti alege un cutit cat timp esti mort!")
return PLUGIN_CONTINUE
}
else
client_print(id, print_chat, "Alege un cutit!")

new menuBody[512]
add(menuBody, 511, "\r Knife Mod^n^n")
add(menuBody, 511, "\r1. \wOneKill \y(DMG Marit/Viteza redusa!)^n")
add(menuBody, 511, "\r2. \wCobra \y(Nu se aud pasii!)^n")
add(menuBody, 511, "\r3. \wTactic \y(Viteza marita!)^n")
add(menuBody, 511, "\r4. \wHulk \y(Gravitatie!)^n")
add(menuBody, 511, "\r5. \wGrizzly (Normal) \y(Regenerare HP!)^n^n^n")
add(menuBody, 511, "\w0. Exit^n")

new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<9 )
show_menu(id, keys, menuBody, -1, "Knife Mod")

return PLUGIN_HANDLED
}
public knifemenu(id, key) {
switch(key)
{
case 0: SetKnife(id , 4)
case 1: SetKnife(id , 2)
case 2: SetKnife(id , 3)
case 3: SetKnife(id , 1)
case 4: SetKnife(id , 0)
default: return PLUGIN_HANDLED
}
SaveData(id)
return PLUGIN_HANDLED
}

public SetKnife(id , Knife) {
knife_model[id] = Knife

new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
if ( Weapon != CSW_KNIFE )
return PLUGIN_HANDLED

new vModel[56],pModel[56]

switch(Knife)
{
case 0: {
format(vModel,55,"models/knife-mod/v_knifeN.mdl")
format(pModel,55,"models/p_knife.mdl")
}
case 1: {
format(vModel,55,"models/knife-mod/v_hulk.mdl")
}
case 2: {
format(vModel,55,"models/knife-mod/v_Cobra.mdl")
format(pModel,55,"models/knife-mod/p_Cobra.mdl")
}
case 3: {
format(vModel,55,"models/knife-mod/v_Tactic.mdl")
format(pModel,55,"models/knife-mod/p_Tactic.mdl")
}
case 4: {
format(vModel,55,"models/knife-mod/v_OneKill.mdl")
format(pModel,55,"models/knife-mod/p_OneKill.mdl")
}

}

entity_set_string(id, EV_SZ_viewmodel, vModel)
entity_set_string(id, EV_SZ_weaponmodel, pModel)

return PLUGIN_HANDLED;
}

public event_damage(id) {

new victim_id = id;
if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
new dmg_take = read_data( 2 );
new dmgtype = read_data( 3 );
new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
new Float:damage = dmg_take * multiplier;
new health = get_user_health( victim_id );

new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );

if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
return PLUGIN_HANDLED
}

if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {

if( floatround(damage) >= health ) {
if( victim_id == attacker_id ) {
return PLUGIN_CONTINUE
}else{
log_kill( attacker_id, victim_id, "knife", 0 );
}

return PLUGIN_CONTINUE
}else {
if( victim_id == attacker_id ) return PLUGIN_CONTINUE

fakedamage( victim_id, "weapon_knife", damage, dmgtype );
}

}
return PLUGIN_CONTINUE
}

public EventCurWeapon(id)
{
new Weapon = read_data(2)

// Set Knife Model
SetKnife(id, knife_model[id])

// Task Options

if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
else if(task_exists(id))
remove_task(id)

// Abilities
set_user_footsteps(id , ( (knife_model[id] == 2 && Weapon == CSW_KNIFE) ? 1 : 0) )

new Float:Gravity = ((knife_model[id] == 1 && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
set_user_gravity(id , Gravity)


// Speed
new Float:Speed
if(Weapon != CSW_KNIFE || knife_model[id] < 3)
return PLUGIN_CONTINUE
else if(knife_model[id] == 3)
Speed = get_pcvar_float(CVAR_HIGHSPEED)
else if(knife_model[id] == 4)
Speed = get_pcvar_float(CVAR_LOWSPEED)

set_user_maxspeed(id, Speed)




}

stock log_kill(killer, victim, weapon[],headshot) {
user_silentkill( victim );

message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
write_byte( killer );
write_byte( victim );
write_byte( headshot );
write_string( weapon );
message_end();

new kfrags = get_user_frags( killer );
set_user_frags( killer, kfrags++ );
new vfrags = get_user_frags( victim );
set_user_frags( victim, vfrags++ );

return PLUGIN_CONTINUE
}


public task_healing(id) {
new addhealth = get_pcvar_num(CVAR_HEALTH_ADD)
if (!addhealth)
return

new maxhealth = get_pcvar_num(CVAR_HEALTH_MAX)
if (maxhealth > MAX_HEALTH) {
set_pcvar_num(CVAR_HEALTH_MAX, MAX_HEALTH)
maxhealth = MAX_HEALTH
}

new health = get_user_health(id)

if (is_user_alive(id) && (health < maxhealth)) {
set_user_health(id, health + addhealth)
set_hudmessage(0, 255, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"<< !!HP-ul CRESTE!! >>")
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(200)
write_byte(0)
write_byte(75)
message_end()
}

else {
if (is_user_alive(id) && (health > maxhealth))
remove_task(id)

}
}

public client_disconnect(id) {
if(task_exists(id)) remove_task(id)
}


public client_authorized(id)
{
LoadData(id)
}

SaveData(id)
{

new authid[32]
get_user_authid(id, authid, 31)

new vaultkey[64]
new vaultdata[64]

format(vaultkey, 63, "KMOD_%s", authid)
format(vaultdata, 63, "%d", knife_model[id])
set_vaultdata(vaultkey, vaultdata)
}

LoadData(id)
{
new authid[32]
get_user_authid(id,authid,31)

new vaultkey[64], vaultdata[64]

format(vaultkey, 63, "KMOD_%s", authid)
get_vaultdata(vaultkey, vaultdata, 63)
knife_model[id] = str_to_num(vaultdata)

}


10 Jan 2019 13:28
Profile multumesc WWW
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1673
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Fond eXtream: 0
nu știu cum se face,dar la mine a mers totul perfect când am testat
nici acum nu ai postat sursa finală,tu nu știi ce compilezi cred
las pe altcineva să se ocupe

_________________
Stick with the best & regards Adryyy .


x , daNzeT , Arion , Chaos , Exolent , aNNakin , PoSiTiOn Of PoWeR , ExoTiQ , -UnQ- UHD , ViciousVixen , Arkshine , Askhanar , KronoS eXtream , alkaline , CryWolf , Fuffy , tre3fla , Rap^ , Hades Ownage , xPaw .


10 Jan 2019 15:46
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0

Joined: 26 Nov 2018 19:52
Posts: 69
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Adryyy, poftim sursa finala facuta de tine:

/shop

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <dhudmessage>
#include <fakemeta>
#include <nvault>

#pragma tabsize 0


#define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in KNIFE MOD LA FEL
#define SKIN_P_KNIFE "models/skins/p_knife.mdl"



#define SPECIAL_SKIN "models/player/sk/sk.mdl"


#define PLUGIN_VERSION "1.0"

#define MAX_PLAYERS 32
#define TASK_GM 2199

// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------
#define hp 100
#define VITEZA 500
#define CREDITE_KILL 10
#define TAG "[~ S H O P ~]"
// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------

new meniu;
new callback;
new bar;
new credite[MAX_PLAYERS+1];
new bool:viteza[MAX_PLAYERS+1];
new bool:invizibilitate[MAX_PLAYERS+1];
new bool:godmode[MAX_PLAYERS+1];
new bool:am_ales[MAX_PLAYERS+1];
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new vault;

new havesk[33],havess[33]

enum datas_
{
str[125],
info,
cost
};

/*
prima coloana: numele itemului
a doua coloana: cantitatea din item
a treia coloana: costul itemului

sa zicem ca X este un numar. Daca in numele itemului se afla X, pe acesta trebuie sa il inlocuiesti cu simbolul '#'. X reprezinta cantitatea din acel item. Mai jos ai exemplu.
pluginul creaza automat meniul si itemele, numele itemelor si cantitatatea itemelor se inlocuiesc automat, tu trebuie sa modifici mai jos matricea dupa bunul plac

daca in item nu se afla nicio cantitate, la a doua coloana scrii -1
*/
new const data_meniu[][datas_] =
{
// nume // cantitate // cost
{ "+HP (CT)", hp, 20},
{ "AK47 (CT)", -1, 20},
{ "M4A1 (CT)", -1, 20},
{ "Pachet AK47-HP-HE (CT)", -1, 40},
{ "Arma random (CT)", -1, 15},
{ "Surpriza (CT)", -1, 30},
{ "Loterie", -1, 100},

{ "Special Knife [Permanent]", -1, 30000},
{ "Special Skin [Permanent", -1, 10000}
};

public plugin_init()
{
register_plugin("Shop", PLUGIN_VERSION, "YONTU");

register_event("HLTV", "event_newround", "a", "1=0", "2=0");

register_event("CurWeapon","checkWeapon","be","1=1")

RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", true);

RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1 )

register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" )

register_clcmd("say /shop", "cmd_shop");
register_clcmd("say_team /shop", "cmd_shop");

register_clcmd("drop", "cmd_use_power");

register_concmd("amx_credite", "cmd_credite", ADMIN_IMMUNITY, "<nume> <credite>");
register_concmd("amx_rcredite", "cmd_rcredite", ADMIN_IMMUNITY, "<nume> <credite>");

bar = get_user_msgid("BarTime");

vault = nvault_open("credite");
if(vault == INVALID_HANDLE)
set_fail_state("Eroare la deschiderea bazei de date din foldeurul data/vault.");
}

public plugin_natives( ) register_native( "get_user_sk", "_get_user_sk" );
public _get_user_sk( ) return havesk[ get_param( 1 ) ];

public plugin_precache()
{
precache_model(SKIN_V_KNIFE)
precache_model(SKIN_P_KNIFE)

precache_model(SPECIAL_SKIN)
}
public PlayerSpawn(id) if(is_user_alive(id)&&havess[id]) cs_set_user_model(id,SPECIAL_SKIN)
public fw_SetClientKeyValue( id, const infobuffer[ ], const key[ ] ) {
if( equal( key, "model" )&&is_user_connected(id)&&havess[id] ) {
set_user_info( id, "model", SPECIAL_SKIN )

return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}


public checkWeapon(id)
{
new gl, ammo;
new arma;

arma = get_user_weapon(id, gl , ammo)
if(arma == CSW_KNIFE&&havesk[id])
{
set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
set_user_maxspeed(id,400.0)
}
/*else if(arma!=CSW_KNIFE)
{
set_user_maxspeed(id,250.0)
return PLUGIN_CONTINUE
}*/
return PLUGIN_HANDLED
}



public plugin_end()
{
nvault_close(vault);
}

public salveaza_credite(id)
{
new vaultdata[64];
formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);

new nume[32];
get_user_name(id, nume, charsmax(nume));
nvault_set(vault, nume, vaultdata);
}
public incarca_credite(id)
{
new vaultdata[64], temp[MAX_PLAYERS+1], temp2[MAX_PLAYERS+1], temp3[MAX_PLAYERS+1]
formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);

new nume[32];
get_user_name(id, nume, charsmax(nume));
nvault_get(vault, nume, vaultdata, charsmax(vaultdata));
replace_all(vaultdata, charsmax(vaultdata), "#", " ");

parse(vaultdata, temp, charsmax(temp), temp2, charsmax(temp2), temp3, charsmax(temp3));
credite[id] = str_to_num(temp);

havesk[id] = str_to_num(temp2);
havess[id] = str_to_num(temp3);
}

public cmd_use_power(id)
{
if(is_user_alive(id) && godmode[id])
{
set_dhudmessage(255, 255, 0, -1.0, 0.78, 0, _, 2.0);
show_dhudmessage(id, "ESTI I N V I N C I B I L!");

set_user_godmode(id, true);
godmode[id] = false;
ShakeScreen(id, 2.0);

message_begin(MSG_ONE_UNRELIABLE, bar, .player=id)
write_short(5);
message_end();

set_task(30.0, "opreste_godmode", id + TASK_GM);
}

return PLUGIN_CONTINUE;
}

public opreste_godmode(id)
{
id -= TASK_GM;
set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
ColorChat(id, "!4%s!1 Nu mai esti invincibil.", TAG);
set_user_godmode(id, false);
ShakeScreen(id, 2.0);
}

public event_newround()
{
arrayset(am_ales, false, charsmax(am_ales));
arrayset(viteza, false, charsmax(viteza));
arrayset(godmode, false, charsmax(godmode));

new i, players[MAX_PLAYERS], num, id;
get_players(players, num);
for(i = 0; i < num; i++)
{
id = players[i];
if(!is_user_alive(id))
continue;

if(invizibilitate[id])
{
invizibilitate[id] = false;
set_user_rendering(id);
}

if(task_exists(id + TASK_GM))
remove_task(id + TASK_GM);
}
}

public fw_ResetMaxSpeedPost(id)
{
if(is_user_alive(id) && viteza[id])
{
engfunc(EngFunc_SetClientMaxspeed, id, VITEZA);
set_pev(id, pev_maxspeed, VITEZA);
}
return HAM_IGNORED;
}

public client_death(killer, victim, wpnindex, hitplace, tk)
{
if(!is_user_alive(killer))
return;

if(killer == victim)
return;

credite[killer] += CREDITE_KILL;
salveaza_credite(killer);

if(viteza[killer]) viteza[killer] = false;
if(godmode[killer]) godmode[killer] = false;
if(invizibilitate[killer])
{
invizibilitate[killer] = false;
set_user_rendering(killer);
}
}

public client_putinserver(id)
{
am_ales[id] = false;
viteza[id] = false;
invizibilitate[id] = false;
godmode[id] = false;
incarca_credite(id);
}

public client_disconnected(id)
{
if(task_exists(id + TASK_GM))
remove_task(id + TASK_GM);

salveaza_credite(id);
}

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

if(!is_user_alive(id))
return ITEM_DISABLED;

if(am_ales[id])
return ITEM_DISABLED;

if(credite[id] < data_meniu[item][cost])
return ITEM_DISABLED;

return ITEM_ENABLED;
}

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

switch(item)
{
case 0:
{
if(get_user_team(id)!=2) return PLUGIN_HANDLED
set_user_health(id, get_user_health(id) + hp);
am_ales[id] = true;
ColorChat(id, "!4%s!1 Acum ai cu!3 %dHP !1mai mult!", TAG,hp);
am_ales[id] = true;
}
case 1:
{
if(get_user_team(id)!=2) return PLUGIN_HANDLED
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
am_ales[id] = true;
}
case 2:
{
if(get_user_team(id)!=2) return PLUGIN_HANDLED
give_item(id, "weapon_m4a1");
cs_set_user_bpammo(id, CSW_M4A1, 90);
ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
am_ales[id] = true;
}
case 3:
{
if(get_user_team(id)!=2) return PLUGIN_HANDLED
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
set_user_health(id, get_user_health(id) + hp);

if(!user_has_weapon(id, CSW_HEGRENADE))
{
give_item(id, "weapon_hegrenade");
}
cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
ColorChat(id, "!4%s!1 Ai primit!3 M4A1 + %dHP + 2HE!", TAG,hp);
am_ales[id] = true;
}
case 4:
{
if(get_user_team(id)!=2) return PLUGIN_HANDLED
switch(random_num(0, 12))
{
case 0:
{
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);

}
case 1:
{
give_item(id, "weapon_p90");
cs_set_user_bpammo(id, CSW_P90, 90);
ColorChat(id, "!4%s!1 Ai primit!3 P90!", TAG);
}
case 2:
{
give_item(id, "weapon_scout");
cs_set_user_bpammo(id, CSW_SCOUT, 30);
ColorChat(id, "!4%s!1 Ai primit!3 SCOUT!", TAG);
}
case 3:
{
give_item(id, "weapon_famas");
cs_set_user_bpammo(id, CSW_FAMAS, 90);
ColorChat(id, "!4%s!1 Ai primit!3 FAMAS!", TAG);

}
case 4:
{
give_item(id, "weapon_m4a1");
cs_set_user_bpammo(id, CSW_M4A1, 90);
ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);

}
case 5:
{
give_item(id, "weapon_awp");
cs_set_user_bpammo(id, CSW_AWP, 30);
ColorChat(id, "!4%s!1 Ai primit!3 AWP!", TAG);

}
case 6:
{
give_item(id, "weapon_elite");
cs_set_user_bpammo(id, CSW_ELITE, 90);
ColorChat(id, "!4%s!1 Ai primit!3 ELITE!", TAG);

}
case 7:
{
give_item(id, "weapon_mac10");
cs_set_user_bpammo(id, CSW_MAC10, 90);
ColorChat(id, "!4%s!1 Ai primit!3 MAC10!", TAG);

}
case 8:
{
give_item(id, "weapon_xm1014");
cs_set_user_bpammo(id, CSW_XM1014, 21);
ColorChat(id, "!4%s!1 Ai primit!3 XM1014!", TAG);

}
case 9:
{
give_item(id, "weapon_m249");
cs_set_user_bpammo(id, CSW_M249, 200);
ColorChat(id, "!4%s!1 Ai primit!3 M249!", TAG);

}
case 10:
{
give_item(id, "weapon_aug");
cs_set_user_bpammo(id, CSW_AUG, 90);
ColorChat(id, "!4%s!1 Ai primit!3 AUG!", TAG);

}
case 11:
{
give_item(id, "weapon_ump45");
cs_set_user_bpammo(id, CSW_UMP45, 90);
ColorChat(id, "!4%s!1 Ai primit!3 UMP45!", TAG);

}
case 12:
{
give_item(id, "weapon_tmp");
cs_set_user_bpammo(id, CSW_TMP, 90);
ColorChat(id, "!4%s!1 Ai primit!3 TMP!", TAG);

}
}
am_ales[id] = true;
}
case 5: // (100% invizibilitate, +2credite, AWP, speed 1000, 5HE, GOD MODE 5sec)
{
if(get_user_team(id)!=2) return PLUGIN_HANDLED
switch(random_num(0, 8))
{
case 0:
{
invizibilitate[id] = true;
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 25);
ColorChat(id, "!4%s!1 Acum esti!3 I N V I Z I B I L!1.", TAG);

ShakeScreen(id, 2.0);
}
case 1:
{
credite[id] += 30;
ColorChat(id, "!4%s!1 Ai castigat in plus!3 30 credite!1.", TAG);
}
case 2:
{
give_item(id, "weapon_awp");
cs_set_user_bpammo(id, CSW_AWP, 30);
ColorChat(id, "!4%s!1 Ai castigat un!3 AWP!", TAG);
}
case 3:
{
viteza[id] = true;
ColorChat(id, "!4%s!1 Acum esti mult mai!3 rapid.", TAG);

ShakeScreen(id, 2.0);
}
case 4:
{
if(!user_has_weapon(id, CSW_HEGRENADE))
{
give_item(id, "weapon_hegrenade");
}
cs_set_user_bpammo(id, CSW_HEGRENADE, 5);
ColorChat(id, "!4%s!1 Ai castigat!3 5 HE.", TAG);
}
case 5:
{
godmode[id] = true;

new nume[32];
get_user_name(id, nume, charsmax(nume));
ColorChat(0, "!4%s!3 %s!1 a avut norocul sa devina !3invincibil!1 30sec.", TAG, nume);
ColorChat(id, "!4%s!1 Apasta tasta!4 V!1 sa iti activezi puterea.", TAG);

set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
show_dhudmessage(id, "Fa-te invincibil prin apasarea tastei V.");
}
case 6:
{
credite[id] += 50;
ColorChat(id, "!4%s!1 Ai castigat in plus!3 50 credite!1.", TAG);
}
case 7:
{
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 30);
ColorChat(id, "!4%s!1 Ai castigat un!3 AK47!", TAG);
}
case 8:
{
set_user_noclip(id,1);
set_task(8.0,"removeClip",id);
ColorChat(id, "!4%s!1 NoClip pentru!3 8 sec!", TAG);
}
}
am_ales[id] = true;
}


case 6:
{
new nume[32];
get_user_name(id, nume, charsmax(nume));
switch(random_num(0, 17))
{
case 0:
{
credite[id] += 50;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 50 credite !1la loterie.", TAG, nume);
}
case 1:
{
credite[id] += 99;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 99 credite !1la loterie.", TAG, nume);
}
case 2:
{
credite[id] += 1;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 1 credit !1la loterie.", TAG, nume);
}
case 3:
{
credite[id] += 150;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 150 credite !1la loterie.", TAG, nume);
}
case 4:
{
credite[id] += 20;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
}
case 5:
{
credite[id] += 120;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 120 credite !1la loterie.", TAG, nume);
}
case 6:
{
credite[id] += 100;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 100 credite !1la loterie.", TAG, nume);
}
case 7:
{
credite[id] += 222;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 222 credite !1la loterie.", TAG, nume);
}
case 8:
{
ColorChat(0, "!4%s!1 GHINION! !3%s!1 a pierdut!3 100 credite !1la loterie.", TAG, nume);
}
case 9:
{
credite[id] += 80;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 80 credite !1la loterie.", TAG, nume);
}
case 10:
{
credite[id] += 130;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 130 credite !1la loterie.", TAG, nume);
}
case 11:
{
credite[id] += 69;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 69 credite !1la loterie.", TAG, nume);
}
case 12:
{
credite[id] += 20;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
}
case 13:
{
credite[id] += 77;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 77 credite !1la loterie.", TAG, nume);
}
case 14:
{
credite[id] += 444;
ColorChat(0, "!4%s!1 BINGO! !3%s!1 a castigat marele premiu la loterie,!3 444 credite.", TAG, nume);
}
case 15:
{
credite[id] += 11;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 11 credite !1la loterie.", TAG, nume);
}
case 16:
{
credite[id] += 90;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 90 credite !1la loterie.", TAG, nume);
}
case 17:
{
credite[id] += 180;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 180 credite !1la loterie.", TAG, nume);
}
}
am_ales[id] = true;
}


case 7:
{
if(havesk[id]) return PLUGIN_HANDLED

give_item(id,"weapon_knife")
engclient_cmd(id,"weapon_knife")

set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
set_user_maxspeed(id,400.0)

checkWeapon(id)

havesk[id]=1
salveaza_credite(id)

am_ales[id] = true;
}

case 8:
{
if(havess[id]) return PLUGIN_HANDLED

cs_set_user_model(id,SPECIAL_SKIN)

havess[id]=1
salveaza_credite(id)

am_ales[id] = true;
}


}
credite[id] -= data_meniu[item][cost];
menu_destroy(menu);
return PLUGIN_HANDLED;
}

public removeClip(id) {
set_user_noclip(id,0);
ColorChat(id, "!4%s!1 NoClip !3 OFF!", TAG);
}

public cmd_shop(id)
{
static text[128], tasta[2], i;
//new str_to_rpl[5]
formatex(text, charsmax(text), "Meniu Shop | Creditele tale:\r %d\w", credite[id]);
meniu = menu_create(text, "shop_handler");
callback = menu_makecallback("hook_shop");

for(i = 0; i < sizeof data_meniu; i++)
{
if(data_meniu[i][info] != -1)
{
//num_to_str(data_meniu[i][info], str_to_rpl, charsmax(str_to_rpl));
copy(text, charsmax(text), data_meniu[i][str]);
//replace_all(text, charsmax(text), "#", str_to_rpl);
if(credite[id]>=data_meniu[i][cost]) formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", text, data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
else if(credite[id]<data_meniu[i][cost]||am_ales[id]) formatex(text, charsmax(text), "\d%s -\r %d\w credite", text,data_meniu[i][cost]);
}
else
{
if(credite[id]>=data_meniu[i][cost]) formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", data_meniu[i][str], data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
else if(credite[id]<data_meniu[i][cost]||am_ales[id]) formatex(text, charsmax(text), "\d%s -\r %d\w credite", data_meniu[i][str],data_meniu[i][cost]);
}

tasta[0] = i;
tasta[1] = 0;
menu_additem(meniu, text, tasta, _, callback);
}
menu_setprop(meniu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, meniu);
return PLUGIN_CONTINUE;
}

public cmd_credite(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED;

new nume[32], cantitate[13];
read_argv(1, nume, charsmax(nume));
read_argv(2, cantitate, charsmax(cantitate));

new player = cmd_target(id, nume, 8);
if(!player || !is_user_connected(id))
{
client_cmd(id, "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
return PLUGIN_HANDLED;
}

new credite_ = str_to_num(cantitate);
if(credite_ <= 0)
{
client_cmd(id, "echo Numarul de credite trebuie sa fie mai mare decat 0.");
return PLUGIN_HANDLED;
}

credite[player] += credite_;
salveaza_credite(player);

new nume_admin[32];
get_user_name(id, nume_admin, charsmax(nume_admin));

new nume_jucator[32];
get_user_name(player, nume_jucator, charsmax(nume_jucator));

ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a dat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);

return PLUGIN_HANDLED;
}
public cmd_rcredite(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED;

new nume[32], cantitate[13];
read_argv(1, nume, charsmax(nume));
read_argv(2, cantitate, charsmax(cantitate));

new player = cmd_target(id, nume, 8);
if(!player || !is_user_connected(id))
{
client_cmd(id, "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
return PLUGIN_HANDLED;
}

new credite_ = str_to_num(cantitate);
if(credite_ <= 0)
{
client_cmd(id, "echo Numarul de credite trebuie sa fie mai mare decat 0.");
return PLUGIN_HANDLED;
}

credite[player] -= credite_;
salveaza_credite(player);

new nume_admin[32];
get_user_name(id, nume_admin, charsmax(nume_admin));

new nume_jucator[32];
get_user_name(player, nume_jucator, charsmax(nume_jucator));

ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a luat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);

return PLUGIN_HANDLED;
}

public ShakeScreen(id, const Float:iSeconds)
{
static g_msg_SS = 0;
if(!g_msg_SS)
g_msg_SS = get_user_msgid("ScreenShake");

message_begin(MSG_ONE, g_msg_SS, _, id);
write_short(floatround(4096.0 * iSeconds, floatround_round));
write_short(floatround(4096.0 * iSeconds, floatround_round));
write_short(1<<13);
message_end();
}

stock ColorChat(id, String[], any:...)
{
static szMesage[192];
vformat(szMesage, charsmax(szMesage), String, 3);

replace_all(szMesage, charsmax(szMesage), "!1", "^1");
replace_all(szMesage, charsmax(szMesage), "!3", "^3");
replace_all(szMesage, charsmax(szMesage), "!4", "^4");

static g_msg_SayText = 0;
if(!g_msg_SayText)
g_msg_SayText = get_user_msgid("SayText");

new Players[32], iNum = 1, i;

if(id) Players[0] = id;
else get_players(Players, iNum, "ch");

for(--iNum; iNum >= 0; iNum--)
{
i = Players[iNum];

message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
write_byte(i);
write_string(szMesage);
message_end();
}
}



/knife

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <fun>
#include <fakemeta>

#pragma tabsize 0

native get_user_sk(id)
#define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in SHOP LA FEL
#define SKIN_P_KNIFE "models/skins/p_knife.mdl"

#define PLUGIN "Knife Mod+"
#define VERSION "1.0"
#define AUTHOR "spunko,drastiq"

#define MAXPLAYERS 32
#define TASK_INTERVAL 4.0
#define MAX_HEALTH 255


new knife_model[33]
new g_Menu

new CVAR_HIGHSPEED
new CVAR_LOWSPEED
new CVAR_LOWGRAV
new CVAR_NORMGRAV
new CVAR_HEALTH_ADD
new CVAR_HEALTH_MAX
new CVAR_DAMAGE

public plugin_init() {

register_plugin(PLUGIN, VERSION, AUTHOR)

register_event( "Damage", "event_damage", "be" )
register_event("CurWeapon","EventCurWeapon","be","1=1")

g_Menu = register_menuid("Knife Mod")
register_menucmd(g_Menu, 1023, "knifemenu")
register_clcmd("say /knife", "display_knife")

CVAR_HIGHSPEED = register_cvar("km_highspeed","340")
CVAR_LOWSPEED = register_cvar("km_lowspeed","170")
CVAR_HEALTH_ADD = register_cvar("km_addhealth", "3")
CVAR_HEALTH_MAX = register_cvar("km_maxhealth", "75")
CVAR_DAMAGE = register_cvar("km_damage", "2")
CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400")
CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
}

public plugin_precache() {
precache_model("models/knife-mod/v_Tactic.mdl")
precache_model("models/knife-mod/p_Tactic.mdl")
precache_model("models/knife-mod/v_OneKill.mdl")
precache_model("models/knife-mod/p_OneKill.mdl")
precache_model("models/knife-mod/v_Cobra.mdl")
precache_model("models/knife-mod/p_Cobra.mdl")
precache_model("models/knife-mod/v_hulk.mdl")
precache_model("models/knife-mod/v_knifeN.mdl")
precache_model("models/p_knife.mdl")
precache_model("models/knife-mod/v_claw.mdl")


precache_model(SKIN_V_KNIFE)
precache_model(SKIN_P_KNIFE)
}

public display_knife(id) {
// Codes makes it so only the dead can pick a knife.
if (is_user_alive(id) == 0){
client_print(id, print_chat, "Nu poti alege un cutit cat timp esti mort!")
return PLUGIN_CONTINUE
}
else
client_print(id, print_chat, "Alege un cutit!")

new menuBody[512]
add(menuBody, 511, "\r Knife Mod^n^n")
add(menuBody, 511, "\r1. \wOneKill \y(DMG Marit/Viteza redusa!)^n")
add(menuBody, 511, "\r2. \wCobra \y(Nu se aud pasii!)^n")
add(menuBody, 511, "\r3. \wTactic \y(Viteza marita!)^n")
add(menuBody, 511, "\r4. \wHulk \y(Gravitatie!)^n")
add(menuBody, 511, "\r5. \wGrizzly (Normal) \y(Regenerare HP!)^n^n")

if(get_user_sk(id)) add(menuBody, 511, "\r6.\w Special Knife\y(SPEED[SHOP])^n^n^n")
else if(get_user_sk(id)<=0) add(menuBody, 511, "\d6.\w Special Knife\y([SHOP])^n^n^n")

add(menuBody, 511, "\w0. Exit^n")

new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<9 )
show_menu(id, keys, menuBody, -1, "Knife Mod")

return PLUGIN_HANDLED
}
public knifemenu(id, key) {
switch(key)
{
case 0: SetKnife(id , 4)
case 1: SetKnife(id , 2)
case 2: SetKnife(id , 3)
case 3: SetKnife(id , 1)
case 4: SetKnife(id , 0)

case 5:
{
if(get_user_sk(id))
{
give_item(id,"weapon_knife")
engclient_cmd(id,"weapon_knife")

//get_user_sk(id)==1
SetKnife(id,5)
}
else
{
client_cmd(id,"say /shop")
//get_user_sk(id)==0
}
}
default: return PLUGIN_HANDLED
}
SaveData(id)
return PLUGIN_HANDLED
}

public SetKnife(id , Knife) {
knife_model[id] = Knife

new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
if ( Weapon != CSW_KNIFE )
return PLUGIN_HANDLED

new vModel[56],pModel[56]

switch(Knife)
{
case 0: {
format(vModel,55,"models/knife-mod/v_knifeN.mdl")
format(pModel,55,"models/p_knife.mdl")
}
case 1: {
format(vModel,55,"models/knife-mod/v_hulk.mdl")
}
case 2: {
format(vModel,55,"models/knife-mod/v_Cobra.mdl")
format(pModel,55,"models/knife-mod/p_Cobra.mdl")
}
case 3: {
format(vModel,55,"models/knife-mod/v_Tactic.mdl")
format(pModel,55,"models/knife-mod/p_Tactic.mdl")
}
case 4: {
format(vModel,55,"models/knife-mod/v_OneKill.mdl")
format(pModel,55,"models/knife-mod/p_OneKill.mdl")
}


case 5: {
format(vModel,55,SKIN_V_KNIFE)
format(pModel,55,SKIN_P_KNIFE)
}
}

entity_set_string(id, EV_SZ_viewmodel, vModel)
entity_set_string(id, EV_SZ_weaponmodel, pModel)

return PLUGIN_HANDLED;
}

public event_damage(id) {

new victim_id = id;
if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
new dmg_take = read_data( 2 );
new dmgtype = read_data( 3 );
new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
new Float:damage = dmg_take * multiplier;
new health = get_user_health( victim_id );

new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );

if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
return PLUGIN_HANDLED
}

if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {

if( floatround(damage) >= health ) {
if( victim_id == attacker_id ) {
return PLUGIN_CONTINUE
}else{
log_kill( attacker_id, victim_id, "knife", 0 );
}

return PLUGIN_CONTINUE
}else {
if( victim_id == attacker_id ) return PLUGIN_CONTINUE

fakedamage( victim_id, "weapon_knife", damage, dmgtype );
}

}
return PLUGIN_CONTINUE
}

public EventCurWeapon(id)
{
new Weapon = read_data(2)

// Set Knife Model
SetKnife(id, knife_model[id])

// Task Options

if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
else if(task_exists(id))
remove_task(id)

// Abilities
set_user_footsteps(id , ( (knife_model[id] == 2 && Weapon == CSW_KNIFE) ? 1 : 0) )

new Float:Gravity = ((knife_model[id] == 1 && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
set_user_gravity(id , Gravity)


// Speed
new Float:Speed
if(Weapon != CSW_KNIFE /*|| knife_model[id] < 3*/)
return PLUGIN_CONTINUE
else if(knife_model[id] == 3)
Speed = get_pcvar_float(CVAR_HIGHSPEED)
else if(knife_model[id] == 4)
Speed = get_pcvar_float(CVAR_LOWSPEED)
else if(knife_model[id] == 5)
Speed = 400.0

set_user_maxspeed(id, Speed)

return PLUGIN_HANDLED
}

stock log_kill(killer, victim, weapon[],headshot) {
user_silentkill( victim );

message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
write_byte( killer );
write_byte( victim );
write_byte( headshot );
write_string( weapon );
message_end();

new kfrags = get_user_frags( killer );
set_user_frags( killer, kfrags++ );
new vfrags = get_user_frags( victim );
set_user_frags( victim, vfrags++ );

return PLUGIN_CONTINUE
}


public task_healing(id) {
new addhealth = get_pcvar_num(CVAR_HEALTH_ADD)
if (!addhealth)
return

new maxhealth = get_pcvar_num(CVAR_HEALTH_MAX)
if (maxhealth > MAX_HEALTH) {
set_pcvar_num(CVAR_HEALTH_MAX, MAX_HEALTH)
maxhealth = MAX_HEALTH
}

new health = get_user_health(id)

if (is_user_alive(id) && (health < maxhealth)) {
set_user_health(id, health + addhealth)
set_hudmessage(0, 255, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.1, 4)
show_hudmessage(id,"<< !!HP-ul CRESTE!! >>")
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(200)
write_byte(0)
write_byte(75)
message_end()
}

else {
if (is_user_alive(id) && (health > maxhealth))
remove_task(id)

}
}

public client_disconnect(id) {
if(task_exists(id)) remove_task(id)
}


public client_authorized(id)
{
LoadData(id)
}

SaveData(id)
{

new authid[32]
get_user_authid(id, authid, 31)

new vaultkey[64]
new vaultdata[64]

format(vaultkey, 63, "KMOD_%s", authid)
format(vaultdata, 63, "%d", knife_model[id])
set_vaultdata(vaultkey, vaultdata)
}

LoadData(id)
{
new authid[32]
get_user_authid(id,authid,31)

new vaultkey[64], vaultdata[64]

format(vaultkey, 63, "KMOD_%s", authid)
get_vaultdata(vaultkey, vaultdata, 63)
knife_model[id] = str_to_num(vaultdata)

}


-Stiu ce compilez, problema e ca e bug...iau Special Knife, dau /knife sa iau alt cutit si imi da tot skin la special knife, dar bonusurile sunt de la cutitul ales anterior+400speed de la special knife....spre ex: iau Knife 4 (cel cu 400gravity), o sa am skin de la special knife +400speed+400gravity..
-Cand cumpar ceva din shop se dezactiveaza doar numerele, nu si tot textul sa sa vada clar ca nu mai poti cumpara nimic din shop in runda respectiva

Sa se inteleaga mai bine:
https://imgur.com/a/lq2o71R
Se observa ca numerele sunt cu gri (gen, randul este dezactivat, nu mai poti cumpara), eu vreau tot randul cu gri...


10 Jan 2019 16:15
Profile multumesc WWW
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1673
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Fond eXtream: 0
e prima oară când văd că ai sursele finale

knife | Afiseaza codul
Code:
   #include <amxmodx>
   #include <amxmisc>
   #include <engine>
   #include <vault>
   #include <fun>
   #include <fakemeta>

   #pragma tabsize 0

   native get_user_sk(id)
   #define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in SHOP LA FEL
   #define SKIN_P_KNIFE "models/skins/p_knife.mdl"

   #define PLUGIN "Knife Mod+"
   #define VERSION "1.0"
   #define AUTHOR "spunko,drastiq"

   #define MAXPLAYERS 32
   #define TASK_INTERVAL 4.0
   #define MAX_HEALTH 255


   new knife_model[33]
   new g_Menu

   new CVAR_HIGHSPEED
   new CVAR_LOWSPEED
   new CVAR_LOWGRAV
   new CVAR_NORMGRAV
   new CVAR_HEALTH_ADD
   new CVAR_HEALTH_MAX
   new CVAR_DAMAGE

   public plugin_init() {
      
      register_plugin(PLUGIN, VERSION, AUTHOR)
      
      register_event( "Damage", "event_damage", "be" )
      register_event("CurWeapon","EventCurWeapon","be","1=1")
      
      g_Menu = register_menuid("Knife Mod")
      register_menucmd(g_Menu, 1023, "knifemenu")
      register_clcmd("say /knife", "display_knife")
      
      CVAR_HIGHSPEED = register_cvar("km_highspeed","340")
      CVAR_LOWSPEED = register_cvar("km_lowspeed","170")
      CVAR_HEALTH_ADD = register_cvar("km_addhealth", "3")
      CVAR_HEALTH_MAX = register_cvar("km_maxhealth", "75")
      CVAR_DAMAGE = register_cvar("km_damage", "2")
      CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400")
      CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
   }

   public plugin_precache() {
      precache_model("models/knife-mod/v_Tactic.mdl")
      precache_model("models/knife-mod/p_Tactic.mdl")
      precache_model("models/knife-mod/v_OneKill.mdl")
      precache_model("models/knife-mod/p_OneKill.mdl")
      precache_model("models/knife-mod/v_Cobra.mdl")
      precache_model("models/knife-mod/p_Cobra.mdl")
      precache_model("models/knife-mod/v_hulk.mdl")
      precache_model("models/knife-mod/v_knifeN.mdl")
      precache_model("models/p_knife.mdl")
      precache_model("models/knife-mod/v_claw.mdl")


      precache_model(SKIN_V_KNIFE)
      precache_model(SKIN_P_KNIFE)
   }

   public display_knife(id) {
      // Codes makes it so only the dead can pick a knife.
      if (is_user_alive(id) == 0){
         client_print(id, print_chat, "Nu poti alege un cutit cat timp esti mort!")
         return PLUGIN_CONTINUE
      }
      else
      client_print(id, print_chat, "Alege un cutit!")
      
      new menuBody[512]
      add(menuBody, 511, "\r   Knife Mod^n^n")
      add(menuBody, 511, "\r1. \wOneKill \y(DMG Marit/Viteza redusa!)^n")
      add(menuBody, 511, "\r2. \wCobra \y(Nu se aud pasii!)^n")
      add(menuBody, 511, "\r3. \wTactic \y(Viteza marita!)^n")
      add(menuBody, 511, "\r4. \wHulk \y(Gravitatie!)^n")
      add(menuBody, 511, "\r5. \wGrizzly (Normal) \y(Regenerare HP!)^n^n")

      if(get_user_sk(id)>0)   add(menuBody, 511, "\r6.\w Special Knife\y(SPEED[SHOP])^n^n^n")
      else   if(get_user_sk(id)<=0)   add(menuBody, 511, "\d6.\w Special Knife\y([SHOP])^n^n^n")

      add(menuBody, 511, "\w0. Exit^n")
      
      new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<9 )
      show_menu(id, keys, menuBody, -1, "Knife Mod")
      
      return PLUGIN_HANDLED
   }
   public knifemenu(id, key) {
      switch(key)
      {
            case 0: SetKnife(id , 4)
            case 1: SetKnife(id , 2)
            case 2: SetKnife(id , 3)
            case 3: SetKnife(id , 1)
            case 4: SetKnife(id , 0)

            case 5:
            {
               if(get_user_sk(id)>0)
               {
                  give_item(id,"weapon_knife")
                  engclient_cmd(id,"weapon_knife")

                  get_user_sk(id)==1
                  SetKnife(id,5)
               }
               else
               {
                  client_cmd(id,"say /shop")
                  get_user_sk(id)==0
               }
            }
            default: return PLUGIN_HANDLED
      }
      SaveData(id)
      return PLUGIN_HANDLED
   }

   public SetKnife(id , Knife) {
      knife_model[id] = Knife
      
      new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
      if ( Weapon != CSW_KNIFE )
         return PLUGIN_HANDLED
      
      new vModel[56],pModel[56]
      
      switch(Knife)
      {
         case 0: {
            format(vModel,55,"models/knife-mod/v_knifeN.mdl")
            format(pModel,55,"models/p_knife.mdl")
         }
         case 1: {
            format(vModel,55,"models/knife-mod/v_hulk.mdl")
         }
         case 2: {
            format(vModel,55,"models/knife-mod/v_Cobra.mdl")
            format(pModel,55,"models/knife-mod/p_Cobra.mdl")
         }
         case 3: {
            format(vModel,55,"models/knife-mod/v_Tactic.mdl")
            format(pModel,55,"models/knife-mod/p_Tactic.mdl")
         }
         case 4: {
            format(vModel,55,"models/knife-mod/v_OneKill.mdl")
            format(pModel,55,"models/knife-mod/p_OneKill.mdl")
         }


         case 5: {
            format(vModel,55,SKIN_V_KNIFE)
            format(pModel,55,SKIN_P_KNIFE)
         }
      }
      
      entity_set_string(id, EV_SZ_viewmodel, vModel)
      entity_set_string(id, EV_SZ_weaponmodel, pModel)
      
      return PLUGIN_HANDLED; 
   }

   public event_damage(id) {
      
      new victim_id = id;
      if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
      new dmg_take = read_data( 2 );
      new dmgtype = read_data( 3 );
      new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
      new Float:damage = dmg_take * multiplier;
      new health = get_user_health( victim_id );
      
      new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );
      
      if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
         return PLUGIN_HANDLED
      }
      
      if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {
         
         if( floatround(damage) >= health ) {
            if( victim_id == attacker_id ) {
               return PLUGIN_CONTINUE
               }else{
               log_kill( attacker_id, victim_id, "knife", 0 );
            }
            
            return PLUGIN_CONTINUE
            }else {
            if( victim_id == attacker_id ) return PLUGIN_CONTINUE
            
            fakedamage( victim_id, "weapon_knife", damage, dmgtype );
         }
         
      }
      return PLUGIN_CONTINUE
   }

   public EventCurWeapon(id)
   {
      new Weapon = read_data(2)
      
      // Set Knife Model
      SetKnife(id, knife_model[id])   
      
      // Task Options
      
      if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
         set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
      else if(task_exists(id))
         remove_task(id)
      
      // Abilities
      set_user_footsteps(id , ( (knife_model[id] == 2 && Weapon == CSW_KNIFE) ? 1 : 0) )
      
      new Float:Gravity = ((knife_model[id] == 1 && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
      set_user_gravity(id , Gravity)
      
      
      // Speed
      new Float:Speed
      if(Weapon != CSW_KNIFE /*|| knife_model[id] < 3*/)
         return PLUGIN_CONTINUE
      else if(knife_model[id] == 3)
         Speed = get_pcvar_float(CVAR_HIGHSPEED)
      else if(knife_model[id] == 4)
         Speed = get_pcvar_float(CVAR_LOWSPEED)
      else if(knife_model[id] == 5&&get_user_sk(id)>0)
         Speed = 400.0
      
      set_user_maxspeed(id, Speed)

      return PLUGIN_HANDLED
   }

   stock log_kill(killer, victim, weapon[],headshot) {
   user_silentkill( victim );

   message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
   write_byte( killer );
   write_byte( victim );
   write_byte( headshot );
   write_string( weapon );
   message_end();

   new kfrags = get_user_frags( killer );
   set_user_frags( killer, kfrags++ );
   new vfrags = get_user_frags( victim );
   set_user_frags( victim, vfrags++ );

   return  PLUGIN_CONTINUE
   }


   public task_healing(id) { 
   new addhealth = get_pcvar_num(CVAR_HEALTH_ADD) 
   if (!addhealth)
      return 

   new maxhealth = get_pcvar_num(CVAR_HEALTH_MAX) 
   if (maxhealth > MAX_HEALTH) {
      set_pcvar_num(CVAR_HEALTH_MAX, MAX_HEALTH) 
      maxhealth = MAX_HEALTH
   } 

   new health = get_user_health(id)   

   if (is_user_alive(id) && (health < maxhealth)) {
      set_user_health(id, health + addhealth)
      set_hudmessage(0, 255, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.1, 4)
      show_hudmessage(id,"<< !!HP-ul CRESTE!! >>")
      message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
      write_short(1<<10)
      write_short(1<<10)
      write_short(0x0000)
      write_byte(0)
      write_byte(200)
      write_byte(0)
      write_byte(75)
      message_end()
   }

   else {
      if (is_user_alive(id) && (health > maxhealth))
         remove_task(id)
      
   }
   } 

   public client_disconnect(id) { 
   if(task_exists(id)) remove_task(id) 
   } 


   public client_authorized(id)
   {
   LoadData(id)
   }

   SaveData(id)
   {

   new authid[32]
   get_user_authid(id, authid, 31)

   new vaultkey[64]
   new vaultdata[64]

   format(vaultkey, 63, "KMOD_%s", authid)
   format(vaultdata, 63, "%d", knife_model[id])
   set_vaultdata(vaultkey, vaultdata)
   }

   LoadData(id)
   {
   new authid[32]
   get_user_authid(id,authid,31)

   new vaultkey[64], vaultdata[64]

   format(vaultkey, 63, "KMOD_%s", authid)
   get_vaultdata(vaultkey, vaultdata, 63)
   knife_model[id] = str_to_num(vaultdata)

   }


shop | Afiseaza codul
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <dhudmessage>
#include <fakemeta>
#include <nvault>

#pragma tabsize 0


#define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in KNIFE MOD LA FEL
#define SKIN_P_KNIFE "models/skins/p_knife.mdl"



#define SPECIAL_SKIN "models/player/sk/sk.mdl"

 
#define PLUGIN_VERSION  "1.0"
 
#define MAX_PLAYERS 32
#define TASK_GM     2199
 
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
#define hp      100
#define VITEZA      500
#define CREDITE_KILL    10
#define TAG     "[~ S H O P ~]"
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
 
new meniu;
new callback;
new bar;
new credite[MAX_PLAYERS+1];
new bool:viteza[MAX_PLAYERS+1];
new bool:invizibilitate[MAX_PLAYERS+1];
new bool:godmode[MAX_PLAYERS+1];
new bool:am_ales[MAX_PLAYERS+1];
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new vault;

new havesk[33],havess[33]
 
enum datas_
{
    str[125],
    info,
    cost
};
 
/*
prima coloana: numele itemului
a doua coloana: cantitatea din item
a treia coloana: costul itemului
 
sa zicem ca X este un numar. Daca in numele itemului se afla X, pe acesta trebuie sa il inlocuiesti cu simbolul '#'. X reprezinta cantitatea din acel item. Mai jos ai exemplu.
pluginul creaza automat meniul si itemele, numele itemelor si cantitatatea itemelor se inlocuiesc automat, tu trebuie sa modifici mai jos matricea dupa bunul plac
 
daca in item nu se afla nicio cantitate, la a doua coloana scrii -1
*/
new const data_meniu[][datas_] =

    // nume     // cantitate    // cost
    { "+HP (CT)",       hp,         20},
    { "AK47 (CT)",       -1,         20},
    { "M4A1 (CT)",       -1,         20},
    { "Pachet AK47-HP-HE (CT)",       -1,         40},
    { "Arma random (CT)",    -1,         15},
    { "Surpriza (CT)",   -1,         30},
    { "Loterie",   -1,         100},

    { "Special Knife [Permanent]",   -1,         30000},
    { "Special Skin [Permanent",   -1,         10000}
};
 
public plugin_init()
{
    register_plugin("Shop", PLUGIN_VERSION, "YONTU");
   
    register_event("HLTV", "event_newround", "a", "1=0", "2=0");

register_event("CurWeapon","checkWeapon","be","1=1")

    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", true);

RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1 )

register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" )

    register_clcmd("say /shop", "cmd_shop");
    register_clcmd("say_team /shop", "cmd_shop");

    register_clcmd("drop", "cmd_use_power");
 
    register_concmd("amx_credite", "cmd_credite", ADMIN_IMMUNITY, "<nume> <credite>");
    register_concmd("amx_rcredite", "cmd_rcredite", ADMIN_IMMUNITY, "<nume> <credite>");
 
    bar = get_user_msgid("BarTime");
 
    vault = nvault_open("credite");
    if(vault == INVALID_HANDLE)
        set_fail_state("Eroare la deschiderea bazei de date din foldeurul data/vault.");
}

public plugin_natives( )   register_native( "get_user_sk", "_get_user_sk" );
public _get_user_sk( )   return havesk[ get_param( 1 ) ];

public plugin_precache()
{
   precache_model(SKIN_V_KNIFE)
   precache_model(SKIN_P_KNIFE)

   precache_model(SPECIAL_SKIN)
}
public PlayerSpawn(id)   if(is_user_alive(id)&&havess[id])   cs_set_user_model(id,SPECIAL_SKIN)
public fw_SetClientKeyValue( id, const infobuffer[ ], const key[ ] ) {
    if( equal( key, "model" )&&is_user_connected(id)&&havess[id] ) {
   set_user_info( id, "model", SPECIAL_SKIN )

   return FMRES_SUPERCEDE
    }
    return FMRES_IGNORED
}


public checkWeapon(id)
{
   new gl, ammo;
   new arma;
   
   arma = get_user_weapon(id, gl , ammo)
   if(arma == CSW_KNIFE&&havesk[id])
   {
      set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
      set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
      set_user_maxspeed(id,400.0)
   }
   /*else if(arma!=CSW_KNIFE)
   {
      set_user_maxspeed(id,250.0)
      return PLUGIN_CONTINUE
   }*/
   return PLUGIN_HANDLED
}


 
public plugin_end()
{
    nvault_close(vault);
}
 
public salveaza_credite(id)
{
    new vaultdata[64];
    formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);
 
    new nume[32];
    get_user_name(id, nume, charsmax(nume));
    nvault_set(vault, nume, vaultdata);
}
public incarca_credite(id)
{
    new vaultdata[64], temp[MAX_PLAYERS+1], temp2[MAX_PLAYERS+1], temp3[MAX_PLAYERS+1]
    formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);
 
    new nume[32];
    get_user_name(id, nume, charsmax(nume));
    nvault_get(vault, nume, vaultdata, charsmax(vaultdata));
    replace_all(vaultdata, charsmax(vaultdata), "#", " ");
 
    parse(vaultdata, temp, charsmax(temp), temp2, charsmax(temp2), temp3, charsmax(temp3));
    credite[id] = str_to_num(temp);

    havesk[id] = str_to_num(temp2);
   havess[id] = str_to_num(temp3);
}
 
public cmd_use_power(id)
{     
    if(is_user_alive(id) && godmode[id])
    {
        set_dhudmessage(255, 255, 0, -1.0, 0.78, 0, _, 2.0);
        show_dhudmessage(id, "ESTI   I N V I N C I B I L!");
 
        set_user_godmode(id, true);
        godmode[id] = false;   
        ShakeScreen(id, 2.0);
 
        message_begin(MSG_ONE_UNRELIABLE, bar, .player=id)
        write_short(5);
        message_end();
 
        set_task(30.0, "opreste_godmode", id + TASK_GM);
    }
 
    return PLUGIN_CONTINUE;
}
 
public opreste_godmode(id)
{
    id -= TASK_GM;
    set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
    ColorChat(id, "!4%s!1 Nu mai esti invincibil.", TAG);
    set_user_godmode(id, false);
    ShakeScreen(id, 2.0);
}
 
public event_newround()
{
    arrayset(am_ales, false, charsmax(am_ales));
    arrayset(viteza, false, charsmax(viteza));
    arrayset(godmode, false, charsmax(godmode));
   
    new i, players[MAX_PLAYERS], num, id;
    get_players(players, num);
    for(i = 0; i < num; i++)
    {
        id = players[i];
        if(!is_user_alive(id))
            continue;
 
        if(invizibilitate[id])
        {
            invizibilitate[id] = false;
            set_user_rendering(id);
        }
 
        if(task_exists(id + TASK_GM))
            remove_task(id + TASK_GM);
    }
}
 
public fw_ResetMaxSpeedPost(id)
{
    if(is_user_alive(id) && viteza[id])
    {
        engfunc(EngFunc_SetClientMaxspeed, id, VITEZA);
        set_pev(id, pev_maxspeed, VITEZA);
    }
    return HAM_IGNORED;
}
 
public client_death(killer, victim, wpnindex, hitplace, tk)
{
    if(!is_user_alive(killer))
        return;
 
    if(killer == victim)
        return;
 
    credite[killer] += CREDITE_KILL;
    salveaza_credite(killer);
 
    if(viteza[killer]) viteza[killer] = false;
    if(godmode[killer]) godmode[killer] = false;
    if(invizibilitate[killer])
    {
        invizibilitate[killer] = false;
        set_user_rendering(killer);
    }
}
 
public client_putinserver(id)
{
    am_ales[id] = false;
    viteza[id] = false;
    invizibilitate[id] = false;
    godmode[id] = false;
    incarca_credite(id);
}
 
public client_disconnected(id)
{
    if(task_exists(id + TASK_GM))
        remove_task(id + TASK_GM);
 
    salveaza_credite(id);
}
 
public hook_shop(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
 
    if(!is_user_alive(id))
        return ITEM_DISABLED;
       
    if(am_ales[id])
        return ITEM_DISABLED;
           
    if(credite[id] < data_meniu[item][cost])
        return ITEM_DISABLED;
   
    return ITEM_ENABLED;
}
 
public shop_handler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
   
    switch(item)
    {
        case 0:
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            set_user_health(id, get_user_health(id) + hp);
            am_ales[id] = true;
            ColorChat(id, "!4%s!1 Acum ai cu!3 %dHP !1mai mult!", TAG,hp);
            am_ales[id] = true;
        }
        case 1:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
                    am_ales[id] = true;
                }
        case 2:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_m4a1");
                    cs_set_user_bpammo(id, CSW_M4A1, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
                    am_ales[id] = true;
                }
        case 3:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    set_user_health(id, get_user_health(id) + hp);

                    if(!user_has_weapon(id, CSW_HEGRENADE))
                    {
                        give_item(id, "weapon_hegrenade");
                    }
                    cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1 + %dHP + 2HE!", TAG,hp);
                    am_ales[id] = true;
                }
        case 4:
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            switch(random_num(0, 12))
            {
                case 0:
                {
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
                   
                }
                case 1:
                {
                    give_item(id, "weapon_p90");
                    cs_set_user_bpammo(id, CSW_P90, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 P90!", TAG);
                }
                case 2:
                {
                    give_item(id, "weapon_scout");
                    cs_set_user_bpammo(id, CSW_SCOUT, 30);
                    ColorChat(id, "!4%s!1 Ai primit!3 SCOUT!", TAG);
                }
                case 3:
                {
                    give_item(id, "weapon_famas");
                    cs_set_user_bpammo(id, CSW_FAMAS, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 FAMAS!", TAG);
                   
                }
                case 4:
                {
                    give_item(id, "weapon_m4a1");
                    cs_set_user_bpammo(id, CSW_M4A1, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
                   
                }
                case 5:
                {
                    give_item(id, "weapon_awp");
                    cs_set_user_bpammo(id, CSW_AWP, 30);
                    ColorChat(id, "!4%s!1 Ai primit!3 AWP!", TAG);
                   
                }
                case 6:
                {
                    give_item(id, "weapon_elite");
                    cs_set_user_bpammo(id, CSW_ELITE, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 ELITE!", TAG);
                   
                }
                case 7:
                {
                    give_item(id, "weapon_mac10");
                    cs_set_user_bpammo(id, CSW_MAC10, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 MAC10!", TAG);
                   
                }
                case 8:
                {
                    give_item(id, "weapon_xm1014");
                    cs_set_user_bpammo(id, CSW_XM1014, 21);
                    ColorChat(id, "!4%s!1 Ai primit!3 XM1014!", TAG);
                   
                }
                case 9:
                {
                    give_item(id, "weapon_m249");
                    cs_set_user_bpammo(id, CSW_M249, 200);
                    ColorChat(id, "!4%s!1 Ai primit!3 M249!", TAG);
                   
                }
                case 10:
                {
                    give_item(id, "weapon_aug");
                    cs_set_user_bpammo(id, CSW_AUG, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AUG!", TAG);
                   
                }
                case 11:
                {
                    give_item(id, "weapon_ump45");
                    cs_set_user_bpammo(id, CSW_UMP45, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 UMP45!", TAG);
                   
                }
                case 12:
                {
                    give_item(id, "weapon_tmp");
                    cs_set_user_bpammo(id, CSW_TMP, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 TMP!", TAG);
                   
                }
            }
            am_ales[id] = true;
        }
        case 5: // (100% invizibilitate, +2credite, AWP, speed 1000, 5HE, GOD MODE 5sec)
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            switch(random_num(0, 8))
            {
                case 0:
                {
                    invizibilitate[id] = true;
                    set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 25);
                    ColorChat(id, "!4%s!1 Acum esti!3 I N V I Z I B I L!1.", TAG);
 
                    ShakeScreen(id, 2.0);
                }
                case 1:
                {
                    credite[id] += 30;
                    ColorChat(id, "!4%s!1 Ai castigat in plus!3 30 credite!1.", TAG);
                }
                case 2:
                {
                    give_item(id, "weapon_awp");
                    cs_set_user_bpammo(id, CSW_AWP, 30);
                    ColorChat(id, "!4%s!1 Ai castigat un!3 AWP!", TAG);
                }
                case 3:
                {
                    viteza[id] = true;
                    ColorChat(id, "!4%s!1 Acum esti mult mai!3 rapid.", TAG);
 
                    ShakeScreen(id, 2.0);
                }
                case 4:
                {
                    if(!user_has_weapon(id, CSW_HEGRENADE))
                    {
                        give_item(id, "weapon_hegrenade");
                    }
                    cs_set_user_bpammo(id, CSW_HEGRENADE, 5);
                    ColorChat(id, "!4%s!1 Ai castigat!3 5 HE.", TAG);
                }
                case 5:
                {
                    godmode[id] = true;
                   
                    new nume[32];
                    get_user_name(id, nume, charsmax(nume));
                    ColorChat(0, "!4%s!3 %s!1 a avut norocul sa devina !3invincibil!1 30sec.", TAG, nume);
                    ColorChat(id, "!4%s!1 Apasta tasta!4 V!1 sa iti activezi puterea.", TAG);
 
                    set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
                    show_dhudmessage(id, "Fa-te invincibil prin apasarea tastei V.");
                }
                case 6:
                {
                    credite[id] += 50;
                    ColorChat(id, "!4%s!1 Ai castigat in plus!3 50 credite!1.", TAG);
                }
                case 7:
                {
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 30);
                    ColorChat(id, "!4%s!1 Ai castigat un!3 AK47!", TAG);
                }
                case 8:
                {
     set_user_noclip(id,1);
     set_task(8.0,"removeClip",id);
                    ColorChat(id, "!4%s!1 NoClip pentru!3 8 sec!", TAG);
                }
            }
            am_ales[id] = true;
        }


        case 6:
         {
             new nume[32];
             get_user_name(id, nume, charsmax(nume));
             switch(random_num(0, 17))
            {
                case 0:
                {
                    credite[id] += 50;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 50 credite !1la loterie.", TAG, nume);
                }
                case 1:
                {
                    credite[id] += 99;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 99 credite !1la loterie.", TAG, nume);
                }
                case 2:
                {
                    credite[id] += 1;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 1 credit !1la loterie.", TAG, nume);
                }
                case 3:
                {
                    credite[id] += 150;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 150 credite !1la loterie.", TAG, nume);
                }
                case 4:
                {
                    credite[id] += 20;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
                }
                case 5:
                {
                    credite[id] += 120;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 120 credite !1la loterie.", TAG, nume);
                }
                case 6:
                {
                    credite[id] += 100;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 100 credite !1la loterie.", TAG, nume);
                }
                case 7:
                {
                    credite[id] += 222;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 222 credite !1la loterie.", TAG, nume);
                }
                case 8:
                {
                    ColorChat(0, "!4%s!1 GHINION! !3%s!1 a pierdut!3 100 credite !1la loterie.", TAG, nume);
                }
                case 9:
                {
                    credite[id] += 80;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 80 credite !1la loterie.", TAG, nume);
                }
                case 10:
                {
                    credite[id] += 130;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 130 credite !1la loterie.", TAG, nume);
                }
                case 11:
                {
                    credite[id] += 69;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 69 credite !1la loterie.", TAG, nume);
                }
                case 12:
                {
                    credite[id] += 20;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
                }
                case 13:
                {
                    credite[id] += 77;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 77 credite !1la loterie.", TAG, nume);
                }
                case 14:
                {
                    credite[id] += 444;
                    ColorChat(0, "!4%s!1 BINGO! !3%s!1 a castigat marele premiu la loterie,!3 444 credite.", TAG, nume);
                }
                case 15:
                {
                    credite[id] += 11;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 11 credite !1la loterie.", TAG, nume);
                }
                case 16:
                {
                    credite[id] += 90;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 90 credite !1la loterie.", TAG, nume);
                }
                case 17:
                {
                    credite[id] += 180;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 180 credite !1la loterie.", TAG, nume);
                }
             }
          am_ales[id] = true;
          }


        case 7:
         { 
         if(havesk[id])   return PLUGIN_HANDLED

         give_item(id,"weapon_knife")
         engclient_cmd(id,"weapon_knife")

      set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
      set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
      set_user_maxspeed(id,400.0)

checkWeapon(id)

havesk[id]=1
salveaza_credite(id)

          am_ales[id] = true;
      }

        case 8:
         { 
         if(havess[id])   return PLUGIN_HANDLED

cs_set_user_model(id,SPECIAL_SKIN)

havess[id]=1
salveaza_credite(id)

          am_ales[id] = true;
      }


}
    credite[id] -= data_meniu[item][cost];
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
 
public removeClip(id) {
   set_user_noclip(id,0);
                  ColorChat(id, "!4%s!1 NoClip !3 OFF!", TAG);
}

public cmd_shop(id)
{
    static text[128], tasta[2], i;
   //new str_to_rpl[5]
    formatex(text, charsmax(text), "Meniu Shop | Creditele tale:\r %d\w", credite[id]);
    meniu = menu_create(text, "shop_handler");
    callback = menu_makecallback("hook_shop");
   
    for(i = 0; i < sizeof data_meniu; i++)
    {
       if(data_meniu[i][info] != -1)
        {
            //num_to_str(data_meniu[i][info], str_to_rpl, charsmax(str_to_rpl));
            copy(text, charsmax(text), data_meniu[i][str]);
            //replace_all(text, charsmax(text), "#", str_to_rpl);
            if(credite[id]>=data_meniu[i][cost])   formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", text, data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
else if(credite[id]<data_meniu[i][cost]||am_ales[id])   formatex(text, charsmax(text), "\d%s - %d credite", text,data_meniu[i][cost]);
        }
        else
        {
            if(credite[id]>=data_meniu[i][cost])   formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", data_meniu[i][str], data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
else if(credite[id]<data_meniu[i][cost]||am_ales[id])   formatex(text, charsmax(text), "\d%s - %d credite", data_meniu[i][str],data_meniu[i][cost]);
        }
       
        tasta[0] = i;
        tasta[1] = 0;
        menu_additem(meniu, text, tasta, _, callback);
    }
    menu_setprop(meniu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, meniu);
    return PLUGIN_CONTINUE;
}

public cmd_credite(id, level, cid)
{
    if(!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED;
   
    new nume[32],  cantitate[13];
    read_argv(1, nume,  charsmax(nume));
    read_argv(2, cantitate,  charsmax(cantitate));
   
    new player = cmd_target(id, nume, 8);
    if(!player || !is_user_connected(id))
    {
        client_cmd(id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
        return PLUGIN_HANDLED;
    }
   
    new credite_  =  str_to_num(cantitate);
    if(credite_  <=  0)
    {
        client_cmd(id,  "echo Numarul de credite trebuie sa fie mai mare decat 0.");
        return PLUGIN_HANDLED;
    }
   
    credite[player] += credite_;
    salveaza_credite(player);
   
    new nume_admin[32];
    get_user_name(id,  nume_admin, charsmax(nume_admin));
   
    new nume_jucator[32];
    get_user_name(player,  nume_jucator,  charsmax(nume_jucator));
   
    ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a dat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);
 
    return PLUGIN_HANDLED;
}
public cmd_rcredite(id, level, cid)
{
    if(!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED;
   
    new nume[32],  cantitate[13];
    read_argv(1, nume,  charsmax(nume));
    read_argv(2, cantitate,  charsmax(cantitate));
   
    new player = cmd_target(id, nume, 8);
    if(!player || !is_user_connected(id))
    {
        client_cmd(id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
        return PLUGIN_HANDLED;
    }
   
    new credite_  =  str_to_num(cantitate);
    if(credite_  <=  0)
    {
        client_cmd(id,  "echo Numarul de credite trebuie sa fie mai mare decat 0.");
        return PLUGIN_HANDLED;
    }
   
    credite[player] -= credite_;
    salveaza_credite(player);
   
    new nume_admin[32];
    get_user_name(id,  nume_admin, charsmax(nume_admin));
   
    new nume_jucator[32];
    get_user_name(player,  nume_jucator,  charsmax(nume_jucator));
   
    ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a luat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);
 
    return PLUGIN_HANDLED;
}
 
public ShakeScreen(id, const Float:iSeconds)
{
    static g_msg_SS = 0;
    if(!g_msg_SS)
        g_msg_SS = get_user_msgid("ScreenShake");
   
    message_begin(MSG_ONE, g_msg_SS, _, id);
    write_short(floatround(4096.0 * iSeconds, floatround_round));
    write_short(floatround(4096.0 * iSeconds, floatround_round));
    write_short(1<<13);
    message_end();
}
 
stock ColorChat(id, String[], any:...)
{
    static szMesage[192];
    vformat(szMesage, charsmax(szMesage), String, 3);
   
    replace_all(szMesage, charsmax(szMesage), "!1", "^1");
    replace_all(szMesage, charsmax(szMesage), "!3", "^3");
    replace_all(szMesage, charsmax(szMesage), "!4", "^4");
   
    static g_msg_SayText = 0;
    if(!g_msg_SayText)
        g_msg_SayText = get_user_msgid("SayText");
   
    new Players[32], iNum = 1, i;
 
    if(id) Players[0] = id;
    else get_players(Players, iNum, "ch");
   
    for(--iNum; iNum >= 0; iNum--)
    {
        i = Players[iNum];
       
        message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
        write_byte(i);
        write_string(szMesage);
        message_end();
    }
}

_________________
Stick with the best & regards Adryyy .


x , daNzeT , Arion , Chaos , Exolent , aNNakin , PoSiTiOn Of PoWeR , ExoTiQ , -UnQ- UHD , ViciousVixen , Arkshine , Askhanar , KronoS eXtream , alkaline , CryWolf , Fuffy , tre3fla , Rap^ , Hades Ownage , xPaw .


10 Jan 2019 17:50
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0

Joined: 26 Nov 2018 19:52
Posts: 69
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Adryyy, bugul cu "q" s-a rezolvat dar apare altul:

Atunci cand aleg urmatoarele cutite:

Cobra,
Hulk,
Grizzly
Am speed 800

https://imgur.com/a/dDdZ3q2
Se observa in poza ca tot nu se dezactiveaza tot randul, doar numerele apar cu "gri" atunci cand cumpar ceva din shop...


10 Jan 2019 18:21
Profile multumesc WWW
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1673
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Fond eXtream: 0
nu are cum să nu se dezactiveze

knife | Afiseaza codul
Code:
   #include <amxmodx>
   #include <amxmisc>
   #include <engine>
   #include <vault>
   #include <fun>
   #include <fakemeta>

   #pragma tabsize 0

   native get_user_sk(id)
   #define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in SHOP LA FEL
   #define SKIN_P_KNIFE "models/skins/p_knife.mdl"

   #define PLUGIN "Knife Mod+"
   #define VERSION "1.0"
   #define AUTHOR "spunko,drastiq"

   #define MAXPLAYERS 32
   #define TASK_INTERVAL 4.0
   #define MAX_HEALTH 255


   new knife_model[33]
   new g_Menu

   new CVAR_HIGHSPEED
   new CVAR_LOWSPEED
   new CVAR_LOWGRAV
   new CVAR_NORMGRAV
   new CVAR_HEALTH_ADD
   new CVAR_HEALTH_MAX
   new CVAR_DAMAGE

   public plugin_init() {
     
      register_plugin(PLUGIN, VERSION, AUTHOR)
     
      register_event( "Damage", "event_damage", "be" )
      register_event("CurWeapon","EventCurWeapon","be","1=1")
     
      g_Menu = register_menuid("Knife Mod")
      register_menucmd(g_Menu, 1023, "knifemenu")
      register_clcmd("say /knife", "display_knife")
     
      CVAR_HIGHSPEED = register_cvar("km_highspeed","340")
      CVAR_LOWSPEED = register_cvar("km_lowspeed","170")
      CVAR_HEALTH_ADD = register_cvar("km_addhealth", "3")
      CVAR_HEALTH_MAX = register_cvar("km_maxhealth", "75")
      CVAR_DAMAGE = register_cvar("km_damage", "2")
      CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400")
      CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
   }

   public plugin_precache() {
      precache_model("models/knife-mod/v_Tactic.mdl")
      precache_model("models/knife-mod/p_Tactic.mdl")
      precache_model("models/knife-mod/v_OneKill.mdl")
      precache_model("models/knife-mod/p_OneKill.mdl")
      precache_model("models/knife-mod/v_Cobra.mdl")
      precache_model("models/knife-mod/p_Cobra.mdl")
      precache_model("models/knife-mod/v_hulk.mdl")
      precache_model("models/knife-mod/v_knifeN.mdl")
      precache_model("models/p_knife.mdl")
      precache_model("models/knife-mod/v_claw.mdl")


      precache_model(SKIN_V_KNIFE)
      precache_model(SKIN_P_KNIFE)
   }

   public display_knife(id) {
      // Codes makes it so only the dead can pick a knife.
      if (is_user_alive(id) == 0){
         client_print(id, print_chat, "Nu poti alege un cutit cat timp esti mort!")
         return PLUGIN_CONTINUE
      }
      else
      client_print(id, print_chat, "Alege un cutit!")
     
      new menuBody[512]
      add(menuBody, 511, "\r   Knife Mod^n^n")
      add(menuBody, 511, "\r1. \wOneKill \y(DMG Marit/Viteza redusa!)^n")
      add(menuBody, 511, "\r2. \wCobra \y(Nu se aud pasii!)^n")
      add(menuBody, 511, "\r3. \wTactic \y(Viteza marita!)^n")
      add(menuBody, 511, "\r4. \wHulk \y(Gravitatie!)^n")
      add(menuBody, 511, "\r5. \wGrizzly (Normal) \y(Regenerare HP!)^n^n")

      if(get_user_sk(id)>0)   add(menuBody, 511, "\r6.\w Special Knife\y(SPEED[SHOP])^n^n^n")
      else   if(get_user_sk(id)<=0)   add(menuBody, 511, "\d6.\w Special Knife\y([SHOP])^n^n^n")

      add(menuBody, 511, "\w0. Exit^n")
     
      new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<9 )
      show_menu(id, keys, menuBody, -1, "Knife Mod")
     
      return PLUGIN_HANDLED
   }
   public knifemenu(id, key) {
      switch(key)
      {
            case 0: SetKnife(id , 4)
            case 1: SetKnife(id , 2)
            case 2: SetKnife(id , 3)
            case 3: SetKnife(id , 1)
            case 4: SetKnife(id , 0)

            case 5:
            {
               if(get_user_sk(id)>0)
               {
                  give_item(id,"weapon_knife")
                  engclient_cmd(id,"weapon_knife")

                  get_user_sk(id)==1
                  SetKnife(id,5)
               }
               else
               {
                  client_cmd(id,"say /shop")
                  get_user_sk(id)==0
               }
            }
            default: return PLUGIN_HANDLED
      }
      SaveData(id)
      return PLUGIN_HANDLED
   }

   public SetKnife(id , Knife) {
      knife_model[id] = Knife
     
      new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
      if ( Weapon != CSW_KNIFE )
         return PLUGIN_HANDLED
     
      new vModel[56],pModel[56]
     
      switch(Knife)
      {
         case 0: {
            format(vModel,55,"models/knife-mod/v_knifeN.mdl")
            format(pModel,55,"models/p_knife.mdl")
         }
         case 1: {
            format(vModel,55,"models/knife-mod/v_hulk.mdl")
         }
         case 2: {
            format(vModel,55,"models/knife-mod/v_Cobra.mdl")
            format(pModel,55,"models/knife-mod/p_Cobra.mdl")
         }
         case 3: {
            format(vModel,55,"models/knife-mod/v_Tactic.mdl")
            format(pModel,55,"models/knife-mod/p_Tactic.mdl")
         }
         case 4: {
            format(vModel,55,"models/knife-mod/v_OneKill.mdl")
            format(pModel,55,"models/knife-mod/p_OneKill.mdl")
         }


         case 5: {
            format(vModel,55,SKIN_V_KNIFE)
            format(pModel,55,SKIN_P_KNIFE)
         }
      }
     
      entity_set_string(id, EV_SZ_viewmodel, vModel)
      entity_set_string(id, EV_SZ_weaponmodel, pModel)
     
      return PLUGIN_HANDLED; 
   }

   public event_damage(id) {
     
      new victim_id = id;
      if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
      new dmg_take = read_data( 2 );
      new dmgtype = read_data( 3 );
      new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
      new Float:damage = dmg_take * multiplier;
      new health = get_user_health( victim_id );
     
      new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );
     
      if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
         return PLUGIN_HANDLED
      }
     
      if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {
         
         if( floatround(damage) >= health ) {
            if( victim_id == attacker_id ) {
               return PLUGIN_CONTINUE
               }else{
               log_kill( attacker_id, victim_id, "knife", 0 );
            }
           
            return PLUGIN_CONTINUE
            }else {
            if( victim_id == attacker_id ) return PLUGIN_CONTINUE
           
            fakedamage( victim_id, "weapon_knife", damage, dmgtype );
         }
         
      }
      return PLUGIN_CONTINUE
   }

   public EventCurWeapon(id)
   {
      new Weapon = read_data(2)
     
      // Set Knife Model
      SetKnife(id, knife_model[id])   
     
      // Task Options
     
      if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
         set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
      else if(task_exists(id))
         remove_task(id)
     
      // Abilities
      set_user_footsteps(id , ( (knife_model[id] == 2 && Weapon == CSW_KNIFE) ? 1 : 0) )
     
      new Float:Gravity = ((knife_model[id] == 1 && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
      set_user_gravity(id , Gravity)
     
     
      // Speed
      new Float:Speed
      if(Weapon != CSW_KNIFE /*|| knife_model[id] < 3*/)
         return PLUGIN_CONTINUE
      else if(knife_model[id] == 3)
         Speed = get_pcvar_float(CVAR_HIGHSPEED)
      else if(knife_model[id] == 4)
         Speed = get_pcvar_float(CVAR_LOWSPEED)
      else if(knife_model[id] == 5&&get_user_sk(id)>0)
         Speed = 400.0
else   Speed = 250.0
     
      set_user_maxspeed(id, Speed)

      return PLUGIN_HANDLED
   }

   stock log_kill(killer, victim, weapon[],headshot) {
   user_silentkill( victim );

   message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
   write_byte( killer );
   write_byte( victim );
   write_byte( headshot );
   write_string( weapon );
   message_end();

   new kfrags = get_user_frags( killer );
   set_user_frags( killer, kfrags++ );
   new vfrags = get_user_frags( victim );
   set_user_frags( victim, vfrags++ );

   return  PLUGIN_CONTINUE
   }


   public task_healing(id) { 
   new addhealth = get_pcvar_num(CVAR_HEALTH_ADD) 
   if (!addhealth)
      return 

   new maxhealth = get_pcvar_num(CVAR_HEALTH_MAX) 
   if (maxhealth > MAX_HEALTH) {
      set_pcvar_num(CVAR_HEALTH_MAX, MAX_HEALTH) 
      maxhealth = MAX_HEALTH
   } 

   new health = get_user_health(id)   

   if (is_user_alive(id) && (health < maxhealth)) {
      set_user_health(id, health + addhealth)
      set_hudmessage(0, 255, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.1, 4)
      show_hudmessage(id,"<< !!HP-ul CRESTE!! >>")
      message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
      write_short(1<<10)
      write_short(1<<10)
      write_short(0x0000)
      write_byte(0)
      write_byte(200)
      write_byte(0)
      write_byte(75)
      message_end()
   }

   else {
      if (is_user_alive(id) && (health > maxhealth))
         remove_task(id)
     
   }
   } 

   public client_disconnect(id) { 
   if(task_exists(id)) remove_task(id) 
   } 


   public client_authorized(id)
   {
   LoadData(id)
   }

   SaveData(id)
   {

   new authid[32]
   get_user_authid(id, authid, 31)

   new vaultkey[64]
   new vaultdata[64]

   format(vaultkey, 63, "KMOD_%s", authid)
   format(vaultdata, 63, "%d", knife_model[id])
   set_vaultdata(vaultkey, vaultdata)
   }

   LoadData(id)
   {
   new authid[32]
   get_user_authid(id,authid,31)

   new vaultkey[64], vaultdata[64]

   format(vaultkey, 63, "KMOD_%s", authid)
   get_vaultdata(vaultkey, vaultdata, 63)
   knife_model[id] = str_to_num(vaultdata)

   }

_________________
Stick with the best & regards Adryyy .


x , daNzeT , Arion , Chaos , Exolent , aNNakin , PoSiTiOn Of PoWeR , ExoTiQ , -UnQ- UHD , ViciousVixen , Arkshine , Askhanar , KronoS eXtream , alkaline , CryWolf , Fuffy , tre3fla , Rap^ , Hades Ownage , xPaw .


10 Jan 2019 19:05
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0

Joined: 26 Nov 2018 19:52
Posts: 69
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
S-a rezolvat si cu speed la knife.

Deci inainte sa te apuci sa modifici pluginul aparea asa dupa ce cumparai ceva din shop:
https://imgur.com/a/9IxXpKV

Dupa ce ai modificat pluginul arata asa cand cumperi ceva:
https://imgur.com/a/Kn5m8e1

Eu vreau ca sa fie ca in prima poza si acum..tot textul, nu doar numerele


10 Jan 2019 19:40
Profile multumesc WWW
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1673
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Fond eXtream: 0
| Afiseaza codul
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <dhudmessage>
#include <fakemeta>
#include <nvault>

#pragma tabsize 0


#define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in KNIFE MOD LA FEL
#define SKIN_P_KNIFE "models/skins/p_knife.mdl"



#define SPECIAL_SKIN "models/player/sk/sk.mdl"

 
#define PLUGIN_VERSION  "1.0"
 
#define MAX_PLAYERS 32
#define TASK_GM     2199
 
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
#define hp      100
#define VITEZA      500
#define CREDITE_KILL    10
#define TAG     "[~ S H O P ~]"
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
 
new meniu;
new callback;
new bar;
new credite[MAX_PLAYERS+1];
new bool:viteza[MAX_PLAYERS+1];
new bool:invizibilitate[MAX_PLAYERS+1];
new bool:godmode[MAX_PLAYERS+1];
new bool:am_ales[MAX_PLAYERS+1];
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new vault;

new havesk[33],havess[33]
 
enum datas_
{
    str[125],
    info,
    cost
};
 
/*
prima coloana: numele itemului
a doua coloana: cantitatea din item
a treia coloana: costul itemului
 
sa zicem ca X este un numar. Daca in numele itemului se afla X, pe acesta trebuie sa il inlocuiesti cu simbolul '#'. X reprezinta cantitatea din acel item. Mai jos ai exemplu.
pluginul creaza automat meniul si itemele, numele itemelor si cantitatatea itemelor se inlocuiesc automat, tu trebuie sa modifici mai jos matricea dupa bunul plac
 
daca in item nu se afla nicio cantitate, la a doua coloana scrii -1
*/
new const data_meniu[][datas_] =

    // nume     // cantitate    // cost
    { "+HP (CT)",       hp,         20},
    { "AK47 (CT)",       -1,         20},
    { "M4A1 (CT)",       -1,         20},
    { "Pachet AK47-HP-HE (CT)",       -1,         40},
    { "Arma random (CT)",    -1,         15},
    { "Surpriza (CT)",   -1,         30},
    { "Loterie",   -1,         100},

    { "Special Knife [Permanent]",   -1,         30000},
    { "Special Skin [Permanent",   -1,         10000}
};
 
public plugin_init()
{
    register_plugin("Shop", PLUGIN_VERSION, "YONTU");
   
    register_event("HLTV", "event_newround", "a", "1=0", "2=0");

register_event("CurWeapon","checkWeapon","be","1=1")

    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", true);

RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1 )

register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" )

    register_clcmd("say /shop", "cmd_shop");
    register_clcmd("say_team /shop", "cmd_shop");

    register_clcmd("drop", "cmd_use_power");
 
    register_concmd("amx_credite", "cmd_credite", ADMIN_IMMUNITY, "<nume> <credite>");
    register_concmd("amx_rcredite", "cmd_rcredite", ADMIN_IMMUNITY, "<nume> <credite>");
 
    bar = get_user_msgid("BarTime");
 
    vault = nvault_open("credite");
    if(vault == INVALID_HANDLE)
        set_fail_state("Eroare la deschiderea bazei de date din foldeurul data/vault.");
}

public plugin_natives( )   register_native( "get_user_sk", "_get_user_sk" );
public _get_user_sk( )   return havesk[ get_param( 1 ) ];

public plugin_precache()
{
   precache_model(SKIN_V_KNIFE)
   precache_model(SKIN_P_KNIFE)

   precache_model(SPECIAL_SKIN)
}
public PlayerSpawn(id)   if(is_user_alive(id)&&havess[id])   cs_set_user_model(id,SPECIAL_SKIN)
public fw_SetClientKeyValue( id, const infobuffer[ ], const key[ ] ) {
    if( equal( key, "model" )&&is_user_connected(id)&&havess[id] ) {
   set_user_info( id, "model", SPECIAL_SKIN )

   return FMRES_SUPERCEDE
    }
    return FMRES_IGNORED
}


public checkWeapon(id)
{
   new gl, ammo;
   new arma;
   
   arma = get_user_weapon(id, gl , ammo)
   if(arma == CSW_KNIFE&&havesk[id])
   {
      set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
      set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
      set_user_maxspeed(id,400.0)
   }
   /*else if(arma!=CSW_KNIFE)
   {
      set_user_maxspeed(id,250.0)
      return PLUGIN_CONTINUE
   }*/
   return PLUGIN_HANDLED
}


 
public plugin_end()
{
    nvault_close(vault);
}
 
public salveaza_credite(id)
{
    new vaultdata[64];
    formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);
 
    new nume[32];
    get_user_name(id, nume, charsmax(nume));
    nvault_set(vault, nume, vaultdata);
}
public incarca_credite(id)
{
    new vaultdata[64], temp[MAX_PLAYERS+1], temp2[MAX_PLAYERS+1], temp3[MAX_PLAYERS+1]
    formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);
 
    new nume[32];
    get_user_name(id, nume, charsmax(nume));
    nvault_get(vault, nume, vaultdata, charsmax(vaultdata));
    replace_all(vaultdata, charsmax(vaultdata), "#", " ");
 
    parse(vaultdata, temp, charsmax(temp), temp2, charsmax(temp2), temp3, charsmax(temp3));
    credite[id] = str_to_num(temp);

    havesk[id] = str_to_num(temp2);
   havess[id] = str_to_num(temp3);
}
 
public cmd_use_power(id)
{     
    if(is_user_alive(id) && godmode[id])
    {
        set_dhudmessage(255, 255, 0, -1.0, 0.78, 0, _, 2.0);
        show_dhudmessage(id, "ESTI   I N V I N C I B I L!");
 
        set_user_godmode(id, true);
        godmode[id] = false;   
        ShakeScreen(id, 2.0);
 
        message_begin(MSG_ONE_UNRELIABLE, bar, .player=id)
        write_short(5);
        message_end();
 
        set_task(30.0, "opreste_godmode", id + TASK_GM);
    }
 
    return PLUGIN_CONTINUE;
}
 
public opreste_godmode(id)
{
    id -= TASK_GM;
    set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
    ColorChat(id, "!4%s!1 Nu mai esti invincibil.", TAG);
    set_user_godmode(id, false);
    ShakeScreen(id, 2.0);
}
 
public event_newround()
{
    arrayset(am_ales, false, charsmax(am_ales));
    arrayset(viteza, false, charsmax(viteza));
    arrayset(godmode, false, charsmax(godmode));
   
    new i, players[MAX_PLAYERS], num, id;
    get_players(players, num);
    for(i = 0; i < num; i++)
    {
        id = players[i];
        if(!is_user_alive(id))
            continue;
 
        if(invizibilitate[id])
        {
            invizibilitate[id] = false;
            set_user_rendering(id);
        }
 
        if(task_exists(id + TASK_GM))
            remove_task(id + TASK_GM);
    }
}
 
public fw_ResetMaxSpeedPost(id)
{
    if(is_user_alive(id) && viteza[id])
    {
        engfunc(EngFunc_SetClientMaxspeed, id, VITEZA);
        set_pev(id, pev_maxspeed, VITEZA);
    }
    return HAM_IGNORED;
}
 
public client_death(killer, victim, wpnindex, hitplace, tk)
{
    if(!is_user_alive(killer))
        return;
 
    if(killer == victim)
        return;
 
    credite[killer] += CREDITE_KILL;
    salveaza_credite(killer);
 
    if(viteza[killer]) viteza[killer] = false;
    if(godmode[killer]) godmode[killer] = false;
    if(invizibilitate[killer])
    {
        invizibilitate[killer] = false;
        set_user_rendering(killer);
    }
}
 
public client_putinserver(id)
{
    am_ales[id] = false;
    viteza[id] = false;
    invizibilitate[id] = false;
    godmode[id] = false;
    incarca_credite(id);
}
 
public client_disconnected(id)
{
    if(task_exists(id + TASK_GM))
        remove_task(id + TASK_GM);
 
    salveaza_credite(id);
}
 
public hook_shop(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
 
    if(!is_user_alive(id))
        return PLUGIN_HANDLED;
       
    if(am_ales[id])
        return PLUGIN_HANDLED;

    if(credite[id] < data_meniu[item][cost])
        return PLUGIN_HANDLED;
   
    return ITEM_ENABLED;
}
 
public shop_handler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
   
    switch(item)
    {
        case 0:
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            set_user_health(id, get_user_health(id) + hp);
            am_ales[id] = true;
            ColorChat(id, "!4%s!1 Acum ai cu!3 %dHP !1mai mult!", TAG,hp);
            am_ales[id] = true;
        }
        case 1:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
                    am_ales[id] = true;
                }
        case 2:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_m4a1");
                    cs_set_user_bpammo(id, CSW_M4A1, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
                    am_ales[id] = true;
                }
        case 3:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    set_user_health(id, get_user_health(id) + hp);

                    if(!user_has_weapon(id, CSW_HEGRENADE))
                    {
                        give_item(id, "weapon_hegrenade");
                    }
                    cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1 + %dHP + 2HE!", TAG,hp);
                    am_ales[id] = true;
                }
        case 4:
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            switch(random_num(0, 12))
            {
                case 0:
                {
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
                   
                }
                case 1:
                {
                    give_item(id, "weapon_p90");
                    cs_set_user_bpammo(id, CSW_P90, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 P90!", TAG);
                }
                case 2:
                {
                    give_item(id, "weapon_scout");
                    cs_set_user_bpammo(id, CSW_SCOUT, 30);
                    ColorChat(id, "!4%s!1 Ai primit!3 SCOUT!", TAG);
                }
                case 3:
                {
                    give_item(id, "weapon_famas");
                    cs_set_user_bpammo(id, CSW_FAMAS, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 FAMAS!", TAG);
                   
                }
                case 4:
                {
                    give_item(id, "weapon_m4a1");
                    cs_set_user_bpammo(id, CSW_M4A1, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
                   
                }
                case 5:
                {
                    give_item(id, "weapon_awp");
                    cs_set_user_bpammo(id, CSW_AWP, 30);
                    ColorChat(id, "!4%s!1 Ai primit!3 AWP!", TAG);
                   
                }
                case 6:
                {
                    give_item(id, "weapon_elite");
                    cs_set_user_bpammo(id, CSW_ELITE, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 ELITE!", TAG);
                   
                }
                case 7:
                {
                    give_item(id, "weapon_mac10");
                    cs_set_user_bpammo(id, CSW_MAC10, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 MAC10!", TAG);
                   
                }
                case 8:
                {
                    give_item(id, "weapon_xm1014");
                    cs_set_user_bpammo(id, CSW_XM1014, 21);
                    ColorChat(id, "!4%s!1 Ai primit!3 XM1014!", TAG);
                   
                }
                case 9:
                {
                    give_item(id, "weapon_m249");
                    cs_set_user_bpammo(id, CSW_M249, 200);
                    ColorChat(id, "!4%s!1 Ai primit!3 M249!", TAG);
                   
                }
                case 10:
                {
                    give_item(id, "weapon_aug");
                    cs_set_user_bpammo(id, CSW_AUG, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AUG!", TAG);
                   
                }
                case 11:
                {
                    give_item(id, "weapon_ump45");
                    cs_set_user_bpammo(id, CSW_UMP45, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 UMP45!", TAG);
                   
                }
                case 12:
                {
                    give_item(id, "weapon_tmp");
                    cs_set_user_bpammo(id, CSW_TMP, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 TMP!", TAG);
                   
                }
            }
            am_ales[id] = true;
        }
        case 5: // (100% invizibilitate, +2credite, AWP, speed 1000, 5HE, GOD MODE 5sec)
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            switch(random_num(0, 8))
            {
                case 0:
                {
                    invizibilitate[id] = true;
                    set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 25);
                    ColorChat(id, "!4%s!1 Acum esti!3 I N V I Z I B I L!1.", TAG);
 
                    ShakeScreen(id, 2.0);
                }
                case 1:
                {
                    credite[id] += 30;
                    ColorChat(id, "!4%s!1 Ai castigat in plus!3 30 credite!1.", TAG);
                }
                case 2:
                {
                    give_item(id, "weapon_awp");
                    cs_set_user_bpammo(id, CSW_AWP, 30);
                    ColorChat(id, "!4%s!1 Ai castigat un!3 AWP!", TAG);
                }
                case 3:
                {
                    viteza[id] = true;
                    ColorChat(id, "!4%s!1 Acum esti mult mai!3 rapid.", TAG);
 
                    ShakeScreen(id, 2.0);
                }
                case 4:
                {
                    if(!user_has_weapon(id, CSW_HEGRENADE))
                    {
                        give_item(id, "weapon_hegrenade");
                    }
                    cs_set_user_bpammo(id, CSW_HEGRENADE, 5);
                    ColorChat(id, "!4%s!1 Ai castigat!3 5 HE.", TAG);
                }
                case 5:
                {
                    godmode[id] = true;
                   
                    new nume[32];
                    get_user_name(id, nume, charsmax(nume));
                    ColorChat(0, "!4%s!3 %s!1 a avut norocul sa devina !3invincibil!1 30sec.", TAG, nume);
                    ColorChat(id, "!4%s!1 Apasta tasta!4 V!1 sa iti activezi puterea.", TAG);
 
                    set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
                    show_dhudmessage(id, "Fa-te invincibil prin apasarea tastei V.");
                }
                case 6:
                {
                    credite[id] += 50;
                    ColorChat(id, "!4%s!1 Ai castigat in plus!3 50 credite!1.", TAG);
                }
                case 7:
                {
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 30);
                    ColorChat(id, "!4%s!1 Ai castigat un!3 AK47!", TAG);
                }
                case 8:
                {
     set_user_noclip(id,1);
     set_task(8.0,"removeClip",id);
                    ColorChat(id, "!4%s!1 NoClip pentru!3 8 sec!", TAG);
                }
            }
            am_ales[id] = true;
        }


        case 6:
         {
             new nume[32];
             get_user_name(id, nume, charsmax(nume));
             switch(random_num(0, 17))
            {
                case 0:
                {
                    credite[id] += 50;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 50 credite !1la loterie.", TAG, nume);
                }
                case 1:
                {
                    credite[id] += 99;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 99 credite !1la loterie.", TAG, nume);
                }
                case 2:
                {
                    credite[id] += 1;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 1 credit !1la loterie.", TAG, nume);
                }
                case 3:
                {
                    credite[id] += 150;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 150 credite !1la loterie.", TAG, nume);
                }
                case 4:
                {
                    credite[id] += 20;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
                }
                case 5:
                {
                    credite[id] += 120;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 120 credite !1la loterie.", TAG, nume);
                }
                case 6:
                {
                    credite[id] += 100;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 100 credite !1la loterie.", TAG, nume);
                }
                case 7:
                {
                    credite[id] += 222;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 222 credite !1la loterie.", TAG, nume);
                }
                case 8:
                {
                    ColorChat(0, "!4%s!1 GHINION! !3%s!1 a pierdut!3 100 credite !1la loterie.", TAG, nume);
                }
                case 9:
                {
                    credite[id] += 80;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 80 credite !1la loterie.", TAG, nume);
                }
                case 10:
                {
                    credite[id] += 130;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 130 credite !1la loterie.", TAG, nume);
                }
                case 11:
                {
                    credite[id] += 69;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 69 credite !1la loterie.", TAG, nume);
                }
                case 12:
                {
                    credite[id] += 20;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
                }
                case 13:
                {
                    credite[id] += 77;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 77 credite !1la loterie.", TAG, nume);
                }
                case 14:
                {
                    credite[id] += 444;
                    ColorChat(0, "!4%s!1 BINGO! !3%s!1 a castigat marele premiu la loterie,!3 444 credite.", TAG, nume);
                }
                case 15:
                {
                    credite[id] += 11;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 11 credite !1la loterie.", TAG, nume);
                }
                case 16:
                {
                    credite[id] += 90;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 90 credite !1la loterie.", TAG, nume);
                }
                case 17:
                {
                    credite[id] += 180;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 180 credite !1la loterie.", TAG, nume);
                }
             }
          am_ales[id] = true;
          }


        case 7:
         { 
         if(havesk[id])   return PLUGIN_HANDLED

         give_item(id,"weapon_knife")
         engclient_cmd(id,"weapon_knife")

      set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
      set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
      set_user_maxspeed(id,400.0)

checkWeapon(id)

havesk[id]=1
salveaza_credite(id)

          am_ales[id] = true;
      }

        case 8:
         { 
         if(havess[id])   return PLUGIN_HANDLED

cs_set_user_model(id,SPECIAL_SKIN)

havess[id]=1
salveaza_credite(id)

          am_ales[id] = true;
      }


}
    credite[id] -= data_meniu[item][cost];
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
 
public removeClip(id) {
   set_user_noclip(id,0);
                  ColorChat(id, "!4%s!1 NoClip !3 OFF!", TAG);
}

public cmd_shop(id)
{
    static text[128], tasta[2], i;
   //new str_to_rpl[5]
    formatex(text, charsmax(text), "Meniu Shop | Creditele tale:\r %d\w", credite[id]);
    meniu = menu_create(text, "shop_handler");
    callback = menu_makecallback("hook_shop");
   
    for(i = 0; i < sizeof data_meniu; i++)
    {
       if(data_meniu[i][info] != -1)
        {
            //num_to_str(data_meniu[i][info], str_to_rpl, charsmax(str_to_rpl));
            copy(text, charsmax(text), data_meniu[i][str]);
            //replace_all(text, charsmax(text), "#", str_to_rpl);
            if(credite[id]>=data_meniu[i][cost])   formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", text, data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
else if(credite[id]<data_meniu[i][cost]||am_ales[id])   formatex(text, charsmax(text), "\d%s - %d credite", text,data_meniu[i][cost]);
        }
        else
        {
            if(credite[id]>=data_meniu[i][cost])   formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", data_meniu[i][str], data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
else if(credite[id]<data_meniu[i][cost]||am_ales[id])   formatex(text, charsmax(text), "\d%s - %d credite", data_meniu[i][str],data_meniu[i][cost]);
        }
       
        tasta[0] = i;
        tasta[1] = 0;
        menu_additem(meniu, text, tasta, _, callback);
    }
    menu_setprop(meniu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, meniu);
    return PLUGIN_CONTINUE;
}

public cmd_credite(id, level, cid)
{
    if(!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED;
   
    new nume[32],  cantitate[13];
    read_argv(1, nume,  charsmax(nume));
    read_argv(2, cantitate,  charsmax(cantitate));
   
    new player = cmd_target(id, nume, 8);
    if(!player || !is_user_connected(id))
    {
        client_cmd(id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
        return PLUGIN_HANDLED;
    }
   
    new credite_  =  str_to_num(cantitate);
    if(credite_  <=  0)
    {
        client_cmd(id,  "echo Numarul de credite trebuie sa fie mai mare decat 0.");
        return PLUGIN_HANDLED;
    }
   
    credite[player] += credite_;
    salveaza_credite(player);
   
    new nume_admin[32];
    get_user_name(id,  nume_admin, charsmax(nume_admin));
   
    new nume_jucator[32];
    get_user_name(player,  nume_jucator,  charsmax(nume_jucator));
   
    ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a dat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);
 
    return PLUGIN_HANDLED;
}
public cmd_rcredite(id, level, cid)
{
    if(!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED;
   
    new nume[32],  cantitate[13];
    read_argv(1, nume,  charsmax(nume));
    read_argv(2, cantitate,  charsmax(cantitate));
   
    new player = cmd_target(id, nume, 8);
    if(!player || !is_user_connected(id))
    {
        client_cmd(id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
        return PLUGIN_HANDLED;
    }
   
    new credite_  =  str_to_num(cantitate);
    if(credite_  <=  0)
    {
        client_cmd(id,  "echo Numarul de credite trebuie sa fie mai mare decat 0.");
        return PLUGIN_HANDLED;
    }
   
    credite[player] -= credite_;
    salveaza_credite(player);
   
    new nume_admin[32];
    get_user_name(id,  nume_admin, charsmax(nume_admin));
   
    new nume_jucator[32];
    get_user_name(player,  nume_jucator,  charsmax(nume_jucator));
   
    ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a luat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);
 
    return PLUGIN_HANDLED;
}
 
public ShakeScreen(id, const Float:iSeconds)
{
    static g_msg_SS = 0;
    if(!g_msg_SS)
        g_msg_SS = get_user_msgid("ScreenShake");
   
    message_begin(MSG_ONE, g_msg_SS, _, id);
    write_short(floatround(4096.0 * iSeconds, floatround_round));
    write_short(floatround(4096.0 * iSeconds, floatround_round));
    write_short(1<<13);
    message_end();
}
 
stock ColorChat(id, String[], any:...)
{
    static szMesage[192];
    vformat(szMesage, charsmax(szMesage), String, 3);
   
    replace_all(szMesage, charsmax(szMesage), "!1", "^1");
    replace_all(szMesage, charsmax(szMesage), "!3", "^3");
    replace_all(szMesage, charsmax(szMesage), "!4", "^4");
   
    static g_msg_SayText = 0;
    if(!g_msg_SayText)
        g_msg_SayText = get_user_msgid("SayText");
   
    new Players[32], iNum = 1, i;
 
    if(id) Players[0] = id;
    else get_players(Players, iNum, "ch");
   
    for(--iNum; iNum >= 0; iNum--)
    {
        i = Players[iNum];
       
        message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
        write_byte(i);
        write_string(szMesage);
        message_end();
    }
}

_________________
Stick with the best & regards Adryyy .


x , daNzeT , Arion , Chaos , Exolent , aNNakin , PoSiTiOn Of PoWeR , ExoTiQ , -UnQ- UHD , ViciousVixen , Arkshine , Askhanar , KronoS eXtream , alkaline , CryWolf , Fuffy , tre3fla , Rap^ , Hades Ownage , xPaw .


10 Jan 2019 19:51
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0

Joined: 26 Nov 2018 19:52
Posts: 69
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Acum ai scos definitiv :(

Deci YONTU mi-a facut pluginul, mi-a facut sa poti cumpara doar o singura data din shop intr-o runda (sa nu poti cumpara spre ex de 10 ori 100hp), inainte sa modifici pluginul mergea, acum insa nu mai merge, deci sa ramana chestia asta cu odata pe runda, vreau doar sa afiseze ...... ce am scris in ultimul meu post de mai sus.

Asa era pluginul inainte sa-l modifici:

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <dhudmessage>
#include <fakemeta>
#include <nvault>

#define PLUGIN_VERSION "1.0"

#define MAX_PLAYERS 32
#define TASK_GM 2199

// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------
#define HP 100
#define VITEZA 500
#define CREDITE_KILL 10
#define TAG "[~ S H O P ~]"
// --------------------------------------------
// ------------- DE EDITAT ---------------
// --------------------------------------------

new meniu;
new callback;
new bar;
new credite[MAX_PLAYERS+1];
new bool:viteza[MAX_PLAYERS+1];
new bool:invizibilitate[MAX_PLAYERS+1];
new bool:godmode[MAX_PLAYERS+1];
new bool:am_ales[MAX_PLAYERS+1];
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new vault;

enum datas_
{
str[32],
info,
cost
};

/*
prima coloana: numele itemului
a doua coloana: cantitatea din item
ultima coloana: costul itemului

sa zicem ca X este un numar. Daca in numele itemului se afla X, pe acesta trebuie sa il inlocuiesti cu simbolul '#'. X reprezinta cantitatea din acel item. Mai jos ai exemplu.
pluginul creaza automat meniul si itemele, numele itemelor si cantitatatea itemelor se inlocuiesc automat, tu trebuie sa modifici mai jos matricea dupa bunul plac

daca in item nu se afla nicio cantitate, la a doua coloana scrii -1
*/
new const data_meniu[][datas_] =
{
// nume // cantitate // cost
{ "+#HP", HP, 20},
{ "AK47", -1, 20},
{ "M4A1", -1, 20},
{ "Pachet AK47-HP-HE", -1, 40},
{ "Arma random", -1, 15},
{ "Surpriza", -1, 30},
{ "Loterie", -1, 100}
};

public plugin_init()
{
register_plugin("Shop", PLUGIN_VERSION, "YONTU");

register_event("HLTV", "event_newround", "a", "1=0", "2=0");
RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", true);
register_clcmd("say /shop", "cmd_shop");
register_clcmd("say_team /shop", "cmd_shop");
register_clcmd("drop", "cmd_use_power");

register_concmd("amx_credite", "cmd_credite", ADMIN_IMMUNITY, "<nume> <credite>");

bar = get_user_msgid("BarTime");

vault = nvault_open("credite");
if(vault == INVALID_HANDLE)
set_fail_state("Eroare la deschiderea bazei de date din foldeurul data/vault.");
}

public plugin_end()
{
nvault_close(vault);
}

public salveaza_credite(id)
{
new vaultdata[64];
format(vaultdata, charsmax(vaultdata), "%i#", credite[id]);

new nume[32];
get_user_name(id, nume, charsmax(nume));
nvault_set(vault, nume, vaultdata);
}

public incarca_credite(id)
{
new vaultdata[64], temp[MAX_PLAYERS+1];
format(vaultdata, charsmax(vaultdata), "%i#", credite[id]);

new nume[32];
get_user_name(id, nume, charsmax(nume));
nvault_get(vault, nume, vaultdata, charsmax(vaultdata));
replace_all(vaultdata, charsmax(vaultdata), "#", " ");

parse(vaultdata, temp, charsmax(temp));
credite[id] = str_to_num(temp);
}

public cmd_use_power(id)
{
if(is_user_alive(id) && godmode[id])
{
set_dhudmessage(255, 255, 0, -1.0, 0.78, 0, _, 2.0);
show_dhudmessage(id, "ESTI I N V I N C I B I L!");

set_user_godmode(id, true);
godmode[id] = false;
ShakeScreen(id, 2.0);

message_begin(MSG_ONE_UNRELIABLE, bar, .player=id)
write_short(5);
message_end();

set_task(30.0, "opreste_godmode", id + TASK_GM);
}

return PLUGIN_CONTINUE;
}

public opreste_godmode(id)
{
id -= TASK_GM;
set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
ColorChat(id, "!4%s!1 Nu mai esti invincibil.", TAG);
set_user_godmode(id, false);
ShakeScreen(id, 2.0);
}

public event_newround()
{
arrayset(am_ales, false, charsmax(am_ales));
arrayset(viteza, false, charsmax(viteza));
arrayset(godmode, false, charsmax(godmode));

new i, players[MAX_PLAYERS], num, id;
get_players(players, num);
for(i = 0; i < num; i++)
{
id = players[i];
if(!is_user_alive(id))
continue;

if(invizibilitate[id])
{
invizibilitate[id] = false;
set_user_rendering(id);
}

if(task_exists(id + TASK_GM))
remove_task(id + TASK_GM);
}
}

public fw_ResetMaxSpeedPost(id)
{
if(is_user_alive(id) && viteza[id])
{
engfunc(EngFunc_SetClientMaxspeed, id, VITEZA);
set_pev(id, pev_maxspeed, VITEZA);
}
return HAM_IGNORED;
}

public client_death(killer, victim, wpnindex, hitplace, tk)
{
if(!is_user_alive(killer))
return;

if(killer == victim)
return;

credite[killer] += CREDITE_KILL;
salveaza_credite(killer);

if(viteza[killer]) viteza[killer] = false;
if(godmode[killer]) godmode[killer] = false;
if(invizibilitate[killer])
{
invizibilitate[killer] = false;
set_user_rendering(killer);
}
}

public client_putinserver(id)
{
am_ales[id] = false;
viteza[id] = false;
invizibilitate[id] = false;
godmode[id] = false;
incarca_credite(id);
}

public client_disconnected(id)
{
if(task_exists(id + TASK_GM))
remove_task(id + TASK_GM);

salveaza_credite(id);
}

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

if(!is_user_alive(id))
return ITEM_DISABLED;

if(am_ales[id])
return ITEM_DISABLED;

if(credite[id] < data_meniu[item][cost])
return ITEM_DISABLED;

return ITEM_ENABLED;
}

public shop_handler(id, menu, item)
{
if(cs_get_user_team( id ) == CS_TEAM_T) {
ColorChat(id, "!4%s!1 Doar!3 CT !1au acces!", TAG);

return true
}
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}

switch(item)
{
case 0:
{
set_user_health(id, get_user_health(id) + HP);
am_ales[id] = true;
ColorChat(id, "!4%s!1 Acum ai cu!3 100HP !1mai mult!", TAG);
am_ales[id] = true;
}
case 1:
{
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
am_ales[id] = true;
}
case 2:
{
give_item(id, "weapon_m4a1");
cs_set_user_bpammo(id, CSW_M4A1, 90);
ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
am_ales[id] = true;
}
case 3:
{
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
set_user_health(id, get_user_health(id) + HP);

if(!user_has_weapon(id, CSW_HEGRENADE))
{
give_item(id, "weapon_hegrenade");
}
cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
ColorChat(id, "!4%s!1 Ai primit!3 M4A1 + 100HP + 2HE!", TAG);
am_ales[id] = true;
}
case 4:
{
switch(random_num(0, 12))
{
case 0:
{
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 90);
ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);

}
case 1:
{
give_item(id, "weapon_p90");
cs_set_user_bpammo(id, CSW_P90, 90);
ColorChat(id, "!4%s!1 Ai primit!3 P90!", TAG);
}
case 2:
{
give_item(id, "weapon_scout");
cs_set_user_bpammo(id, CSW_SCOUT, 30);
ColorChat(id, "!4%s!1 Ai primit!3 SCOUT!", TAG);
}
case 3:
{
give_item(id, "weapon_famas");
cs_set_user_bpammo(id, CSW_FAMAS, 90);
ColorChat(id, "!4%s!1 Ai primit!3 FAMAS!", TAG);

}
case 4:
{
give_item(id, "weapon_m4a1");
cs_set_user_bpammo(id, CSW_M4A1, 90);
ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);

}
case 5:
{
give_item(id, "weapon_awp");
cs_set_user_bpammo(id, CSW_AWP, 30);
ColorChat(id, "!4%s!1 Ai primit!3 AWP!", TAG);

}
case 6:
{
give_item(id, "weapon_elite");
cs_set_user_bpammo(id, CSW_ELITE, 90);
ColorChat(id, "!4%s!1 Ai primit!3 ELITE!", TAG);

}
case 7:
{
give_item(id, "weapon_mac10");
cs_set_user_bpammo(id, CSW_MAC10, 90);
ColorChat(id, "!4%s!1 Ai primit!3 MAC10!", TAG);

}
case 8:
{
give_item(id, "weapon_xm1014");
cs_set_user_bpammo(id, CSW_XM1014, 21);
ColorChat(id, "!4%s!1 Ai primit!3 XM1014!", TAG);

}
case 9:
{
give_item(id, "weapon_m249");
cs_set_user_bpammo(id, CSW_M249, 200);
ColorChat(id, "!4%s!1 Ai primit!3 M249!", TAG);

}
case 10:
{
give_item(id, "weapon_aug");
cs_set_user_bpammo(id, CSW_AUG, 90);
ColorChat(id, "!4%s!1 Ai primit!3 AUG!", TAG);

}
case 11:
{
give_item(id, "weapon_ump45");
cs_set_user_bpammo(id, CSW_UMP45, 90);
ColorChat(id, "!4%s!1 Ai primit!3 UMP45!", TAG);

}
case 12:
{
give_item(id, "weapon_tmp");
cs_set_user_bpammo(id, CSW_TMP, 90);
ColorChat(id, "!4%s!1 Ai primit!3 TMP!", TAG);

}
}
am_ales[id] = true;
}
case 5: // (100% invizibilitate, +2credite, AWP, speed 1000, 5HE, GOD MODE 5sec)
{
switch(random_num(0, 8))
{
case 0:
{
invizibilitate[id] = true;
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 25);
ColorChat(id, "!4%s!1 Acum esti!3 I N V I Z I B I L!1.", TAG);

ShakeScreen(id, 2.0);
}
case 1:
{
credite[id] += 30;
ColorChat(id, "!4%s!1 Ai castigat in plus!3 30 credite!1.", TAG);
}
case 2:
{
give_item(id, "weapon_awp");
cs_set_user_bpammo(id, CSW_AWP, 30);
ColorChat(id, "!4%s!1 Ai castigat un!3 AWP!", TAG);
}
case 3:
{
viteza[id] = true;
ColorChat(id, "!4%s!1 Acum esti mult mai!3 rapid.", TAG);

ShakeScreen(id, 2.0);
}
case 4:
{
if(!user_has_weapon(id, CSW_HEGRENADE))
{
give_item(id, "weapon_hegrenade");
}
cs_set_user_bpammo(id, CSW_HEGRENADE, 5);
ColorChat(id, "!4%s!1 Ai castigat!3 5 HE.", TAG);
}
case 5:
{
godmode[id] = true;

new nume[32];
get_user_name(id, nume, charsmax(nume));
ColorChat(0, "!4%s!3 %s!1 a avut norocul sa devina !3invincibil!1 30sec.", TAG, nume);
ColorChat(id, "!4%s!1 Apasta tasta!4 V!1 sa iti activezi puterea.", TAG);

set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
show_dhudmessage(id, "Fa-te invincibil prin apasarea tastei V.");
}
case 6:
{
credite[id] += 50;
ColorChat(id, "!4%s!1 Ai castigat in plus!3 50 credite!1.", TAG);
}
case 7:
{
give_item(id, "weapon_ak47");
cs_set_user_bpammo(id, CSW_AK47, 30);
ColorChat(id, "!4%s!1 Ai castigat un!3 AK47!", TAG);
}
case 8:
{
set_user_noclip(id,1);
set_task(8.0,"removeClip",id);
ColorChat(id, "!4%s!1 NoClip pentru!3 8 sec!", TAG);
}
}
am_ales[id] = true;
}


case 6:
{
new nume[32];
get_user_name(id, nume, charsmax(nume));
switch(random_num(0, 17))
{
case 0:
{
credite[id] += 50;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 50 credite !1la loterie.", TAG, nume);
}
case 1:
{
credite[id] += 99;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 99 credite !1la loterie.", TAG, nume);
}
case 2:
{
credite[id] += 1;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 1 credit !1la loterie.", TAG, nume);
}
case 3:
{
credite[id] += 150;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 150 credite !1la loterie.", TAG, nume);
}
case 4:
{
credite[id] += 20;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
}
case 5:
{
credite[id] += 120;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 120 credite !1la loterie.", TAG, nume);
}
case 6:
{
credite[id] += 100;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 100 credite !1la loterie.", TAG, nume);
}
case 7:
{
credite[id] += 222;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 222 credite !1la loterie.", TAG, nume);
}
case 8:
{
ColorChat(0, "!4%s!1 GHINION! !3%s!1 a pierdut!3 100 credite !1la loterie.", TAG, nume);
}
case 9:
{
credite[id] += 80;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 80 credite !1la loterie.", TAG, nume);
}
case 10:
{
credite[id] += 130;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 130 credite !1la loterie.", TAG, nume);
}
case 11:
{
credite[id] += 69;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 69 credite !1la loterie.", TAG, nume);
}
case 12:
{
credite[id] += 20;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
}
case 13:
{
credite[id] += 77;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 77 credite !1la loterie.", TAG, nume);
}
case 14:
{
credite[id] += 444;
ColorChat(0, "!4%s!1 BINGO! !3%s!1 a castigat marele premiu la loterie,!3 444 credite.", TAG, nume);
}
case 15:
{
credite[id] += 11;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 11 credite !1la loterie.", TAG, nume);
}
case 16:
{
credite[id] += 90;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 90 credite !1la loterie.", TAG, nume);
}
case 17:
{
credite[id] += 180;
ColorChat(0, "!4%s!3 %s!1 a castigat!3 180 credite !1la loterie.", TAG, nume);
}
}
am_ales[id] = true;
}
}
credite[id] -= data_meniu[item][cost];
menu_destroy(menu);
return PLUGIN_HANDLED;
}

public removeClip(id) {
set_user_noclip(id,0);
ColorChat(id, "!4%s!1 NoClip !3 OFF!", TAG);
}

public cmd_shop(id)
{
static text[128], tasta[2], str_to_rpl[5], i;
formatex(text, charsmax(text), "Meniu Shop | Creditele tale:\r %d\w", credite[id]);
meniu = menu_create(text, "shop_handler");
callback = menu_makecallback("hook_shop");

for(i = 0; i < sizeof data_meniu; i++)
{
if(data_meniu[i][info] != -1)
{
num_to_str(data_meniu[i][info], str_to_rpl, charsmax(str_to_rpl));
copy(text, charsmax(text), data_meniu[i][str]);
replace(text, charsmax(text), "#", str_to_rpl);
formatex(text, charsmax(text), "%s -\r %d\w credit%s", text, data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
}
else
{
formatex(text, charsmax(text), "%s -\r %d\w credit%s", data_meniu[i][str], data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
}

tasta[0] = i;
tasta[1] = 0;
menu_additem(meniu, text, tasta, _, callback);
}
menu_setprop(meniu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, meniu);
return PLUGIN_CONTINUE;
}

public cmd_credite(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED;

new nume[32], cantitate[13];
read_argv(1, nume, charsmax(nume));
read_argv(2, cantitate, charsmax(cantitate));

new player = cmd_target(id, nume, 8);
if(!player || !is_user_connected(id))
{
client_cmd(id, "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
return PLUGIN_HANDLED;
}

new credite_ = str_to_num(cantitate);
if(credite_ <= 0)
{
client_cmd(id, "echo Numarul de credite trebuie sa fie mai mare decat 0.");
return PLUGIN_HANDLED;
}

credite[player] += credite_;
salveaza_credite(player);

new nume_admin[32];
get_user_name(id, nume_admin, charsmax(nume_admin));

new nume_jucator[32];
get_user_name(player, nume_jucator, charsmax(nume_jucator));

ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a dat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);

return PLUGIN_HANDLED;
}

public ShakeScreen(id, const Float:iSeconds)
{
static g_msg_SS = 0;
if(!g_msg_SS)
g_msg_SS = get_user_msgid("ScreenShake");

message_begin(MSG_ONE, g_msg_SS, _, id);
write_short(floatround(4096.0 * iSeconds, floatround_round));
write_short(floatround(4096.0 * iSeconds, floatround_round));
write_short(1<<13);
message_end();
}

stock ColorChat(id, String[], any:...)
{
static szMesage[192];
vformat(szMesage, charsmax(szMesage), String, 3);

replace_all(szMesage, charsmax(szMesage), "!1", "^1");
replace_all(szMesage, charsmax(szMesage), "!3", "^3");
replace_all(szMesage, charsmax(szMesage), "!4", "^4");

static g_msg_SayText = 0;
if(!g_msg_SayText)
g_msg_SayText = get_user_msgid("SayText");

new Players[32], iNum = 1, i;

if(id) Players[0] = id;
else get_players(Players, iNum, "ch");

for(--iNum; iNum >= 0; iNum--)
{
i = Players[iNum];

message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
write_byte(i);
write_string(szMesage);
message_end();
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/


Aici functioneaza perfect, atunci cand cumpar din shop ceva si vreau sa mai cumpar inca ceva in aceeasi runda mi se dezactiveaza (apare cu gri tot randul, nu doar cifrele)


10 Jan 2019 20:01
Profile multumesc WWW
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1673
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Fond eXtream: 0
este imposibil să nu-ți meargă ce ți-am dat mai sus..oricum tu ai zis cândva câ vrei să arate altfel..

mă rog | Afiseaza codul
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <dhudmessage>
#include <fakemeta>
#include <nvault>

#pragma tabsize 0


#define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in KNIFE MOD LA FEL
#define SKIN_P_KNIFE "models/skins/p_knife.mdl"



#define SPECIAL_SKIN "models/player/sk/sk.mdl"

 
#define PLUGIN_VERSION  "1.0"
 
#define MAX_PLAYERS 32
#define TASK_GM     2199
 
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
#define hp      100
#define VITEZA      500
#define CREDITE_KILL    10
#define TAG     "[~ S H O P ~]"
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
 
new meniu;
new callback;
new bar;
new credite[MAX_PLAYERS+1];
new bool:viteza[MAX_PLAYERS+1];
new bool:invizibilitate[MAX_PLAYERS+1];
new bool:godmode[MAX_PLAYERS+1];
new bool:am_ales[MAX_PLAYERS+1];
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new vault;

new havesk[33],havess[33]
 
enum datas_
{
    str[125],
    info,
    cost
};
 
/*
prima coloana: numele itemului
a doua coloana: cantitatea din item
a treia coloana: costul itemului
 
sa zicem ca X este un numar. Daca in numele itemului se afla X, pe acesta trebuie sa il inlocuiesti cu simbolul '#'. X reprezinta cantitatea din acel item. Mai jos ai exemplu.
pluginul creaza automat meniul si itemele, numele itemelor si cantitatatea itemelor se inlocuiesc automat, tu trebuie sa modifici mai jos matricea dupa bunul plac
 
daca in item nu se afla nicio cantitate, la a doua coloana scrii -1
*/
new const data_meniu[][datas_] =

    // nume     // cantitate    // cost
    { "+HP (CT)",       hp,         20},
    { "AK47 (CT)",       -1,         20},
    { "M4A1 (CT)",       -1,         20},
    { "Pachet AK47-HP-HE (CT)",       -1,         40},
    { "Arma random (CT)",    -1,         15},
    { "Surpriza (CT)",   -1,         30},
    { "Loterie",   -1,         100},

    { "Special Knife [Permanent]",   -1,         30000},
    { "Special Skin [Permanent",   -1,         10000}
};
 
public plugin_init()
{
    register_plugin("Shop", PLUGIN_VERSION, "YONTU");
   
    register_event("HLTV", "event_newround", "a", "1=0", "2=0");

register_event("CurWeapon","checkWeapon","be","1=1")

    RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeedPost", true);

RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1 )

register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" )

    register_clcmd("say /shop", "cmd_shop");
    register_clcmd("say_team /shop", "cmd_shop");

    register_clcmd("drop", "cmd_use_power");
 
    register_concmd("amx_credite", "cmd_credite", ADMIN_IMMUNITY, "<nume> <credite>");
    register_concmd("amx_rcredite", "cmd_rcredite", ADMIN_IMMUNITY, "<nume> <credite>");
 
    bar = get_user_msgid("BarTime");
 
    vault = nvault_open("credite");
    if(vault == INVALID_HANDLE)
        set_fail_state("Eroare la deschiderea bazei de date din foldeurul data/vault.");
}

public plugin_natives( )   register_native( "get_user_sk", "_get_user_sk" );
public _get_user_sk( )   return havesk[ get_param( 1 ) ];

public plugin_precache()
{
   precache_model(SKIN_V_KNIFE)
   precache_model(SKIN_P_KNIFE)

   precache_model(SPECIAL_SKIN)
}
public PlayerSpawn(id)   if(is_user_alive(id)&&havess[id])   cs_set_user_model(id,SPECIAL_SKIN)
public fw_SetClientKeyValue( id, const infobuffer[ ], const key[ ] ) {
    if( equal( key, "model" )&&is_user_connected(id)&&havess[id] ) {
   set_user_info( id, "model", SPECIAL_SKIN )

   return FMRES_SUPERCEDE
    }
    return FMRES_IGNORED
}


public checkWeapon(id)
{
   new gl, ammo;
   new arma;
   
   arma = get_user_weapon(id, gl , ammo)
   if(arma == CSW_KNIFE&&havesk[id])
   {
      set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
      set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
      set_user_maxspeed(id,400.0)
   }
   /*else if(arma!=CSW_KNIFE)
   {
      set_user_maxspeed(id,250.0)
      return PLUGIN_CONTINUE
   }*/
   return PLUGIN_HANDLED
}


 
public plugin_end()
{
    nvault_close(vault);
}
 
public salveaza_credite(id)
{
    new vaultdata[64];
    formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);
 
    new nume[32];
    get_user_name(id, nume, charsmax(nume));
    nvault_set(vault, nume, vaultdata);
}
public incarca_credite(id)
{
    new vaultdata[64], temp[MAX_PLAYERS+1], temp2[MAX_PLAYERS+1], temp3[MAX_PLAYERS+1]
    formatex(vaultdata, charsmax(vaultdata), "%i#%i#%i", credite[id],havesk[id],havess[id]);
 
    new nume[32];
    get_user_name(id, nume, charsmax(nume));
    nvault_get(vault, nume, vaultdata, charsmax(vaultdata));
    replace_all(vaultdata, charsmax(vaultdata), "#", " ");
 
    parse(vaultdata, temp, charsmax(temp), temp2, charsmax(temp2), temp3, charsmax(temp3));
    credite[id] = str_to_num(temp);

    havesk[id] = str_to_num(temp2);
   havess[id] = str_to_num(temp3);
}
 
public cmd_use_power(id)
{     
    if(is_user_alive(id) && godmode[id])
    {
        set_dhudmessage(255, 255, 0, -1.0, 0.78, 0, _, 2.0);
        show_dhudmessage(id, "ESTI   I N V I N C I B I L!");
 
        set_user_godmode(id, true);
        godmode[id] = false;   
        ShakeScreen(id, 2.0);
 
        message_begin(MSG_ONE_UNRELIABLE, bar, .player=id)
        write_short(5);
        message_end();
 
        set_task(30.0, "opreste_godmode", id + TASK_GM);
    }
 
    return PLUGIN_CONTINUE;
}
 
public opreste_godmode(id)
{
    id -= TASK_GM;
    set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
    ColorChat(id, "!4%s!1 Nu mai esti invincibil.", TAG);
    set_user_godmode(id, false);
    ShakeScreen(id, 2.0);
}
 
public event_newround()
{
    arrayset(am_ales, false, charsmax(am_ales));
    arrayset(viteza, false, charsmax(viteza));
    arrayset(godmode, false, charsmax(godmode));
   
    new i, players[MAX_PLAYERS], num, id;
    get_players(players, num);
    for(i = 0; i < num; i++)
    {
        id = players[i];
        if(!is_user_alive(id))
            continue;
 
        if(invizibilitate[id])
        {
            invizibilitate[id] = false;
            set_user_rendering(id);
        }
 
        if(task_exists(id + TASK_GM))
            remove_task(id + TASK_GM);
    }
}
 
public fw_ResetMaxSpeedPost(id)
{
    if(is_user_alive(id) && viteza[id])
    {
        engfunc(EngFunc_SetClientMaxspeed, id, VITEZA);
        set_pev(id, pev_maxspeed, VITEZA);
    }
    return HAM_IGNORED;
}
 
public client_death(killer, victim, wpnindex, hitplace, tk)
{
    if(!is_user_alive(killer))
        return;
 
    if(killer == victim)
        return;
 
    credite[killer] += CREDITE_KILL;
    salveaza_credite(killer);
 
    if(viteza[killer]) viteza[killer] = false;
    if(godmode[killer]) godmode[killer] = false;
    if(invizibilitate[killer])
    {
        invizibilitate[killer] = false;
        set_user_rendering(killer);
    }
}
 
public client_putinserver(id)
{
    am_ales[id] = false;
    viteza[id] = false;
    invizibilitate[id] = false;
    godmode[id] = false;
    incarca_credite(id);
}
 
public client_disconnected(id)
{
    if(task_exists(id + TASK_GM))
        remove_task(id + TASK_GM);
 
    salveaza_credite(id);
}
 
public hook_shop(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
 
    if(!is_user_alive(id))
        return ITEM_DISABLED;
       
    if(am_ales[id])
        return ITEM_DISABLED;
           
    if(credite[id] < data_meniu[item][cost])
        return ITEM_DISABLED;
   
    return ITEM_ENABLED;
}
 
public shop_handler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
   
    switch(item)
    {
        case 0:
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            set_user_health(id, get_user_health(id) + hp);
            am_ales[id] = true;
            ColorChat(id, "!4%s!1 Acum ai cu!3 %dHP !1mai mult!", TAG,hp);
            am_ales[id] = true;
        }
        case 1:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
                    am_ales[id] = true;
                }
        case 2:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_m4a1");
                    cs_set_user_bpammo(id, CSW_M4A1, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
                    am_ales[id] = true;
                }
        case 3:
                {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    set_user_health(id, get_user_health(id) + hp);

                    if(!user_has_weapon(id, CSW_HEGRENADE))
                    {
                        give_item(id, "weapon_hegrenade");
                    }
                    cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1 + %dHP + 2HE!", TAG,hp);
                    am_ales[id] = true;
                }
        case 4:
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            switch(random_num(0, 12))
            {
                case 0:
                {
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AK-47!", TAG);
                   
                }
                case 1:
                {
                    give_item(id, "weapon_p90");
                    cs_set_user_bpammo(id, CSW_P90, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 P90!", TAG);
                }
                case 2:
                {
                    give_item(id, "weapon_scout");
                    cs_set_user_bpammo(id, CSW_SCOUT, 30);
                    ColorChat(id, "!4%s!1 Ai primit!3 SCOUT!", TAG);
                }
                case 3:
                {
                    give_item(id, "weapon_famas");
                    cs_set_user_bpammo(id, CSW_FAMAS, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 FAMAS!", TAG);
                   
                }
                case 4:
                {
                    give_item(id, "weapon_m4a1");
                    cs_set_user_bpammo(id, CSW_M4A1, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 M4A1!", TAG);
                   
                }
                case 5:
                {
                    give_item(id, "weapon_awp");
                    cs_set_user_bpammo(id, CSW_AWP, 30);
                    ColorChat(id, "!4%s!1 Ai primit!3 AWP!", TAG);
                   
                }
                case 6:
                {
                    give_item(id, "weapon_elite");
                    cs_set_user_bpammo(id, CSW_ELITE, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 ELITE!", TAG);
                   
                }
                case 7:
                {
                    give_item(id, "weapon_mac10");
                    cs_set_user_bpammo(id, CSW_MAC10, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 MAC10!", TAG);
                   
                }
                case 8:
                {
                    give_item(id, "weapon_xm1014");
                    cs_set_user_bpammo(id, CSW_XM1014, 21);
                    ColorChat(id, "!4%s!1 Ai primit!3 XM1014!", TAG);
                   
                }
                case 9:
                {
                    give_item(id, "weapon_m249");
                    cs_set_user_bpammo(id, CSW_M249, 200);
                    ColorChat(id, "!4%s!1 Ai primit!3 M249!", TAG);
                   
                }
                case 10:
                {
                    give_item(id, "weapon_aug");
                    cs_set_user_bpammo(id, CSW_AUG, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 AUG!", TAG);
                   
                }
                case 11:
                {
                    give_item(id, "weapon_ump45");
                    cs_set_user_bpammo(id, CSW_UMP45, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 UMP45!", TAG);
                   
                }
                case 12:
                {
                    give_item(id, "weapon_tmp");
                    cs_set_user_bpammo(id, CSW_TMP, 90);
                    ColorChat(id, "!4%s!1 Ai primit!3 TMP!", TAG);
                   
                }
            }
            am_ales[id] = true;
        }
        case 5: // (100% invizibilitate, +2credite, AWP, speed 1000, 5HE, GOD MODE 5sec)
        {
         if(get_user_team(id)!=2)   return PLUGIN_HANDLED
            switch(random_num(0, 8))
            {
                case 0:
                {
                    invizibilitate[id] = true;
                    set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 25);
                    ColorChat(id, "!4%s!1 Acum esti!3 I N V I Z I B I L!1.", TAG);
 
                    ShakeScreen(id, 2.0);
                }
                case 1:
                {
                    credite[id] += 30;
                    ColorChat(id, "!4%s!1 Ai castigat in plus!3 30 credite!1.", TAG);
                }
                case 2:
                {
                    give_item(id, "weapon_awp");
                    cs_set_user_bpammo(id, CSW_AWP, 30);
                    ColorChat(id, "!4%s!1 Ai castigat un!3 AWP!", TAG);
                }
                case 3:
                {
                    viteza[id] = true;
                    ColorChat(id, "!4%s!1 Acum esti mult mai!3 rapid.", TAG);
 
                    ShakeScreen(id, 2.0);
                }
                case 4:
                {
                    if(!user_has_weapon(id, CSW_HEGRENADE))
                    {
                        give_item(id, "weapon_hegrenade");
                    }
                    cs_set_user_bpammo(id, CSW_HEGRENADE, 5);
                    ColorChat(id, "!4%s!1 Ai castigat!3 5 HE.", TAG);
                }
                case 5:
                {
                    godmode[id] = true;
                   
                    new nume[32];
                    get_user_name(id, nume, charsmax(nume));
                    ColorChat(0, "!4%s!3 %s!1 a avut norocul sa devina !3invincibil!1 30sec.", TAG, nume);
                    ColorChat(id, "!4%s!1 Apasta tasta!4 V!1 sa iti activezi puterea.", TAG);
 
                    set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0);
                    show_dhudmessage(id, "Fa-te invincibil prin apasarea tastei V.");
                }
                case 6:
                {
                    credite[id] += 50;
                    ColorChat(id, "!4%s!1 Ai castigat in plus!3 50 credite!1.", TAG);
                }
                case 7:
                {
                    give_item(id, "weapon_ak47");
                    cs_set_user_bpammo(id, CSW_AK47, 30);
                    ColorChat(id, "!4%s!1 Ai castigat un!3 AK47!", TAG);
                }
                case 8:
                {
     set_user_noclip(id,1);
     set_task(8.0,"removeClip",id);
                    ColorChat(id, "!4%s!1 NoClip pentru!3 8 sec!", TAG);
                }
            }
            am_ales[id] = true;
        }


        case 6:
         {
             new nume[32];
             get_user_name(id, nume, charsmax(nume));
             switch(random_num(0, 17))
            {
                case 0:
                {
                    credite[id] += 50;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 50 credite !1la loterie.", TAG, nume);
                }
                case 1:
                {
                    credite[id] += 99;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 99 credite !1la loterie.", TAG, nume);
                }
                case 2:
                {
                    credite[id] += 1;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 1 credit !1la loterie.", TAG, nume);
                }
                case 3:
                {
                    credite[id] += 150;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 150 credite !1la loterie.", TAG, nume);
                }
                case 4:
                {
                    credite[id] += 20;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
                }
                case 5:
                {
                    credite[id] += 120;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 120 credite !1la loterie.", TAG, nume);
                }
                case 6:
                {
                    credite[id] += 100;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 100 credite !1la loterie.", TAG, nume);
                }
                case 7:
                {
                    credite[id] += 222;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 222 credite !1la loterie.", TAG, nume);
                }
                case 8:
                {
                    ColorChat(0, "!4%s!1 GHINION! !3%s!1 a pierdut!3 100 credite !1la loterie.", TAG, nume);
                }
                case 9:
                {
                    credite[id] += 80;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 80 credite !1la loterie.", TAG, nume);
                }
                case 10:
                {
                    credite[id] += 130;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 130 credite !1la loterie.", TAG, nume);
                }
                case 11:
                {
                    credite[id] += 69;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 69 credite !1la loterie.", TAG, nume);
                }
                case 12:
                {
                    credite[id] += 20;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 20 credite !1la loterie.", TAG, nume);
                }
                case 13:
                {
                    credite[id] += 77;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 77 credite !1la loterie.", TAG, nume);
                }
                case 14:
                {
                    credite[id] += 444;
                    ColorChat(0, "!4%s!1 BINGO! !3%s!1 a castigat marele premiu la loterie,!3 444 credite.", TAG, nume);
                }
                case 15:
                {
                    credite[id] += 11;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 11 credite !1la loterie.", TAG, nume);
                }
                case 16:
                {
                    credite[id] += 90;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 90 credite !1la loterie.", TAG, nume);
                }
                case 17:
                {
                    credite[id] += 180;
                    ColorChat(0, "!4%s!3 %s!1 a castigat!3 180 credite !1la loterie.", TAG, nume);
                }
             }
          am_ales[id] = true;
          }


        case 7:
         { 
         if(havesk[id])   return PLUGIN_HANDLED

         give_item(id,"weapon_knife")
         engclient_cmd(id,"weapon_knife")

      set_pev(id, pev_viewmodel2, SKIN_V_KNIFE)
      set_pev(id, pev_weaponmodel2, SKIN_P_KNIFE)
      set_user_maxspeed(id,400.0)

checkWeapon(id)

havesk[id]=1
salveaza_credite(id)

          am_ales[id] = true;
      }

        case 8:
         { 
         if(havess[id])   return PLUGIN_HANDLED

cs_set_user_model(id,SPECIAL_SKIN)

havess[id]=1
salveaza_credite(id)

          am_ales[id] = true;
      }


}
    credite[id] -= data_meniu[item][cost];
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
 
public removeClip(id) {
   set_user_noclip(id,0);
                  ColorChat(id, "!4%s!1 NoClip !3 OFF!", TAG);
}

public cmd_shop(id)
{
    static text[128], tasta[2], i;
   //new str_to_rpl[5]
    formatex(text, charsmax(text), "Meniu Shop | Creditele tale:\r %d\w", credite[id]);
    meniu = menu_create(text, "shop_handler");
    callback = menu_makecallback("hook_shop");
   
    for(i = 0; i < sizeof data_meniu; i++)
    {
       if(data_meniu[i][info] != -1)
        {
            //num_to_str(data_meniu[i][info], str_to_rpl, charsmax(str_to_rpl));
            copy(text, charsmax(text), data_meniu[i][str]);
            //replace_all(text, charsmax(text), "#", str_to_rpl);
            /*if(credite[id]>=data_meniu[i][cost])*/   formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", text, data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
//else if(credite[id]<data_meniu[i][cost]||am_ales[id])   formatex(text, charsmax(text), "\d%s - %d credite", text,data_meniu[i][cost]);
        }
        else
        {
            /*if(credite[id]>=data_meniu[i][cost])*/   formatex(text, charsmax(text), "\y%s -\r %d\w credit%s", data_meniu[i][str], data_meniu[i][cost], data_meniu[i][cost] == 1 ? "" : "e");
//else if(credite[id]<data_meniu[i][cost]||am_ales[id])   formatex(text, charsmax(text), "\d%s - %d credite", data_meniu[i][str],data_meniu[i][cost]);
        }
       
        tasta[0] = i;
        tasta[1] = 0;
        menu_additem(meniu, text, tasta, _, callback);
    }
    menu_setprop(meniu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, meniu);
    return PLUGIN_CONTINUE;
}

public cmd_credite(id, level, cid)
{
    if(!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED;
   
    new nume[32],  cantitate[13];
    read_argv(1, nume,  charsmax(nume));
    read_argv(2, cantitate,  charsmax(cantitate));
   
    new player = cmd_target(id, nume, 8);
    if(!player || !is_user_connected(id))
    {
        client_cmd(id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
        return PLUGIN_HANDLED;
    }
   
    new credite_  =  str_to_num(cantitate);
    if(credite_  <=  0)
    {
        client_cmd(id,  "echo Numarul de credite trebuie sa fie mai mare decat 0.");
        return PLUGIN_HANDLED;
    }
   
    credite[player] += credite_;
    salveaza_credite(player);
   
    new nume_admin[32];
    get_user_name(id,  nume_admin, charsmax(nume_admin));
   
    new nume_jucator[32];
    get_user_name(player,  nume_jucator,  charsmax(nume_jucator));
   
    ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a dat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);
 
    return PLUGIN_HANDLED;
}
public cmd_rcredite(id, level, cid)
{
    if(!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED;
   
    new nume[32],  cantitate[13];
    read_argv(1, nume,  charsmax(nume));
    read_argv(2, cantitate,  charsmax(cantitate));
   
    new player = cmd_target(id, nume, 8);
    if(!player || !is_user_connected(id))
    {
        client_cmd(id,  "echo Jucatorul %s nu a fost gasit sau nu este conectat!", nume);
        return PLUGIN_HANDLED;
    }
   
    new credite_  =  str_to_num(cantitate);
    if(credite_  <=  0)
    {
        client_cmd(id,  "echo Numarul de credite trebuie sa fie mai mare decat 0.");
        return PLUGIN_HANDLED;
    }
   
    credite[player] -= credite_;
    salveaza_credite(player);
   
    new nume_admin[32];
    get_user_name(id,  nume_admin, charsmax(nume_admin));
   
    new nume_jucator[32];
    get_user_name(player,  nume_jucator,  charsmax(nume_jucator));
   
    ColorChat(0, "!4%s!1 Adminul!4 %s!1 i-a luat!3 %d!1 credit%s lui!3 %s!1.", TAG, nume_admin, credite_, credite_ == 1 ? "" : "e", nume_jucator);
 
    return PLUGIN_HANDLED;
}
 
public ShakeScreen(id, const Float:iSeconds)
{
    static g_msg_SS = 0;
    if(!g_msg_SS)
        g_msg_SS = get_user_msgid("ScreenShake");
   
    message_begin(MSG_ONE, g_msg_SS, _, id);
    write_short(floatround(4096.0 * iSeconds, floatround_round));
    write_short(floatround(4096.0 * iSeconds, floatround_round));
    write_short(1<<13);
    message_end();
}
 
stock ColorChat(id, String[], any:...)
{
    static szMesage[192];
    vformat(szMesage, charsmax(szMesage), String, 3);
   
    replace_all(szMesage, charsmax(szMesage), "!1", "^1");
    replace_all(szMesage, charsmax(szMesage), "!3", "^3");
    replace_all(szMesage, charsmax(szMesage), "!4", "^4");
   
    static g_msg_SayText = 0;
    if(!g_msg_SayText)
        g_msg_SayText = get_user_msgid("SayText");
   
    new Players[32], iNum = 1, i;
 
    if(id) Players[0] = id;
    else get_players(Players, iNum, "ch");
   
    for(--iNum; iNum >= 0; iNum--)
    {
        i = Players[iNum];
       
        message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
        write_byte(i);
        write_string(szMesage);
        message_end();
    }
}

_________________
Stick with the best & regards Adryyy .


x , daNzeT , Arion , Chaos , Exolent , aNNakin , PoSiTiOn Of PoWeR , ExoTiQ , -UnQ- UHD , ViciousVixen , Arkshine , Askhanar , KronoS eXtream , alkaline , CryWolf , Fuffy , tre3fla , Rap^ , Hades Ownage , xPaw .


10 Jan 2019 20:24
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0

Joined: 26 Nov 2018 19:52
Posts: 69
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Adryyy, tot nu functioneaza....lasa ca poate stie YONTU, dupa ce termina cu sesiunea..

Imi poti rezolva in alt mod bugul cu 800speed?

Eu am un plugin de Level pe server, si creste HP/AP/Speed in functie de level, cum ai pus tu acolo:

Code:
if(knife_model[id] == 5&&get_user_sk(id)>0)
         Speed = 400.0
else   Speed = 250.0


Daca iau unul din cele 3 cutite (Cobra,Hulk,Grizzly) imi da Speed 250 pentru ca asa ai setat mai sus, fara sa mai tina cont de Bonusurile de la Level.


10 Jan 2019 20:37
Profile multumesc WWW
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1673
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Fond eXtream: 0
nu mi dau seama cum compilezi sau ce plugin pui pe server,la mine merge totul normal

shop | Afiseaza codul
Code:
   #include <amxmodx>
   #include <amxmisc>
   #include <engine>
   #include <vault>
   #include <fun>
   #include <fakemeta>

   #pragma tabsize 0

   native get_user_sk(id)
   #define SKIN_V_KNIFE "models/skins/v_knife.mdl"//editezi si in SHOP LA FEL
   #define SKIN_P_KNIFE "models/skins/p_knife.mdl"

   #define PLUGIN "Knife Mod+"
   #define VERSION "1.0"
   #define AUTHOR "spunko,drastiq"

   #define MAXPLAYERS 32
   #define TASK_INTERVAL 4.0
   #define MAX_HEALTH 255


   new knife_model[33]
   new g_Menu

   new CVAR_HIGHSPEED
   new CVAR_LOWSPEED
   new CVAR_LOWGRAV
   new CVAR_NORMGRAV
   new CVAR_HEALTH_ADD
   new CVAR_HEALTH_MAX
   new CVAR_DAMAGE

   public plugin_init() {
     
      register_plugin(PLUGIN, VERSION, AUTHOR)
     
      register_event( "Damage", "event_damage", "be" )
      register_event("CurWeapon","EventCurWeapon","be","1=1")
     
      g_Menu = register_menuid("Knife Mod")
      register_menucmd(g_Menu, 1023, "knifemenu")
      register_clcmd("say /knife", "display_knife")
     
      CVAR_HIGHSPEED = register_cvar("km_highspeed","340")
      CVAR_LOWSPEED = register_cvar("km_lowspeed","170")
      CVAR_HEALTH_ADD = register_cvar("km_addhealth", "3")
      CVAR_HEALTH_MAX = register_cvar("km_maxhealth", "75")
      CVAR_DAMAGE = register_cvar("km_damage", "2")
      CVAR_LOWGRAV = register_cvar("km_lowgravity" , "400")
      CVAR_NORMGRAV = get_cvar_pointer("sv_gravity")
   }

   public plugin_precache() {
      precache_model("models/knife-mod/v_Tactic.mdl")
      precache_model("models/knife-mod/p_Tactic.mdl")
      precache_model("models/knife-mod/v_OneKill.mdl")
      precache_model("models/knife-mod/p_OneKill.mdl")
      precache_model("models/knife-mod/v_Cobra.mdl")
      precache_model("models/knife-mod/p_Cobra.mdl")
      precache_model("models/knife-mod/v_hulk.mdl")
      precache_model("models/knife-mod/v_knifeN.mdl")
      precache_model("models/p_knife.mdl")
      precache_model("models/knife-mod/v_claw.mdl")


      precache_model(SKIN_V_KNIFE)
      precache_model(SKIN_P_KNIFE)
   }

   public display_knife(id) {
      // Codes makes it so only the dead can pick a knife.
      if (is_user_alive(id) == 0){
         client_print(id, print_chat, "Nu poti alege un cutit cat timp esti mort!")
         return PLUGIN_CONTINUE
      }
      else
      client_print(id, print_chat, "Alege un cutit!")
     
      new menuBody[512]
      add(menuBody, 511, "\r   Knife Mod^n^n")
      add(menuBody, 511, "\r1. \wOneKill \y(DMG Marit/Viteza redusa!)^n")
      add(menuBody, 511, "\r2. \wCobra \y(Nu se aud pasii!)^n")
      add(menuBody, 511, "\r3. \wTactic \y(Viteza marita!)^n")
      add(menuBody, 511, "\r4. \wHulk \y(Gravitatie!)^n")
      add(menuBody, 511, "\r5. \wGrizzly (Normal) \y(Regenerare HP!)^n^n")

      if(get_user_sk(id)>0)   add(menuBody, 511, "\r6.\w Special Knife\y(SPEED[SHOP])^n^n^n")
      else   if(get_user_sk(id)<=0)   add(menuBody, 511, "\d6.\w Special Knife\y([SHOP])^n^n^n")

      add(menuBody, 511, "\w0. Exit^n")
     
      new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<9 )
      show_menu(id, keys, menuBody, -1, "Knife Mod")
     
      return PLUGIN_HANDLED
   }
   public knifemenu(id, key) {
      switch(key)
      {
            case 0: SetKnife(id , 4)
            case 1: SetKnife(id , 2)
            case 2: SetKnife(id , 3)
            case 3: SetKnife(id , 1)
            case 4: SetKnife(id , 0)

            case 5:
            {
               if(get_user_sk(id)>0)
               {
                  give_item(id,"weapon_knife")
                  engclient_cmd(id,"weapon_knife")

                  get_user_sk(id)==1
                  SetKnife(id,5)
               }
               else
               {
                  client_cmd(id,"say /shop")
                  get_user_sk(id)==0
               }
            }
            default: return PLUGIN_HANDLED
      }
      SaveData(id)
      return PLUGIN_HANDLED
   }

   public SetKnife(id , Knife) {
      knife_model[id] = Knife
     
      new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
      if ( Weapon != CSW_KNIFE )
         return PLUGIN_HANDLED
     
      new vModel[56],pModel[56]
     
      switch(Knife)
      {
         case 0: {
            format(vModel,55,"models/knife-mod/v_knifeN.mdl")
            format(pModel,55,"models/p_knife.mdl")
         }
         case 1: {
            format(vModel,55,"models/knife-mod/v_hulk.mdl")
         }
         case 2: {
            format(vModel,55,"models/knife-mod/v_Cobra.mdl")
            format(pModel,55,"models/knife-mod/p_Cobra.mdl")
         }
         case 3: {
            format(vModel,55,"models/knife-mod/v_Tactic.mdl")
            format(pModel,55,"models/knife-mod/p_Tactic.mdl")
         }
         case 4: {
            format(vModel,55,"models/knife-mod/v_OneKill.mdl")
            format(pModel,55,"models/knife-mod/p_OneKill.mdl")
         }


         case 5: {
            format(vModel,55,SKIN_V_KNIFE)
            format(pModel,55,SKIN_P_KNIFE)
         }
      }
     
      entity_set_string(id, EV_SZ_viewmodel, vModel)
      entity_set_string(id, EV_SZ_weaponmodel, pModel)
     
      return PLUGIN_HANDLED; 
   }

   public event_damage(id) {
     
      new victim_id = id;
      if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
      new dmg_take = read_data( 2 );
      new dmgtype = read_data( 3 );
      new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
      new Float:damage = dmg_take * multiplier;
      new health = get_user_health( victim_id );
     
      new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );
     
      if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
         return PLUGIN_HANDLED
      }
     
      if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {
         
         if( floatround(damage) >= health ) {
            if( victim_id == attacker_id ) {
               return PLUGIN_CONTINUE
               }else{
               log_kill( attacker_id, victim_id, "knife", 0 );
            }
           
            return PLUGIN_CONTINUE
            }else {
            if( victim_id == attacker_id ) return PLUGIN_CONTINUE
           
            fakedamage( victim_id, "weapon_knife", damage, dmgtype );
         }
         
      }
      return PLUGIN_CONTINUE
   }

   public EventCurWeapon(id)
   {
      new Weapon = read_data(2)
     
      // Set Knife Model
      SetKnife(id, knife_model[id])   
     
      // Task Options
     
      if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
         set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
      else if(task_exists(id))
         remove_task(id)
     
      // Abilities
      set_user_footsteps(id , ( (knife_model[id] == 2 && Weapon == CSW_KNIFE) ? 1 : 0) )
     
      new Float:Gravity = ((knife_model[id] == 1 && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
      set_user_gravity(id , Gravity)
     
     
      // Speed
      new Float:Speed
      if(Weapon == CSW_KNIFE /*&& knife_model[id] >= 3*/)
{
switch(knife_model[id])
{
   case 3:   Speed = get_pcvar_float(CVAR_HIGHSPEED)
   case 4:   Speed = get_pcvar_float(CVAR_LOWSPEED)
   case 5:   if(get_user_sk(id)>0)   Speed = 400.0
}
      set_user_maxspeed(id, Speed)
}

      return PLUGIN_HANDLED
   }


   stock log_kill(killer, victim, weapon[],headshot) {
   user_silentkill( victim );

   message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
   write_byte( killer );
   write_byte( victim );
   write_byte( headshot );
   write_string( weapon );
   message_end();

   new kfrags = get_user_frags( killer );
   set_user_frags( killer, kfrags++ );
   new vfrags = get_user_frags( victim );
   set_user_frags( victim, vfrags++ );

   return  PLUGIN_CONTINUE
   }


   public task_healing(id) { 
   new addhealth = get_pcvar_num(CVAR_HEALTH_ADD) 
   if (!addhealth)
      return 

   new maxhealth = get_pcvar_num(CVAR_HEALTH_MAX) 
   if (maxhealth > MAX_HEALTH) {
      set_pcvar_num(CVAR_HEALTH_MAX, MAX_HEALTH) 
      maxhealth = MAX_HEALTH
   } 

   new health = get_user_health(id)   

   if (is_user_alive(id) && (health < maxhealth)) {
      set_user_health(id, health + addhealth)
      set_hudmessage(0, 255, 0, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.1, 4)
      show_hudmessage(id,"<< !!HP-ul CRESTE!! >>")
      message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
      write_short(1<<10)
      write_short(1<<10)
      write_short(0x0000)
      write_byte(0)
      write_byte(200)
      write_byte(0)
      write_byte(75)
      message_end()
   }

   else {
      if (is_user_alive(id) && (health > maxhealth))
         remove_task(id)
     
   }
   } 

   public client_disconnect(id) { 
   if(task_exists(id)) remove_task(id) 
   } 


   public client_authorized(id)
   {
   LoadData(id)
   }

   SaveData(id)
   {

   new authid[32]
   get_user_authid(id, authid, 31)

   new vaultkey[64]
   new vaultdata[64]

   format(vaultkey, 63, "KMOD_%s", authid)
   format(vaultdata, 63, "%d", knife_model[id])
   set_vaultdata(vaultkey, vaultdata)
   }

   LoadData(id)
   {
   new authid[32]
   get_user_authid(id,authid,31)

   new vaultkey[64], vaultdata[64]

   format(vaultkey, 63, "KMOD_%s", authid)
   get_vaultdata(vaultkey, vaultdata, 63)
   knife_model[id] = str_to_num(vaultdata)

   }

_________________
Stick with the best & regards Adryyy .


x , daNzeT , Arion , Chaos , Exolent , aNNakin , PoSiTiOn Of PoWeR , ExoTiQ , -UnQ- UHD , ViciousVixen , Arkshine , Askhanar , KronoS eXtream , alkaline , CryWolf , Fuffy , tre3fla , Rap^ , Hades Ownage , xPaw .


10 Jan 2019 22:04
Profile multumesc ICQ YIM
Display posts from previous:  Sort by  
Reply to topic   [ 15 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 29 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:  

Î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