It is currently 22 Feb 2019 21:29



Forum rules


Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .



Reply to topic  [ 10 posts ] 
 Cerere Plugin editare knife models [rezolvat] 
Author Message
Membru, skill 0
Membru, skill 0
User avatar

Joined: 14 Sep 2018 22:35
Posts: 74
Location: Timisoara
Detinator Steam: Da
CS Status: Sniper & Rifler
Fond eXtream: 0
Plugin Cerut: Knife models shop
Descriere (adica ce face el mai exact): Poti cumpara skinuri pe cutite cu bani, dar daca cineva cumpara un model, cei care stau spec pe el, sa vada skinul cumparat de el, nu al lor (daca ma intelegeti, ca in cs:go) dar nu doar v_ si p_ sa se vada la fiecare, ce model are
Serverul ruleaza (HLDS/ReHLDS): -
Versiune AMX Mod X: -
Modul Serverului: Basebuilder
poate va ajuta asta
| Afiseaza codul
Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define SKINS 11

new g_knife[33];
   
new const g_knifemodels[SKINS][64] = {
    "models/v_knife.mdl", // The default model, don't touch
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_m4a1.mdl",
    "models/v_ak47.mdl"
}

new const g_knifenames [SKINS][32] = {
    "Default Knife",
    "Dorex Knife",
    "Lightning Knife",
    "Master Knife",
    "Traker Knife",
    "Ultimate Knife",
    "Ice Knife",
    "Bloody Knife",
    "Evolution Knife",
    "Simple Knife",
    "Crool Knife"
}

new g_knifecosts[SKINS][] = {
    "0",
    "5",
    "5",
    "5",
    "5",
    "5",
    "10",
    "10",
    "15",
    "15",
    "15"
}

new g_knifeflag[SKINS][] = {
    "0",
    "0",
    "0",
    "0",
    "0",
    "0",
    "1",
    "1",
    "1",
    "1",
    "1"


static const PORTAL    [ ] = "^4[aNathrax-team.eu]^1"
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const BUY    [ ] = "You bought ^3"

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS"

#define NAZEV_PORTALU "aNathrax-Team.eu"
#define VIP_FLAG ADMIN_LEVEL_H


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    register_clcmd("say /knifeshop", "cmd_knife")
    register_clcmd("say /knife", "cmd_knife")
   
    register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public plugin_precache(){
    for (new i; i <= sizeof g_knifemodels; i++)
        precache_model(g_knifemodels[i]);
}
   
public client_putinserver(client)
    g_knife[client] = 0;

public Event_CurWeapon(client){
   
    if (read_data(2) == CSW_KNIFE)
        set_pev(client,pev_viewmodel2,g_knifemodels[g_knife[client]]);
   
}

public cmd_knife(id){
    new szSome[256];
    if(is_user_alive(id))
    {
        new knife = menu_create("Select your Knife", "cmd_knife_h");
        new cb = menu_makecallback("knife_callback");
       
        for (new i; i <= SKINS - 1; i++)
        {
            formatex(szSome,255,"%s \r[%i$] \y%i",g_knifenames[i],str_to_num(g_knifecosts[i]),(str_to_num(g_knifeflag[i]) ? "[VIP]":"")); 
            menu_additem(knife,szSome,g_knifeflag[i],.callback=cb);
        }   
       
        menu_display(id,knife);
    }
   
    else
        ChatColor(id, "%s %s", PORTAL, DIE);
}

public knife_callback(client,knife,item){
    new access,callback,szInfo[8],szName[32];
    menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
   
    if (str_to_num(szInfo) == 1 && !(get_user_flags(client) & VIP_FLAG))
        return ITEM_DISABLED;
       
    return ITEM_ENABLED;
}
   
public cmd_knife_h(client, knife, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(knife);
        return;
    }
   
    if (cs_get_user_money(client) < str_to_num(g_knifecosts[item]))
    {
        ChatColor(client,"%s %s",PORTAL,MONEY);
        return;
    }
   
    cs_set_user_money(client,(cs_get_user_money(client) - str_to_num(g_knifecosts[item])),1);
    g_knife[client] = item;
    ChatColor(client,"%s %s%s",PORTAL,BUY,g_knifenames[g_knife[client]]);
}
   
stock ChatColor(const id, const input[], any:...) {
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg, 190, input, 3 )
   
    replace_all( msg, 190, "!g", "^4" )
    replace_all( msg, 190, "!y", "^1" )
    replace_all( msg, 190, "!t", "^3" )

   
    if(id) players[ 0 ] = id;
    else get_players( players, count, "ch" )
   
    for(new i = 0; i < count; i++)
    {
        if( is_user_connected( players[ i ] ) )
        {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] ) 
            write_byte( players[ i ] )
            write_string( msg )
            message_end( )
        }
    }
}


