Raised This Month: $51 Target: $400
 12% 

OciXCrom's Custom Shop + API


Post New Thread Reply   
 
Thread Tools Display Modes
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-07-2017 , 12:52   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #111

Here:

PHP Code:
#include <amxmodx>
#include <customshop>
#include <zombie_plague_special>

#define POINTS_ON_INFECT 10

public plugin_init()
    
register_plugin("CSHOP: Infection Points""3.X""OciXCrom @ alliedmods.net")
    
public 
zp_user_infected_post(idiInfectoriClass)
    
cshop_give_points(iInfectorPOINTS_ON_INFECT
Change the amount of points you get from #define POINTS_ON_INFECT.

You can use any ZP extra item plugin or any other and add it in the shop. It requires a little bit editing. Here's a little tutorial on how to edit a /buy_weapon plugin. If you're having problems or you don't understand, post one of your plugins and I'll edit it for you.

Quote:
Edit: Can you limit extraitems per map, not for round?
Currently no, but I may add this in a future version, since you're not the first one to ask.
__________________

Last edited by OciXCrom; 03-07-2017 at 12:53.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
artefuckt
Junior Member
Join Date: Mar 2017
Old 03-08-2017 , 03:15   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #112

I've tried to add some weapons in the shop, no result...
Attached Files
File Type: zip plugins.zip (30.9 KB, 98 views)
artefuckt is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-08-2017 , 14:01   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #113

Here's an example with force_shield_grenade.sma:

1. Add #include <customshop>.

2. Replace zp_register_extra_item with cshop_register_item.

3. Look at the cshop_register_item parameters:

PHP Code:
CAMPO_ROUND_NAME item_cost ZP_TEAM_HUMAN )
CAMPO_TIME_NAME item_cost ZP_TEAM_HUMAN 
For zp_register_extra_item they are: name, cost, team.
For cshop_register_item they are: id, name, cost, (limit), (sound), (duration), (points), (team), (flag).
The ones in (brackets) are optional. You need the change the first ones to match the second ones. You already have the name and cost, but you're missing the id in front and the team should use parameter skipping (.team = ZP_TEAM_HUMAN).

PHP Code:
"camporound"CAMPO_ROUND_NAME item_cost , .team ZP_TEAM_HUMAN )
"campotime"CAMPO_TIME_NAME item_cost , .team ZP_TEAM_HUMAN 
4. Replace zp_extra_item_selected with cshop_item_selected.

PHP Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>
#include <hamsandwich>
#include <fun>
#include <fakemeta_util>
#include <customshop>

#define PLUGIN "[ZP] Extra Item: Force Field Grenade"
#define VERSION "v2.3"
#define AUTHOR "lucas_7_94" // Thanks To Users in credits too!.

#define CAMPO_ROUND_NAME "Force Field Grenade(one round)"
#define CAMPO_TIME_NAME "Force Field Grenade(one minute)"
#define ValidTouch(%1) ( is_user_alive(%1) && ( zp_get_user_zombie(%1) || zp_get_user_nemesis(%1) ) )

/*=============================[Plugin Customization]=============================*/
#define CAMPO_TASK
//#define CAMPO_ROUND

//#define RANDOM_COLOR
#define ONE_COLOR

new const NADE_TYPE_CAMPO 6545

#if defined ONE_COLOR
new Float:CampoColors] = { 255.0 0.0 ,   0.0  }
#endif

new TrailColor] = { 000255255 }
new 
Float:Maxs] = { 100.0 100.0 100.0 }
new 
Float:Mins] = { -100.0, -100.0, -100.0 }

new const 
model_grenade[] = "models/zombie_plague/v_auragren.mdl"
new const model[] = "models/zombie_plague/aura8.mdl"
new const w_model[] = "models/zombie_plague/w_aura.mdl"
new const sprite_grenade_trail[] = "sprites/laserbeam.spr"
new const entclas[] = "campo_grenade_forze"

new cvar_flaregrenadesg_trailSprg_SayTextg_itemID

new gBomb
const Float:Push 2.5

const item_cost 15
/*=============================[End Customization]=============================*/

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade")
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
    
