Raised This Month: $ Target: $400
 0% 

Help / Support Extra item new cost !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Killer zm
Senior Member
Join Date: Jun 2011
Old 10-16-2013 , 17:04   Extra item new cost !
Reply With Quote #1

I need help if I can make for a zombie class, low/discount cost to some extra items.

I mean insteand 10 ammopacks, the price for all zombies , this class have an lower cost.
Anyone have a ideea ?

Last edited by Killer zm; 10-16-2013 at 17:05.
Killer zm is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 10-17-2013 , 01:50   Re: Extra item new cost !
Reply With Quote #2

Possible ..... just post the zombie class code here....
__________________
You will find everything u need :-
Catastrophe is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-17-2013 , 03:30   Re: Extra item new cost !
Reply With Quote #3

i have the same question how i can make this for example on classic zombie..

code:

PHP Code:
/*================================================================================
    
    -----------------------------------
    -*- [ZP] Class: Zombie: Classic -*-
    -----------------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <zp50_class_zombie>

// Classic Zombie Attributes
new const zombieclass1_name[] = "Classic Zombie"
new const zombieclass1_info[] = "=Balanced="
new const zombieclass1_models[][] = { "zombie_source" }
new const 
zombieclass1_clawmodels[][] = { "models/zombie_plague/v_knife_zombie.mdl" }
const 
zombieclass1_health 1800
const Float:zombieclass1_speed 0.75
const Float:zombieclass1_gravity 1.0
const Float:zombieclass1_knockback 1.0

new g_ZombieClassID

public plugin_precache()
{
    
register_plugin("[ZP] Class: Zombie: Classic"ZP_VERSION_STRING"ZP Dev Team")
    
    new 
index
    
    g_ZombieClassID 
zp_class_zombie_register(zombieclass1_namezombieclass1_infozombieclass1_healthzombieclass1_speedzombieclass1_gravity)
    
zp_class_zombie_register_kb(g_ZombieClassIDzombieclass1_knockback)
    for (
index 0index sizeof zombieclass1_modelsindex++)
        
zp_class_zombie_register_model(g_ZombieClassIDzombieclass1_models[index])
    for (
index 0index sizeof zombieclass1_clawmodelsindex++)
        
zp_class_zombie_register_claw(g_ZombieClassIDzombieclass1_clawmodels[index])


Last edited by wicho; 10-17-2013 at 03:31.
wicho is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 10-17-2013 , 17:04   Re: Extra item new cost !
Reply With Quote #4

exactly the same code to wicho
Killer zm is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 10-18-2013 , 02:06   Re: Extra item new cost !
Reply With Quote #5

wicho... i cant code rit now.... not at my desk.... but ill telll u how... make a new code and then in zp_fw_items_select_POST check if the the zombie class in the class that u want by zp_class_zombie_get_current == zp_class_zombie_get_id("Your class name")

then if that is true... just add 10 ammopacks to the user (this is a way to give discount, first we subtract the cost and then add the discount its the same thing)
__________________
You will find everything u need :-
Catastrophe is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-18-2013 , 15:04   Re: Extra item new cost !
Reply With Quote #6

Like this? for example if the item cost 20 with this just discount 10 ammo packs to classic zombie right?..

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <zp50_items>
#include <zp50_ammopacks>
#include <zp50_class_zombie>

new g_ZombieClassID

public plugin_init()
{
    
register_plugin("[ZP] Discount Cost"ZP_VERSION_STRING"Chuck Norris")
}

public 
plugin_cfg()
{
    
    
g_ZombieClassID zp_class_zombie_get_id("Classic Zombie")
    
}    

public 
zp_fw_items_select_post(iditemidignorecost)
{    
    
    new 
current_zclass zp_class_zombie_get_current(id)

         if (
current_zclass == ZP_INVALID_ZOMBIE_CLASS)
             return
    
    if(
current_zclass == g_ZombieClassID)
    {
        
    
zp_ammopacks_set(idzp_ammopacks_get(id) + 10)    
    
    }
    


Last edited by wicho; 10-18-2013 at 15:23.
wicho is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 10-19-2013 , 01:19   Re: Extra item new cost !
Reply With Quote #7

Yes.... this shud work..... u can even set the discount to be sm part of the cost of the item
for example:-
PHP Code:
if(current_zclass == g_ZombieClassID)
    {
    new 
Float:discountodis
    discount 
zp_items_get_cost(itemid)/5    // This will give 20% discount (For editing this part your math should be good)
    
odis floatround(discount)   

    
zp_ammopacks_set(idzp_ammopacks_get(id) + odis)    
    
    } 
__________________
You will find everything u need :-

Last edited by Catastrophe; 10-19-2013 at 01:20.
Catastrophe is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-19-2013 , 02:30   Re: Extra item new cost !
Reply With Quote #8

what is floatround?
wicho is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 10-19-2013 , 10:39   Re: Extra item new cost !
Reply With Quote #9

floatround means it will round off any value .. for example if the value is 5.46 or and i use floatround it will make it 5 (no decimals) .

I.E It converts float value to integer value.....
__________________
You will find everything u need :-
Catastrophe is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-19-2013 , 15:12   Re: Extra item new cost !
Reply With Quote #10

ok and for example if the value is 5.78 this aproximate to 6 right?
wicho is offline
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 11:41.


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