l-am gasit pe net dar nu face ce vreau eu, am editat eu modele doar ca sa vad daca merge, dar vreau ca aceasta sa mearga si pe v_ si pe p_ iar daca ai 1 skin, ceilanti sa vada skinul tau, nu al lor.
multumesc!!

_________________
maybe there are no goodbyes..


Last edited by Radu eXtream on 06 Feb 2019 17:08, edited 2 times in total.

Marcat ca rezolvat.



04 Feb 2019 17:58
Profile multumesc
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

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

#pragma tabsize 0

#define SKINS 11

new g_knife[33];
   
new const g_knifemodels_v[SKINS][64] = {
    "models/v_knife.mdl", // The default model, don't touch
   
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl"
}
new const g_knifemodels_p[SKINS][64] = {
    "models/p_knife.mdl", // The default model, don't touch
   
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl"
}

new const g_knifenames [SKINS][32] = {
    "Default Knife",
    "Dorex Knife",
    "Lightning Knife",
    "Master Knife",
    "Traker Knife",
    "Ultimate Knife",
    "Ice Knife",
    "Bloody Knife",
    "Evolution Knife",
    "Simple Knife",
    "Crool Knife"
}

new g_knifecosts[SKINS][] = {
    "0",
    "5",
    "5",
    "5",
    "5",
    "5",
    "10",
    "10",
    "15",
    "15",
    "15"
}

new g_knifeflag[SKINS][] = {
    "0",
    "0",
    "0",
    "0",
    "0",
    "0",
    "1",
    "1",
    "1",
    "1",
    "1"


static const PORTAL    [ ] = "^4[aNathrax-team.eu]^1"
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const BUY    [ ] = "You bought ^3"

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS"

#define NAZEV_PORTALU "aNathrax-Team.eu"
#define VIP_FLAG ADMIN_LEVEL_H

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    register_clcmd("say /knifeshop", "cmd_knife")
    register_clcmd("say /knife", "cmd_knife")
   
    register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public plugin_precache(){
    for (new i; i < sizeof g_knifemodels_v; i++)   precache_model(g_knifemodels_v[i]);
    for (new i; i < sizeof g_knifemodels_p; i++)   precache_model(g_knifemodels_p[i]);
}
   
public client_putinserver(client)   g_knife[client] = 0;

public Event_CurWeapon(client){
    if (read_data(2) == CSW_KNIFE&&is_user_alive(client))
   {
        set_pev(client,pev_viewmodel2,g_knifemodels_v[g_knife[client]]);
        set_pev(client,pev_weaponmodel2,g_knifemodels_p[g_knife[client]]);
   }
}

public cmd_knife(id){
    new szSome[256];
    if(is_user_alive(id))
    {
        new knife = menu_create("Select your Knife", "cmd_knife_h");
        new cb = menu_makecallback("knife_callback");
       
        for (new i; i <= SKINS - 1; i++)
        {
            formatex(szSome,255,"%s \r[%i$] \y%i",g_knifenames[i],str_to_num(g_knifecosts[i]),(str_to_num(g_knifeflag[i]) ? "[VIP]":"")); 
            menu_additem(knife,szSome,g_knifeflag[i],.callback=cb);
        }
       
        menu_display(id,knife);
    }
    else   ChatColor(id, "%s %s", PORTAL, DIE);
}

public knife_callback(client,knife,item){
    new access,callback,szInfo[8],szName[32];
    menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
   
    if (str_to_num(szInfo) == 1 && !(get_user_flags(client) & VIP_FLAG))   return ITEM_DISABLED;
       
    return ITEM_ENABLED;
}
   
public cmd_knife_h(client, knife, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(knife);
        return;
    }
   
    if (cs_get_user_money(client) < str_to_num(g_knifecosts[item]))
    {
        ChatColor(client,"%s %s",PORTAL,MONEY);
        return;
    }
   
    cs_set_user_money(client,(cs_get_user_money(client) - str_to_num(g_knifecosts[item])),1);
    g_knife[client] = item;
   Event_CurWeapon(client)
   engclient_cmd(client,"weapon_knife")
    ChatColor(client,"%s %s%s",PORTAL,BUY,g_knifenames[g_knife[client]]);
}
   
stock ChatColor(const id, const input[], any:...) {
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg, 190, input, 3 )
   
    replace_all( msg, 190, "!g", "^4" )
    replace_all( msg, 190, "!y", "^1" )
    replace_all( msg, 190, "!t", "^3" )

    if(id) players[ 0 ] = id;
    else get_players( players, count, "ch" )
   
    for(new i = 0; i < count; i++)
    {
        if( is_user_connected( players[ i ] ) )
        {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] ) 
            write_byte( players[ i ] )
            write_string( msg )
            message_end( )
        }
    }
}