cvar_flaregrenades get_cvar_pointer("zp_flare_grenades")
    
    
register_forward(FM_SetModel"fw_SetModel")
    
    
RegisterHam(Ham_Item_Deploy"weapon_smokegrenade""shield_deploy"1)
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
register_forward(FM_Touch"fw_touch")
    
    
g_SayText get_user_msgid("SayText")
    
    
register_cvar("zp_shield_creator""lucas_7_94"FCVAR_SERVER|FCVAR_PROTECTED)
    
    
#if defined CAMPO_ROUND
    
g_itemID cshop_register_item "camporound"CAMPO_ROUND_NAME item_cost , .team ZP_TEAM_HUMAN )
    
#else 
    
g_itemID cshop_register_item "campotime"CAMPO_TIME_NAME item_cost , .team ZP_TEAM_HUMAN )
    
#endif        
}

public 
event_round_start() {
    
    
#if defined CAMPO_ROUND
    
remove_entity_name(entclas)
    
#endif
    
    
gBomb 0
}

public 
plugin_precache() {
    
    
g_trailSpr engfunc(EngFunc_PrecacheModelsprite_grenade_trail)
    
engfunc(EngFunc_PrecacheModelmodel_grenade)
    
engfunc(EngFunc_PrecacheModelmodel)
    
engfunc(EngFunc_PrecacheModelw_model)
}

public 
cshop_item_selected(playeritemid) {
    
    if(
itemid == g_itemID)
    {
        if( 
gBomb & ( << ( player 32 ) ) )
            
Color(player"[ZP] You already have a force field")
        else 
        {
            
gBomb |= ( << ( player 32 ) )
            
            if( !
user_has_weaponplayerCSW_SMOKEGRENADE ) )
                
give_item(player,"weapon_smokegrenade")
            
            
            
#if defined CAMPO_ROUND
            
Color(player"[ZP] You Bought a force field!. This, lasts 1 round complete.")
            
#else
            
Color(player"[ZP] You Bought a force field!. This, lasts very little!")
            
#endif
        
}
        
        
    }
    
}public 
fw_PlayerKilled(victimattackershouldgib)
{
    if( ( 
<= attacker <= 32 ) && ( gBomb & ( << ( victim 32 ) ) ) ) 
        
gBomb &= ~( << ( victim 32 ) )
}

public 
fw_ThinkGrenade(entity) {   
    
    if(!
pev_valid(entity)) return HAM_IGNORED
    
    
static Float:dmgtime   
    pev
(entitypev_dmgtimedmgtime)
    
    if (
dmgtime get_gametime())
        return 
HAM_IGNORED   
    
    
if(pev(entitypev_flTimeStepSound) == NADE_TYPE_CAMPO)
        
crear_ent(entity)
    
    return 
HAM_SUPERCEDE
}


