Raised This Month: $ Target: $400
 0% 

OciXCrom's Custom Shop + API


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mark.uG
AlliedModders Donor
Join Date: Oct 2014
Old 06-21-2019 , 19:37   Re: OciXCrom's Custom Shop + API
Reply With Quote #1

Quote:
Originally Posted by OciXCrom View Post
So that means you haven't tested the original code?...

Updating to 1.9 doesn't mean you have to replace any plugins.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <cstrike>
#include <customshop>

#define PLUGIN "Points Donate"
#define VERSION "1.0"
#define AUTOR "iceeedR"

#if defined client_disconnected
    #define client_disconnect client_disconnected
#endif

#if !defined MAX_PLAYERS
const MAX_PLAYERS 32
#endif

/* Edit by OciXCrom: made the plugin donate points from Custom Shop instead of money */

new const Prefix[] = "Allied Donators"
new DonateTarget[MAX_PLAYERS +1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTOR);
    
register_clcmd("say /donate""DonateCmd")
    
register_clcmd("plugin_donate""DonateHandler")
}

public 
client_disconnect(id)
{
    
DonateTarget[id] = // just for secure
}

public 
DonateCmd(id)
{
    new 
szItem[64]
    
formatex(szItemcharsmax(szItem), "\y[\w%s\d - \rDonate Menu \y ]"Prefix)

    new 
iMenu menu_create(szItem"donate_handler")

    new 
iPlayers[MAX_PLAYERS], iNum
    get_players
(iPlayersiNum"e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" "CT")
    for(new 
iszTempid[10], iPlayer;iNum;i++)
    {
        
iPlayer iPlayers[i]

        if(
iPlayer != id)
        {
            
num_to_str(iPlayerszTempidcharsmax(szTempid))
            
get_user_name(iPlayerszItemcharsmax(szItem))
            
menu_additem(iMenuszItemszTempid)
        }
    }

    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
donate_handler(idiMenuiItem)
{
    if(
iItem == MENU_EXIT)
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
    new 
iData[6], szItemName[MAX_PLAYERS 2], iAccessiCallback
    menu_item_getinfo
(iMenuiItemiAccessiDatacharsmax(iData), szItemNamecharsmax(szItemName), iCallback)

    
DonateTarget[id] = str_to_num(iData)

    if(!
DonateTarget[id])
    {
        
client_print_color(idprint_team_default"%s This player does not exist."Prefix)
        
menu_display(idiMenu)
        
DonateTarget[id] = 0
        
return PLUGIN_HANDLED
    
}

    
client_cmd(id"messagemode plugin_donate")

    
client_print_color(idprint_team_default"%s Type how much you want to give."Prefix)
    return 
PLUGIN_HANDLED
}

public 
DonateHandler(id)
{
    new 
szValue[8]
    
read_argv(1szValuecharsmax(szValue))

    new 
iValue str_to_num(szValue)

    new 
iPlayerMoney cshop_get_points(id)

    if( 
iPlayerMoney iValue || iValue <= 0)
    {
        
client_print_color(idprint_team_default"%s You do not have enough money."Prefix)
        return 
PLUGIN_CONTINUE
    
}

    
cshop_give_pointsDonateTarget[id], iValue)
    
cshop_give_pointsidiValue * -1)

    new 
szNameGiver[MAX_PLAYERS]
    
get_user_nameidszNameGivercharsmaxszNameGiver))

    new 
szNameReceiver[MAX_PLAYERS]
    
get_user_name(DonateTarget[id], szNameReceivercharsmax(szNameReceiver))

    new 
iPlayers[MAX_PLAYERS], iNum
    get_players
(iPlayersiNum"e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" "CT")
    for(new 
i;iNum;i++)
    {
        
client_print_color(iPlayers[i], print_team_default"%s^x04 %s^x01 donated^x04 $%i^x01 for^x04 %s."PrefixszNameGiveriValueszNameReceiver)
    }
    
client_cmd(DonateTarget[id], "spk ^"items/9mmclip1.wav^"")

    
DonateTarget[id] = 0
    
return PLUGIN_HANDLED

Works great where to send to $10
Mark.uG is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 06-19-2019 , 08:54   Re: OciXCrom's Custom Shop + API
Reply With Quote #2

PHP Code:
public client_disconnected(id)
{
    
DonateTarget[id] = // just for secure



PHP Code:
public client_disconnect(id)
{
    
DonateTarget[id] = // just for secure

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-19-2019 , 10:08   Re: OciXCrom's Custom Shop + API
Reply With Quote #3

For versions compatibility

PHP Code:
#if AMXX_VERSION_NUM > 182
public client_disconnected(id)
#else
public client_disconnect(id)
#endif
{
          
// CODE...

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-19-2019 , 13:14   Re: OciXCrom's Custom Shop + API
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
For versions compatibility

PHP Code:
#if AMXX_VERSION_NUM > 182
public client_disconnected(id)
#else
public client_disconnect(id)
#endif
{
          
// CODE...

There's no need. client_disconnect still works on new versions.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Old 06-19-2019, 14:35
Natsheh
This message has been deleted by Natsheh. Reason: Nvm
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-19-2019 , 14:47   Re: OciXCrom's Custom Shop + API
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
There is no breaking change, client_disconnect() is still there. You will just get a warning if you try to compile with it.
Just to avoid the warning.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-21-2019 , 20:00   Re: OciXCrom's Custom Shop + API
Reply With Quote #7

Keep them. There's no need.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 06-23-2019 , 04:14   Re: OciXCrom's Custom Shop + API
Reply With Quote #8

After edit CustomShop.txt (lang) ( just add CSHOP_NOTALLOWED_ZOMBIE = Zombies can't use the &x04Custom Shop&x01!), I always get ml_notfound.
Why plugin does not recognize CustomShop.txt after editing?
__________________
Check my original plugins for cs 1.6 and subscribe on channel
Look at the video bellow to see zombie frost grenade

https://youtu.be/j0zspNfN-AM?si=_1IiGPETN-GQY9Ua

Look at the video below to see Zombie blind grenade

https://youtu.be/ORC7ZmoaipQ?si=QC8Bul96QGitUwX4

Last edited by Krtola; 06-23-2019 at 05:56.
Krtola is offline
Send a message via Skype™ to Krtola
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-23-2019 , 07:40   Re: OciXCrom's Custom Shop + API
Reply With Quote #9

Well, did you use the language key inside the plugin? Or you're getting not found for everything? If the latter, your text editor probably messed up the file's enconding and the server can't read it. It should be UTF8 (without BOM). You probably have an error in your logs about this.
__________________

Last edited by OciXCrom; 06-23-2019 at 07:41.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 06-23-2019 , 08:21   Re: OciXCrom's Custom Shop + API
Reply With Quote #10

I get ml_notfound just for CSHOP_NOTALLOWED_ZOMBIE.
I will check now about that UTF8 (without BOM). Notepad++ have that options.
No error in logs about this.
In logs I see just errors related with nvault.

Solved - problem was in BOM. Thank you.

In CustomShopItems i also see this

PHP Code:
[sflasergun ML_NOTFOUNDCS]
ML_NOTFOUNDCSSF Laser Gun
ML_NOTFOUND
CS1
ML_NOTFOUND
CS
Is this also related to BOM ?
__________________
Check my original plugins for cs 1.6 and subscribe on channel
Look at the video bellow to see zombie frost grenade

https://youtu.be/j0zspNfN-AM?si=_1IiGPETN-GQY9Ua

Look at the video below to see Zombie blind grenade

https://youtu.be/ORC7ZmoaipQ?si=QC8Bul96QGitUwX4

Last edited by Krtola; 06-23-2019 at 09:09.
Krtola is offline
Send a message via Skype™ to Krtola
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 06:58.


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