Last edited by Laurentiu P. on 06 Feb 2019 08:47, edited 1 time in total.

Post editat.



04 Feb 2019 20:06
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0
User avatar

Joined: 14 Sep 2018 22:35
Posts: 74
Location: Timisoara
Detinator Steam: Da
CS Status: Sniper & Rifler
Fond eXtream: 0
merge,dar poti face ca in asa fel incat daca ai cumparat odata un skin, nu mai ai voie sa-l mai cumperi odata, si sa se salveze pe steam id toate skinurile?
gen /inventory si acolo sa iti apara toate skinurile cumparate!
si daca poti sa-l faci sa mearga doar pentru CT, sa nu aiba nimic cu T
multumesc!

_________________
maybe there are no goodbyes..


04 Feb 2019 23:18
Profile multumesc
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1952
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Fond eXtream: 0
era greu să specifici asta de la început?
| Afiseaza codul
Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fvault>

new const g_vault_name[] = "Knives-Skins";

#pragma tabsize 0

#define SKINS 11

new g_knife[33];
   
new const g_knifemodels_v[SKINS][64] = {
    "models/v_knife.mdl", // The default model, don't touch
   
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl"
}
new const g_knifemodels_p[SKINS][64] = {
    "models/p_knife.mdl", // The default model, don't touch
   
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl"
}

new const g_knifenames [SKINS][32] = {
    "Default Knife",
    "Dorex Knife",
    "Lightning Knife",
    "Master Knife",
    "Traker Knife",
    "Ultimate Knife",
    "Ice Knife",
    "Bloody Knife",
    "Evolution Knife",
    "Simple Knife",
    "Crool Knife"
}

new g_knifecosts[SKINS][] = {
    "0",
    "5",
    "5",
    "5",
    "5",
    "5",
    "10",
    "10",
    "15",
    "15",
    "15"
}

new g_knifeflag[SKINS][] = {
    "0",
    "0",
    "0",
    "0",
    "0",
    "0",
    "1",
    "1",
    "1",
    "1",
    "1"


static const PORTAL    [ ] = "^4[aNathrax-team.eu]^1 "
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const BUY    [ ] = "You bought^3 "

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS"

#define VIP_FLAG ADMIN_LEVEL_H

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    register_clcmd("say /knifeshop", "cmd_knife")
    register_clcmd("say /knife", "cmd_knife")
   
    register_clcmd("say /inventory", "INFO")
    register_clcmd("say_team /invnetory", "INFO")
   
    register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public plugin_precache(){
    for (new i; i < sizeof g_knifemodels_v; i++)   precache_model(g_knifemodels_v[i]);
    for (new i; i < sizeof g_knifemodels_p; i++)   precache_model(g_knifemodels_p[i]);
}

public client_authorized(plr)   if( !is_user_hltv(plr) && !is_user_bot(plr) )   LoadExp(plr);
public client_disconnect(plr)
{
    if( g_knife[plr] > 0 )
    {
        SaveExp(plr);
       
        g_knife[plr] = 0;
    }
}
LoadExp(plr)
{
    new authid[35];
    get_user_authid(plr, authid, sizeof(authid) - 1);
   
    new data[16];
    if( fvault_get_data(g_vault_name, authid, data, sizeof(data) - 1) )
    {
        g_knife[plr] = str_to_num(data);
    }
    else   g_knife[plr] = 0;
}
SaveExp(plr)
{
    new authid[35];
    get_user_authid(plr, authid, sizeof(authid) - 1);
   
    new data[16];
    num_to_str(g_knife[plr], data, sizeof(data) - 1);
   
    fvault_set_data(g_vault_name, authid, data);
}

public Event_CurWeapon(client){
    if (read_data(2) == CSW_KNIFE&&is_user_alive(client))
   {
        set_pev(client,pev_viewmodel2,g_knifemodels_v[g_knife[client]]);
        set_pev(client,pev_weaponmodel2,g_knifemodels_p[g_knife[client]]);
   }
}

public INFO(id)   ChatColor(id,"%sYour knife skin is: %s",PORTAL,g_knifenames[g_knife[id]]);

public cmd_knife(id){
    new szSome[256];
    if(is_user_alive(id))
    {
        new knife = menu_create("Select your Knife", "cmd_knife_h");
        new cb = menu_makecallback("knife_callback");
       
        for (new i; i <= SKINS - 1; i++)
        {
            formatex(szSome,255,"%s\r [%i$]%i",g_knifenames[i],str_to_num(g_knifecosts[i]),(str_to_num(g_knifeflag[i]) ? "\y [VIP]":"")); 
            menu_additem(knife,szSome,g_knifeflag[i],.callback=cb);
        }
       
        menu_display(id,knife);
    }
    else   ChatColor(id, "%s%s", PORTAL, DIE);
}
public knife_callback(client,knife,item){
    new access,callback,szInfo[8],szName[32];
    menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
   
    if (str_to_num(szInfo) == 1 && !(get_user_flags(client) & VIP_FLAG))   return ITEM_DISABLED;
    if (cs_get_user_team(client)!=CS_TEAM_CT)   return ITEM_DISABLED;
    if (g_knife[client]>0)   return ITEM_DISABLED;
       
    return ITEM_ENABLED;
}
public cmd_knife_h(client, knife, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(knife);
        return;
    }
   
    if (cs_get_user_money(client) < str_to_num(g_knifecosts[item]))
    {
        ChatColor(client,"%s%s",PORTAL,MONEY);
        return;
    }
   
    cs_set_user_money(client,(cs_get_user_money(client) - str_to_num(g_knifecosts[item])),1);
    g_knife[client] = item;
   Event_CurWeapon(client)
   engclient_cmd(client,"weapon_knife")
    ChatColor(client,"%s%s%s",PORTAL,BUY,g_knifenames[g_knife[client]]);
}
   