public 
fw_SetModel(entity, const model[]) {    
    
    static 
Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    if (
dmgtime == 0.0)
        return 
FMRES_IGNORED;
    
    if (
equal(model[7], "w_sm"4))
    {        
        new 
owner pev(entitypev_owner)        
        
        if( 
is_user_alive(owner) && !zp_get_user_zombie(owner) && ( gBomb & ( << ( owner 32 ) ) ) ) 
        {
            
set_pcvar_num(cvar_flaregrenades,0)            
            
            
fm_set_rendering(entitykRenderFxGlowShell000255255kRenderNormal16)
            
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_BEAMFOLLOW// TE id
            
write_short(entity// entity
            
write_short(g_trailSpr// sprite
            
write_byte(10// life
            
write_byte(10// width
            
write_byte(TrailColor]) // r
            
write_byte(TrailColor]) // g
            
write_byte(TrailColor]) // b
            
write_byte(500// brightness
            
message_end()
            
            
set_pev(entitypev_flTimeStepSoundNADE_TYPE_CAMPO)
            
            
set_task(6.0"DeleteEntityGrenade" ,entity)
            
gBomb &= ~( << ( owner 32 ) )
            
entity_set_model(entityw_model)
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
    
}

public 
DeleteEntityGrenade(entity
    if( 
is_valid_ententity ) )
        
remove_entity(entity)

public 
crear_ent(id) {
        
    
set_pcvar_num(cvar_flaregrenades,1)
    
    
// Create entitity
    
new iEntity create_entity("info_target")
    
    if(!
is_valid_ent(iEntity))
        return 
PLUGIN_HANDLED
    
    
new FloatOrigin[3
    
entity_get_vector(idEV_VEC_originOrigin
    
    
entity_set_string(iEntityEV_SZ_classnameentclas)
    
    
entity_set_vector(iEntity,EV_VEC_originOrigin)
    
entity_set_model(iEntity,model)
    
entity_set_int(iEntityEV_INT_solidSOLID_TRIGGER)
    
entity_set_size(iEntityMinsMaxs )
    
entity_set_int(iEntityEV_INT_renderfxkRenderFxGlowShell)
    
entity_set_int(iEntityEV_INT_rendermodekRenderTransAlpha)
    
entity_set_float(iEntityEV_FL_renderamt50.0)
    
    
#if defined RANDOM_COLOR
    
if(is_valid_ent(iEntity))
    {
        new 
Float:vColor[3]
        
        for(new 
i3i++)
            
vColor[i] = random_float(0.0255.0)
        
        
entity_set_vector(iEntityEV_VEC_rendercolorvColor)
    }
    
#endif
    
    #if defined ONE_COLOR
    
entity_set_vector(iEntityEV_VEC_rendercolorCampoColors)
    
#endif
    
    #if defined CAMPO_TASK
    
set_task(60.0"DeleteEntity"iEntity)
    
#endif
    
    
    
return PLUGIN_CONTINUE;
}

public 
zp_user_infected_post(infectedinfector
    if ( 
gBomb & ( << ( infected 32 ) ) ) 
        
gBomb &= ~( << ( infected 32 ) ) 

public 
fw_touch(enttouched)
{
    if ( !
pev_valid(ent) ) return FMRES_IGNORED;
    static 
entclass[32];
    
pev(entpev_modelentclass31);
    
    if ( 
strcmpentclassmodel ) == )
    {    
        if( 
ValidTouch(touched) )
        {
            static 
Float:pos_ptr[3], Float:pos_ptd[3]
            
            
pev(entpev_originpos_ptr)
            
pev(touchedpev_originpos_ptd)
            
            for(new 
03i++)
            {
                
pos_ptd[i] -= pos_ptr[i]
                
pos_ptd[i] *= Push
            
}
            
set_pev(touchedpev_velocitypos_ptd)
            
set_pev(touchedpev_impulsepos_ptd)
        }
    }
    return 
FMRES_HANDLED
}


public 
DeleteEntityentity )  // Thanks xPaw For The Code =D
    
if( is_valid_ententity ) ) 
    
remove_entityentity );

stock Color(const id, const input[], any:...)
{
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
    
message_begin(MSG_ONE_UNRELIABLEg_SayText_id)
    
write_byte(id)
    
write_string(msg)
    
message_end()
}

public 
shield_deployshield_ent )
{
    if( 
pev_validshield_ent ) != )
        return 
HAM_IGNORED;
    
    static const 
mPlayer 41
    
    
new id get_pdata_cbaseshield_entmPlayer);
    
    if( ( 
gBomb & ( << ( id 32 ) ) ) && !zp_get_user_zombieid ) )
        
set_pevidpev_viewmodel2model_grenade );
    
    return 
HAM_IGNORED;

I didn't test it, because I don't have zombie plague installed.
__________________

Last edited by OciXCrom; 03-08-2017 at 14:01.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Old 03-08-2017, 14:06
OciXCrom
This message has been deleted by OciXCrom. Reason: My post blew up from too many symbols I guess.
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-08-2017 , 14:17   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #114

Let's actually try something for the other ones. Add this in the code and don't change anything:

PHP Code:
#include <customshop>
#define zp_register_extra_item(%1,%2,%3) cshop_register_item(%1, %1, %2, .team = %3)
#define zp_extra_item_selected cshop_item_selected 
Tell me if it worked.
__________________

Last edited by OciXCrom; 03-08-2017 at 18:45.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
artefuckt
Junior Member
Join Date: Mar 2017
Old 03-10-2017 , 13:44   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #115

Quote:
Originally Posted by OciXCrom View Post
Let's actually try something for the other ones. Add this in the code and don't change anything:

