Raised This Month: $32 Target: $400
 8% 

OciXCrom's Custom Shop + API


Post New Thread Reply   
 
Thread Tools Display Modes
msbeden
Member
Join Date: Jan 2020
Location: Turkey, Eskisehir
Old 02-18-2020 , 11:19   Re: OciXCrom's Custom Shop + API
Reply With Quote #241

Hello.
I made a reward system according to the rank. It works fine.

I want to determine the price and time for the products in the market according to the rank.

How can I do it?

Example:

RANK = 1 - 10: Unlimited Clip, 3000$

RANK > 10: Unlimited Clip, 5000$ and 120 second

Last edited by msbeden; 02-18-2020 at 11:20.
msbeden is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-18-2020 , 16:49   Re: OciXCrom's Custom Shop + API
Reply With Quote #242

Quote:
Originally Posted by msbeden View Post
Hello.
I made a reward system according to the rank. It works fine.

I want to determine the price and time for the products in the market according to the rank.

How can I do it?

Example:

RANK = 1 - 10: Unlimited Clip, 3000$

RANK > 10: Unlimited Clip, 5000$ and 120 second
Show your code. u should be using get_user_stats().
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-18-2020 , 17:08   Re: OciXCrom's Custom Shop + API
Reply With Quote #243

^

Code:
if(1 <= rank <= 10) {     // do something.... } else if(rank > 10) {     // do something.... }

But yes, show your code so we can know what exactly you're trying to do.
__________________

Last edited by OciXCrom; 02-18-2020 at 17:08.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
msbeden
Member
Join Date: Jan 2020
Location: Turkey, Eskisehir
Old 02-19-2020 , 01:41   Re: OciXCrom's Custom Shop + API
Reply With Quote #244

I brought it to the simplest form. This is the reward plugin according to the rank I use.

I use the Market and Rank system of OciXCrom. Market works well. But can I adjust the prices and seconds according to rank?

I will write the codes where "HERE NEW CODE" is written.
But how do I combine the two plugins?

Example:

RANK = 1 - 10: Unlimited Clip => 3000$
RANK > 10: Unlimited Clip => 5000$ and 120 seconds

Code:
#include <amxmodx>
#include <cstrike>
#include <reapi>
#include <crxranks>

public plugin_init() 
{
    register_plugin("Rutbeye Odul Sistemi", "1.0", "msbeden");
    RegisterHookChain(RG_CBasePlayer_Spawn, "@CBasePlayer_Spawn", .post=true);
}

@CBasePlayer_Spawn(const id)
{
    new rank = crxranks_get_user_level(id);

    if(rank > 10) {
        //HERE NEW CODE
        //Unlimited Clip => 5000$ and 120 seconds
    } else {
        //HERE NEW CODE 
        //Unlimited Clip => 3000$
    }
}

Last edited by msbeden; 02-19-2020 at 01:45.
msbeden is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-19-2020 , 17:33   Re: OciXCrom's Custom Shop + API
Reply With Quote #245

In order to change the price, you will need to use the forward "cshop_set_price" - this is called just before the plugin sets an item's price, so the return value is the price that will be set.
Here's an example from your code:

Code:
public cshop_set_price(id, iItem, iPrice) {     new iRank = crxranks_get_user_level(id)     new szItem[32]     cshop_get_item_data(iItem, CSHOP_DATA_ID, szItem, charsmax(szItem))     if(equal(szItem, "unlclip"))     {         if(iRank > 10)         {             return 5000         }         else         {             return 3000         }     }     return PLUGIN_CONTINUE }

You can even assign a discount for all items when the rank is < 10.
Here's an example for 20% discount for all items:

Code:
public cshop_set_price(id, iItem, iPrice) {     return crxranks_get_user_level(id) < 10 ? (iPrice - (iPrice * 20 / 100)) : PLUGIN_CONTINUE }

Not sure how you would approach on changing the duration though.
__________________

Last edited by OciXCrom; 02-19-2020 at 17:45.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
msbeden
Member
Join Date: Jan 2020
Location: Turkey, Eskisehir
Old 02-20-2020 , 02:15   Re: OciXCrom's Custom Shop + API
Reply With Quote #246

Thank you so much. If there is no time setting, I increase the price.
msbeden is offline
msbeden
Member
Join Date: Jan 2020
Location: Turkey, Eskisehir
Old 02-26-2020 , 13:49   Re: OciXCrom's Custom Shop + API
Reply With Quote #247

Hello, me again

How can I support multi-language market product names?
msbeden is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-26-2020 , 14:13   Re: OciXCrom's Custom Shop + API
Reply With Quote #248

There's no such option right now. Doing that will be really complicated because you can have an unlimited amount of items in the plugin, so making translation for every single addition would be a bad idea. Maybe I'll add an option to activate it for some items in the future.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Old 03-02-2020, 06:23
msbeden
This message has been deleted by msbeden.
Abdelrhmanreda170
Junior Member
Join Date: Jun 2018
Old 03-05-2020 , 17:03   Re: OciXCrom's Custom Shop + API
Reply With Quote #249

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <customshop>

#define TASK_HUD 5345634
#define TASK_REMOVE 2423423

new bool:has_item[33]
new bool:using_item[33]

additem ITEM_DEADLYSHOT
new sync_hud1
new cvar_deadlyshot_time


public plugin_init()
{
register_plugin(" Extra Item: Deadly Shot ", "1.0", "Dias")

register_event("HLTV", "event_newround", "a", "1=0", "2=0")
RegisterHam(Ham_TraceAttack, "player", "fw_traceattack")

cvar_deadlyshot_time = register_cvar("ds_time", "20.0")

sync_hud1 = CreateHudSyncObj(random_num(1, 10))
}

public plugin_precache()
{
ITEM_DEADLYSHOT = cshop_register_item("deadlyshot", "DEADLYSHOT", 16000, 1)
}

public cshop_item_selected(id, item)
{
if(item != ITEM_DEADLYSHOT)
if(!has_item[id] || using_item[id])
{
has_item[id] = true
using_item[id] = false

set_task(0.1, "show_hud", id+TASK_HUD, _, _, "b")
}

}

public cshop_item_removed(id, item)
{
if(item == ITEM_DEADLYSHOT)
return
if(!has_item[id] || using_item[id])
{
has_item[id] = false
using_item[id] = true
}

}

public zp_user_infected_post(id)
{
remove_ds(id)
}

public show_hud(id)
{
id -= TASK_HUD

set_hudmessage(0, 255, 0, -1.0, 0.88, 0, 2.0, 1.0)

if(has_item[id])
{
ShowSyncHudMsg(id, sync_hud1, "[E] -> Active Deadly Shot")
} else if(using_item[id]) {
ShowSyncHudMsg(id, sync_hud1, "Deadly Shot - Actived")
} else {
set_hudmessage(0, 255, 0, -1.0, 0.88, 0, 2.0, 5.0)
ShowSyncHudMsg(id, sync_hud1, "Deadly Shot - Disable")
if(task_exists(id+TASK_HUD)) remove_task(id+TASK_HUD)
}
}

public client_PostThink(id)
{
static Button
Button = get_user_button(id)

if(Button & IN_USE)
{
if(has_item[id] && !using_item[id])
{
has_item[id] = false
using_item[id] = true

set_task(get_pcvar_float(cvar_deadlyshot_time ), "remove_headshot_mode", id+TASK_REMOVE)
}
}
}

public fw_traceattack(victim, attacker, Float:damage, direction[3], traceresult, dmgbits)
{
if(using_item[attacker])
{
set_tr2(traceresult, TR_iHitgroup, HIT_HEAD)
}
}

public remove_ds(id)
{
if(has_item[id] || using_item[id])
{
has_item[id] = false
using_item[id] = false

if(task_exists(id+TASK_HUD)) remove_task(id+TASK_HUD)
if(task_exists(id+TASK_REMOVE)) remove_task(id+TASK_REMOVE)
}
}

public remove_headshot_mode(id)
{
id -= TASK_REMOVE

has_item[id] = false
using_item[id] = false

if(task_exists(id+TASK_HUD)) remove_task(id+TASK_HUD)
}



CAN YOU FIX IT !?
__________________
J17
Abdelrhmanreda170 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-05-2020 , 17:07   Re: OciXCrom's Custom Shop + API
Reply With Quote #250

Can I read minds? No. So explain what needs to be fixed after you put the code in [code] tags.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 06:42.


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