stock ChatColor(const id, const input[], any:...) {
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg, 190, input, 3 )
   
    replace_all( msg, 190, "!g", "^4" )
    replace_all( msg, 190, "!y", "^1" )
    replace_all( msg, 190, "!t", "^3" )

    if(id) players[ 0 ] = id;
    else get_players( players, count, "c" )
   
    for(new i = 0; i < count; i++)
    {
        if( is_user_connected( players[ i ] ) )
        {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] ) 
            write_byte( players[ i ] )
            write_string( msg )
            message_end( )
        }
    }
}


Last edited by Laurentiu P. on 06 Feb 2019 08:46, edited 1 time in total.

Post editat.



05 Feb 2019 16:00
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0
User avatar

Joined: 14 Sep 2018 22:35
Posts: 74
Location: Timisoara
Detinator Steam: Da
CS Status: Sniper & Rifler
Fond eXtream: 0
merge super man, mersi mult, dar eu ma referam daca ai cumparat un X skin, sa nu te mai lase sa cumperi respectivul skin, dar altele poti, si daca cumperi mai multe sa ti le apara pe toate in /inventory, si sa alegi pe care vrei sa-l folosesti.

_________________
maybe there are no goodbyes..


05 Feb 2019 21:10
Profile multumesc
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1952
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Fond eXtream: 0
el poate cumpăra doar 1 knife
| Afiseaza codul
Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fvault>

new const g_vault_name[] = "Knives-Skins";

#pragma tabsize 0

#define SKINS 11

new g_knife[33];
   
new const g_knifemodels_v[SKINS][64] = {
    "models/v_knife.mdl", // The default model, don't touch
   
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl"
}
new const g_knifemodels_p[SKINS][64] = {
    "models/p_knife.mdl", // The default model, don't touch
   
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl"
}

new const g_knifenames [SKINS][32] = {
    "Default Knife",
    "Dorex Knife",
    "Lightning Knife",
    "Master Knife",
    "Traker Knife",
    "Ultimate Knife",
    "Ice Knife",
    "Bloody Knife",
    "Evolution Knife",
    "Simple Knife",
    "Crool Knife"
}

new g_knifecosts[SKINS][] = {
    "0",
    "5",
    "5",
    "5",
    "5",
    "5",
    "10",
    "10",
    "15",
    "15",
    "15"
}

new g_knifeflag[SKINS][] = {
    "0",
    "0",
    "0",
    "0",
    "0",
    "0",
    "1",
    "1",
    "1",
    "1",
    "1"


static const PORTAL    [ ] = "^4[aNathrax-team.eu]^1 "
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const BUY    [ ] = "You bought^3 "

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS"

#define VIP_FLAG ADMIN_LEVEL_H

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    register_clcmd("say /knifeshop", "cmd_knife")
    register_clcmd("say /knife", "cmd_knife")
   
    register_clcmd("say /inventory", "INFO")
    register_clcmd("say_team /invnetory", "INFO")
   
    register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public plugin_precache(){
    for (new i; i < sizeof g_knifemodels_v; i++)   precache_model(g_knifemodels_v[i]);
    for (new i; i < sizeof g_knifemodels_p; i++)   precache_model(g_knifemodels_p[i]);
}

public client_authorized(plr)   if( !is_user_hltv(plr) && !is_user_bot(plr) )   LoadExp(plr);
public client_disconnect(plr)
{
    if( g_knife[plr] > 0 )
    {
        SaveExp(plr);
       
        g_knife[plr] = 0;
    }
}
LoadExp(plr)
{
    new authid[35];
    get_user_authid(plr, authid, sizeof(authid) - 1);
   
    new data[16];
    if( fvault_get_data(g_vault_name, authid, data, sizeof(data) - 1) )   g_knife[plr] = str_to_num(data);
    else   g_knife[plr] = 0;
}
SaveExp(plr)
{
    new authid[35];
    get_user_authid(plr, authid, sizeof(authid) - 1);
   
    new data[16];
    num_to_str(g_knife[plr], data, sizeof(data) - 1);
   
    fvault_set_data(g_vault_name, authid, data);
}

public Event_CurWeapon(client){
    if (is_user_alive(client)&&g_knife[client]&&read_data(2)==CSW_KNIFE)
   {
        set_pev(client,pev_viewmodel2,g_knifemodels_v[g_knife[client]]);
        set_pev(client,pev_weaponmodel2,g_knifemodels_p[g_knife[client]]);
   }
}

public INFO(id)   ChatColor(id,"%sYou have:!t %s",PORTAL,g_knifenames[g_knife[id]]);

public cmd_knife(id){
    new szSome[256];
    if(is_user_alive(id))
    {
        new knife = menu_create("Select\r your Knife\y", "cmd_knife_h");
        new cb = menu_makecallback("knife_callback");
       
        for (new i; i <= SKINS - 1; i++)
        {
            formatex(szSome,255,"%s\r [%i$]%s",g_knifenames[i],str_to_num(g_knifecosts[i]),(str_to_num(g_knifeflag[i])==1 ? "\y [VIP]":"")); 
            menu_additem(knife,szSome,g_knifeflag[i],.callback=cb);
        }
       
        menu_display(id,knife);
    }
    else   ChatColor(id, "%s%s", PORTAL, DIE);
}
public knife_callback(client,knife,item){
    new access,callback,szInfo[8],szName[32];
    menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
   
    if (str_to_num(szInfo) == 1 && !(get_user_flags(client) & VIP_FLAG))   return ITEM_DISABLED;
    if (cs_get_user_team(client)!=CS_TEAM_CT)   return ITEM_DISABLED;
    if (g_knife[client]==item)   return ITEM_DISABLED;
       
    return ITEM_ENABLED;
}
public cmd_knife_h(client, knife, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(knife);
        return;
    }
   
    if (cs_get_user_money(client) < str_to_num(g_knifecosts[item]))
    {
        ChatColor(client,"%s%s",PORTAL,MONEY);
        return;
    }
   
    cs_set_user_money(client,(cs_get_user_money(client) - str_to_num(g_knifecosts[item])),1);
    g_knife[client] = item;
   Event_CurWeapon(client)
   engclient_cmd(client,"weapon_knife")
    ChatColor(client,"%s%s%s",PORTAL,BUY,g_knifenames[g_knife[client]]);
}
   
stock ChatColor(const id, const input[], any:...) {
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg, 190, input, 3 )
   
    replace_all( msg, 190, "!g", "^4" )
    replace_all( msg, 190, "!y", "^1" )
    replace_all( msg, 190, "!t", "^3" )

    if(id) players[ 0 ] = id;
    else get_players( players, count, "c" )
   
    for(new i = 0; i < count; i++)
    {
        if( is_user_connected( players[ i ] ) )
        {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] ) 
            write_byte( players[ i ] )
            write_string( msg )
            message_end( )
        }
    }
}


Last edited by Laurentiu P. on 06 Feb 2019 08:46, edited 1 time in total.

Post editat.



05 Feb 2019 22:44
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0
User avatar

Joined: 14 Sep 2018 22:35
Posts: 74
Location: Timisoara
Detinator Steam: Da
CS Status: Sniper & Rifler
Fond eXtream: 0
inainte puteai sa le cumperi de cate ori voiai, chiar una dupa alta
daca cumpar cutitul X, nu ma lasa sa-l cumpar din nou, dar daca cumpar X, dupaceea Y, pot cumpara X din nou, crezi ca poti rezolva sa poti cumpara doar o data cutitul, si sa se salveze in /inventory?
deci cumpar cutitul X, se salveaza in /inventory, duapaia daca cumpar Y, sa le am pe amndoua in inventory si X si Y, si daca le am in inventory le pot folosii oricand fara sa le mai cumpar,
apropo: eu am dat pluginul asta ca exemplu, daca e greu de facut asta, si stii tu altul mai bun, as fi fericit sa-l vad
multumesc mult! sper sa poti rezolva

_________________
maybe there are no goodbyes..


05 Feb 2019 23:10
Profile multumesc
Super moderator
Super moderator
User avatar

Joined: 10 Jul 2013 20:26
Posts: 2387
Location: Constanta
Detinator Steam: Da
Detinator server CS: Da
Reputatie: Super moderator
Nume anterior: Do[N]e ;3
Fond eXtream: 0
Daca mai postati sursa pluginului adaugati-o in spoiler.

Code:
[sursa]TEXT[/sursa]


06 Feb 2019 08:47
Profile multumesc
Scripter eXtreamCS
Scripter eXtreamCS
User avatar

Joined: 24 Aug 2011 11:24
Posts: 1952
Location: |<()|)
Detinator Steam: Da
CS Status: HLDS Builder
Detinator server CS: liber de contract
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Fond eXtream: 0
| Afiseaza codul
Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fvault>

new const g_vault_name[] = "Knives-Skins";

#pragma tabsize 0

#define SKINS 11

new g_knife[33];
   
new const g_knifemodels_v[SKINS][64] = {
    "models/v_knife.mdl", // The default model, don't touch
   
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl",
    "models/v_knife.mdl"
}
new const g_knifemodels_p[SKINS][64] = {
    "models/p_knife.mdl", // The default model, don't touch
   
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl",
    "models/p_knife.mdl"
}

new const g_knifenames [SKINS][32] = {
    "Default Knife",
    "Dorex Knife",
    "Lightning Knife",
    "Master Knife",
    "Traker Knife",
    "Ultimate Knife",
    "Ice Knife",
    "Bloody Knife",
    "Evolution Knife",
    "Simple Knife",
    "Crool Knife"
}

new g_knifecosts[SKINS][] = {
    "0",
    "5",
    "5",
    "5",
    "5",
    "5",
    "10",
    "10",
    "15",
    "15",
    "15"
}

new g_knifeflag[SKINS][] = {
    "0",
    "0",
    "0",
    "0",
    "0",
    "0",
    "1",
    "1",
    "1",
    "1",
    "1"


static const PORTAL    [ ] = "^4[aNathrax-team.eu]^1 "
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const BUY    [ ] = "You bought^3 "

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS"

#define VIP_FLAG ADMIN_LEVEL_H

new count[33]
new k0[33],k1[33],k2[33],k3[33],k4[33],k5[33],k6[33],k7[33],k8[33],k9[33],k10[33]
new hk0[33],hk1[33],hk2[33],hk3[33],hk4[33],hk5[33],hk6[33],hk7[33],hk8[33],hk9[33],hk10[33]

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    register_clcmd("say /knifeshop", "cmd_knife")
    register_clcmd("say /knife", "cmd_knife")
   
    register_clcmd("say /inventory", "INFO")
    register_clcmd("say_team /invnetory", "INFO")
   
    register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public plugin_precache(){
    for (new i; i < sizeof g_knifemodels_v; i++)   precache_model(g_knifemodels_v[i]);
    for (new i; i < sizeof g_knifemodels_p; i++)   precache_model(g_knifemodels_p[i]);
}

public client_authorized(plr)   if( !is_user_hltv(plr) && !is_user_bot(plr) )   LoadExp(plr);
public client_disconnect(plr)
{
    if( g_knife[plr] > 0 )
    {
        SaveExp(plr);
       
        g_knife[plr] = 0;
    }
}
LoadExp(plr)
{
    new authid[35];
    get_user_authid(plr, authid, sizeof(authid) - 1);
   
    new data[125],szCount[8],szK[8],
    szK0[8],szK1[8],szK2[8],szK3[8],szK4[8],szK5[8],szK6[8],szK7[8],szK8[8],szK9[8],szK10[8],
    szhK0[8],szhK1[8],szhK2[8],szhK3[8],szhK4[8],szhK5[8],szhK6[8],szhK7[8],szhK8[8],szhK9[8],szhK10[8]
       if( fvault_get_data(g_vault_name, authid, data, sizeof( data ) - 1 ) )
   {
      parse( data, szK, sizeof( szK ) - 1, szCount, sizeof( szCount ) - 1,
      szK0, sizeof( szK0 ) - 1,szK1, sizeof( szK1 ) - 1,szK2, sizeof( szK2 ) - 1,szK3, sizeof( szK3 ) - 1,
      szK4, sizeof( szK4 ) - 1,szK5, sizeof( szK5 ) - 1,szK6, sizeof( szK6 ) - 1,szK7, sizeof( szK7 ) - 1,
      szK8, sizeof( szK8 ) - 1,szK9, sizeof( szK9 ) - 1,szK10, sizeof( szK10 ) - 1,
      
      szhK0, sizeof( szhK0 ) - 1,szhK1, sizeof( szhK1 ) - 1,szhK2, sizeof( szhK2 ) - 1,szhK3, sizeof( szhK3 ) - 1,
      szhK4, sizeof( szhK4 ) - 1,szhK5, sizeof( szhK5 ) - 1,szhK6, sizeof( szhK6 ) - 1,szhK7, sizeof( szhK7 ) - 1,
      szhK8, sizeof( szhK8 ) - 1,szhK9, sizeof( szhK9 ) - 1,szhK10, sizeof( szhK10 ) - 1);
      
      g_knife[plr] = str_to_num( szK );
      count[plr] = str_to_num( szCount );
      
      k0[plr]= str_to_num( szK0 );
      k1[plr]= str_to_num( szK1 );
      k2[plr]= str_to_num( szK2 );
      k3[plr]= str_to_num( szK3 );
      k4[plr]= str_to_num( szK4 );
      k5[plr]= str_to_num( szK5 );
      k6[plr]= str_to_num( szK6 );
      k7[plr]= str_to_num( szK7 );
      k8[plr]= str_to_num( szK8 );
      k9[plr]= str_to_num( szK9 );
      k10[plr]= str_to_num( szK10 );
      
      hk0[plr]= str_to_num(szhK0);
      hk1[plr]= str_to_num( szhK1 );
      hk2[plr]= str_to_num( szhK2 );
      hk3[plr]= str_to_num( szhK3 );
      hk4[plr]= str_to_num( szhK4 );
      hk5[plr]= str_to_num( szhK5 );
      hk6[plr]= str_to_num( szhK6 );
      hk7[plr]= str_to_num( szhK7 );
      hk8[plr]= str_to_num( szhK8 );
      hk9[plr]= str_to_num( szhK9 );
      hk10[plr]= str_to_num( szhK10 );
   }
   else
   {
      g_knife[plr] = 0;
      count[plr] = 0;
      
      k0[plr]= 0;
      k1[plr]= 0;
      k2[plr]= 0;
      k3[plr]= 0;
      k4[plr]= 0;
      k5[plr]= 0;
      k6[plr]= 0;
      k7[plr]= 0;
      k8[plr]= 0;
      k9[plr]= 0;
      k10[plr]= 0;
      
      hk0[plr]= 0;
      hk1[plr]= 0;
      hk2[plr]= 0;
      hk3[plr]= 0;
      hk4[plr]= 0;
      hk5[plr]= 0;
      hk6[plr]= 0;
      hk7[plr]= 0;
      hk8[plr]= 0;
      hk9[plr]= 0;
      hk10[plr]= 0;
   }
}
SaveExp(plr)
{
    new authid[35];
    get_user_authid(plr, authid, sizeof(authid) - 1);
   
    new data[125];
    formatex( data, sizeof( data ) - 1, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", g_knife[plr], count[plr],
    k0[plr],k1[plr],k2[plr],k3[plr],k4[plr],k5[plr],k6[plr],k7[plr],k8[plr],k9[plr],k10[plr],
    hk0[plr],hk1[plr],hk2[plr],hk3[plr],hk4[plr],hk5[plr],hk6[plr],hk7[plr],hk8[plr],hk9[plr],hk10[plr]);
   
    fvault_set_data(g_vault_name, authid, data);
}

public Event_CurWeapon(client){
   if (is_user_alive(client)&&g_knife[client]&&read_data(2)==CSW_KNIFE)
   {
        set_pev(client,pev_viewmodel2,g_knifemodels_v[g_knife[client]]);
        set_pev(client,pev_weaponmodel2,g_knifemodels_p[g_knife[client]]);
   }
}

public INFO(id)   ChatColor(id,"%sYou have:!t %s",PORTAL,g_knifenames[g_knife[id]]);

public cmd_knife(id){
    new szSome[256];
    if(is_user_alive(id))
    {
        new knife = menu_create("Select\r your Knife\y", "cmd_knife_h");
        new cb = menu_makecallback("knife_callback");
   new form[125],form2[125]
       
        for (new i; i <= SKINS - 1; i++)
        {
   if(str_to_num(g_knifecosts[i])>0)   formatex(form,124,"%i$",str_to_num(g_knifecosts[i]))
   else   formatex(form,124,"MOKA")
   
   if(k0[id]==i||k1[id]==i||k2[id]==i||k3[id]==i||k4[id]==i||k5[id]==i||k6[id]==i
   ||k7[id]==i||k8[id]==i||k9[id]==i||k10[id]==i)   formatex(form2,124,"\w ~\yOWNED\w~")
   else   formatex(form2,124,"\r ~\wBUY\r~")
   
   if(g_knife[id]!=i)   format(szSome,255,"%s\r [%s]%s%s",g_knifenames[i],form,(str_to_num(g_knifeflag[i])==1 ? "\y [VIP]":""),form2);
   else //if(g_knife[id]==i)
   {
      format(szSome,255,"%s%s\w ~\rSELECTED\w~",g_knifenames[i],(str_to_num(g_knifeflag[i])==1 ? "\y [VIP]":""));
   }
   //else format(szSome,255,"%s%s\w ~\rOWNED\w~",g_knifenames[i],(str_to_num(g_knifeflag[i])==1 ? "\y [VIP]":""));
   
   menu_additem(knife,szSome,g_knifeflag[i],.callback=cb);
        }
        menu_display(id,knife);
    }
    else   ChatColor(id, "%s%s", PORTAL, DIE);
}
public knife_callback(client,knife,item){
    new access,callback,szInfo[8],szName[32];
    menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
   
    if (str_to_num(szInfo) == 1 && !(get_user_flags(client) & VIP_FLAG))   return ITEM_DISABLED;
   
    if (cs_get_user_team(client)!=CS_TEAM_CT)   return ITEM_DISABLED;
   
    if (g_knife[client]==item)   return ITEM_DISABLED;
       
    return ITEM_ENABLED;
}
public cmd_knife_h(client, knife, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(knife);
        return;
    }
   
    if (cs_get_user_money(client) < str_to_num(g_knifecosts[item]))
    {
        ChatColor(client,"%s%s",PORTAL,MONEY);
        return;
    }
   
    if((item==0&&hk0[client]==1)||(item==1&&hk1[client]==1)||(item==2&&hk2[client]==1)||(item==3&&hk3[client]==1)
    ||(item==4&&hk4[client]==1)||(item==5&&hk5[client]==1)||(item==6&&hk6[client]==1)||(item==7&&hk7[client]==1)
    ||(item==8&&hk8[client]==1)||(item==9&&hk9[client]==1)||(item==10&&hk10[client]==1))
    {
   ChatColor(client,"%s%s%s",PORTAL,"You already have: ",g_knifenames[item]);
       g_knife[client] = item;
   
   Event_CurWeapon(client)
   
   engclient_cmd(client,"weapon_knife")
   return
    }
   
    cs_set_user_money(client,(cs_get_user_money(client) - str_to_num(g_knifecosts[item])),1);
   
    if(item)   if(count[client]<11)   count[client]++
   
    if(item==0)   k0[client]=0,hk0[client]=1
    if(item==1)   k1[client]=1,hk1[client]=1
    if(item==2)   k2[client]=2,hk2[client]=1
    if(item==3)   k3[client]=3,hk3[client]=1
    if(item==4)   k4[client]=4,hk4[client]=1
    if(item==5)   k5[client]=5,hk5[client]=1
    if(item==6)   k6[client]=6,hk6[client]=1
    if(item==7)   k7[client]=7,hk7[client]=1
    if(item==8)   k8[client]=8,hk8[client]=1
    if(item==9)   k9[client]=9,hk9[client]=1
    if(item==10)   k10[client]=10,hk10[client]=1
   
    g_knife[client] = item;
   
   Event_CurWeapon(client)
   
   engclient_cmd(client,"weapon_knife")
   
   ChatColor(client,"%s%s%s",PORTAL,BUY,g_knifenames[g_knife[client]]);
}
   
stock ChatColor(const id, const input[], any:...) {
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg, 190, input, 3 )
   
    replace_all( msg, 190, "!g", "^4" )
    replace_all( msg, 190, "!y", "^1" )
    replace_all( msg, 190, "!t", "^3" )

    if(id) players[ 0 ] = id;
    else get_players( players, count, "c" )
   
    for(new i = 0; i < count; i++)
    {
        if( is_user_connected( players[ i ] ) )
        {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] ) 
            write_byte( players[ i ] )
            write_string( msg )
            message_end( )
        }
    }
}


06 Feb 2019 14:46
Profile multumesc ICQ YIM
Membru, skill 0
Membru, skill 0
User avatar

Joined: 14 Sep 2018 22:35
Posts: 74
Location: Timisoara
Detinator Steam: Da
CS Status: Sniper & Rifler
Fond eXtream: 0
mersi mult!!

_________________
maybe there are no goodbyes..


06 Feb 2019 17:06
Profile multumesc
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: Baidu [Spider], Boss de Boss, cs_all, iriminescu0132 and 67 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