PHP Code:
#include <customshop>
#define zp_register_extra_item(%1,%2,%3) cshop_register_item(%1, %1, %2, .team = %3)
#define zp_extra_item_selected cshop_item_selected 
Tell me if it worked.
With one zp_bazooka_new_modes worked, but with anothers doesn't work.
For example doesn't work for zp extra unlimited clip. I have this error:
ex:
HTML Code:
zp_points_extra_unlimited_clip.sma(49) error 035: argument type mismatch (argument 1)
Sma, down.
Attached Files
File Type: sma Get Plugin or Get Source (zp_points_extra_unlimited_clip.sma - 521 views - 3.5 KB)
artefuckt is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-10-2017 , 13:47   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #116

PHP Code:
g_itemid_infammo cshop_register_item("unlcliponeround""Unlimited Clip(one round)"401, .team ZP_TEAM_HUMAN
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
artefuckt
Junior Member
Join Date: Mar 2017
Old 03-10-2017 , 15:43   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #117

Worked, but:
- if i change the map prices don't save
- if i activate autosave sometime the server crash. And i have some errors in my console:
HTML Code:
L 03/10/2017 - 22:41:32: [AMXX] Displaying debug trace (plugin "custom_shop.amxx")
L 03/10/2017 - 22:41:32: [AMXX] Run time error 10: native error (native "nvault_get")
L 03/10/2017 - 22:41:32: [AMXX] [0] custom_shop.sma::nvault_read (line 556)
L 03/10/2017 - 22:41:32: [AMXX] [1] custom_shop.sma::client_infochanged (line 539)
L 03/10/2017 - 22:41:32: [nVault] Invalid vault id: 0
If you have enough time try to save with mysql.

Last edited by artefuckt; 03-10-2017 at 17:29.
artefuckt is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-11-2017 , 09:07   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #118

The errors in the console were from a mistake I made. Download version v3.6a.
What do you mean by "autosave"?

//Edit: I figured out why it's not saving them. The item needs to be registered in plugin_precache().
If the line that contains cshop_register_item is in plugin_init(), you need to move it to plugin_precache().

PHP Code:
public plugin_init()
{
    
regsister_plugin(bla bla)
    
bla bla
    bla 
cshop_register_item(bla bla)

=>

PHP Code:
public plugin_precache()
{
    
bla bla
    precache_bla
(bla bla)
    
bla cshop_register_item(bla bla)

__________________

Last edited by OciXCrom; 03-11-2017 at 12:44.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
artefuckt
Junior Member
Join Date: Mar 2017
Old 03-11-2017 , 16:25   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #119

Quote:
Originally Posted by OciXCrom View Post
The errors in the console were from a mistake I made. Download version v3.6a.
What do you mean by "autosave"?

//Edit: I figured out why it's not saving them. The item needs to be registered in plugin_precache().
If the line that contains cshop_register_item is in plugin_init(), you need to move it to plugin_precache().

PHP Code:
public plugin_init()
{
    
regsister_plugin(bla bla)
    
bla bla
    bla 
cshop_register_item(bla bla)

=>

PHP Code:
public plugin_precache()
{
    
bla bla
    precache_bla
(bla bla)
    
bla cshop_register_item(bla bla)

Ok after the updates, doesn't work anything and i get this errors:
HTML Code:
L 03/11/2017 - 23:51:10: [AMXX] Plugin "custom_shop.amxx" failed to load: Plugin uses an unknown function (name "zp_set_user_points") - check your modules.ini.
L 03/11/2017 - 23:51:10: Called dynanative into a paused plugin.
L 03/11/2017 - 23:51:10: [AMXX] Displaying debug trace (plugin "cshop_items.amxx")
L 03/11/2017 - 23:51:10: [AMXX] Run time error 10: native error (native "cshopRegisterItem")
L 03/11/2017 - 23:51:10: [AMXX] [0] cshop_items.sma::plugin_precache (line 175)
L 03/11/2017 - 23:34:24: [AMXX] Displaying debug trace (plugin "zp_points_buy_health_points.amxx")
L 03/11/2017 - 23:34:24: [AMXX] Run time error 10: native error (native "cshopRegisterItem")
L 03/11/2017 - 23:34:24: [AMXX] [0] zp_points_buy_health_points.sma::plugin_precache (line 21)

Last edited by artefuckt; 03-11-2017 at 16:53.
artefuckt is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-12-2017 , 10:22   Re: OciXCrom's Custom Shop 3.6 + API
Reply With Quote #120

You messed something up. Did you edit the cshop_settings.inc file before/after the update? There is no "zp_set_user_points" code in custom_shop.sma, so you changed something.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode