Raised This Month: $119 Target: $400
 29% 

[Help/Req] Shop Plugin/Sma


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fLyiNG birdy
Junior Member
Join Date: Sep 2019
Old 09-08-2019 , 11:52   [Help/Req] Shop Plugin/Sma
Reply With Quote #1

Hello can somebody edit/fix this pluging for me?
Remove all the bombs, shield , gravity. i need a plugin that has
He bomb 400$
Bunnyhop 4000$
doublejump 3000$
silent walk 2000$
respawn 5000$
or if u have another sma than this with the stuff that i need would be great

ocixcrom

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "shop"
#define VERSION "1.0"
#define AUTHOR "kasper"

new cash[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /shop""cmdShop"0);
    
}


public 
cmdShop(id)
{

    new 
menu menu_create("\yShop: ""cmdShop_handler");
    
    
menu_additem(menu"\yH\wE Grenade \r| \y7000$""1"0);
    
menu_additem(menu"\yF\wlash Grenade \r| \y6000$""2"0);
    
menu_additem(menu"\yS\wmoke Grenade \r| \y5400$""3"0);
    
menu_additem(menu"\yS\whield \r| \y10000$""4"0);
    
menu_additem(menu"\yS\wpeed \r| \y 8000$""5"0);
    
menu_additem(menu"\yG\wravity \r| \y 4500$""6"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

}

public 
cmdShop_handler(idmenuitem)
{

    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }


    new 
data[6], szName[64];
    new 
accesscallback;

    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    
cash[id] = cs_get_user_money(id);
    
    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            if(
cash[id] > 7000)
            {
                
client_print(idprint_chat"You Have Bought HE Nade");
                
cs_set_user_money(idcash[id] - 7000);
                
give_item(id"weapon_hegrenade");
            }
            else {
                
client_print(idprint_chat"You Dont Have Enough Money");
            }
        }
        case 
2:
        {
            if(
cash[id] > 6000)
            {
                
client_print(idprint_chat"You Have Bought Flash Bang");
                
cs_set_user_money(idcash[id] - 6000);
                
give_item(id"weapon_flashbang");
            }
            else {
                
client_print(idprint_chat"You Dont Have Enough Money");
            }
        }
        case 
3:
        {
            if(
cash[id] > 5400)
            {
                
client_print(idprint_chat"You Have Bought Smoke Nade");
                
cs_set_user_money(idcash[id] - 5400);
                
give_item(id"weapon_smokegrenade");
            }
            else {
                
client_print(idprint_chat"You Dont Have Enough Money");
            }
        }
        case 
4:
        {
            if(
cash[id] > 10000)
            {
                
client_print(idprint_chat"You Have Bought Shield");
                
cs_set_user_money(idcash[id] - 10000);
                
give_item(id"weapon_shield");
            }
            else {
                
client_print(idprint_chat"You Dont Have Enough Money");
            }    
        }
        case 
5:
        {
            if(
cash[id] > 8000)
            {
                
client_print(idprint_chat"You Have Bought Speed");
                
cs_set_user_money(idcash[id] - 8000);
                
// not worked yet
            
}
            else {
                
client_print(idprint_chat"You Dont Have Enough Money");
            }            
        }
        case 
6:
        {
            if(
cash[id] > 4500)
            {
                
client_print(idprint_chat"You Have Bought Gravity");
                
cs_set_user_money(idcash[id] - 4500);
                
set_user_gravity(id0.25);
            }
            else {
                
client_print(idprint_chat"You Dont Have Enough Money");
            }            
        }
    }


    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

fLyiNG birdy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Location: Derbent, Caucasian
Old 09-08-2019 , 12:03   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=284603
__________________
Quote:
Learning Application Development /Pyhton/
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
fLyiNG birdy
Junior Member
Join Date: Sep 2019
Old 09-08-2019 , 12:22   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #3

i dont want everything in that oci shop
fLyiNG birdy is offline
skatz_ws
Junior Member
Join Date: Aug 2019
Old 09-08-2019 , 12:56   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #4

I've made what you requested, and I added two things that could help: Only alive users can use the shop, and they can only use it one time per round.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <hamsandwich>

#define MAX_PLAYERS 32+1

enum _:PluginInfo
{
    
PluginNamePluginVersionPluginCreator
};

new const 
GetInfo[PluginInfo][] = 
{
    
"Shop""0.1""SKAtZ"
};

enum _:Data
{
    
_name[32], 
    
_price
};

new const 
ShopItems[][Data] = 
{
    {
"HE Bomb",    400},
    {
"Bunnyhop"4000},
    {
"Double Jump"3000},
    {
"Silent Walk"2000},
    {
"Respawn"5000}
};

new 
boolBunnyHop[MAX_PLAYERS] = false;
new 
boolDoubleJump[MAX_PLAYERS] = false;
new 
boolRespawn[MAX_PLAYERS] = false;
new 
boolShop[MAX_PLAYERS] = false;
new 
jumpnum[MAX_PLAYERS] = 0;
new 
bool:dojump[MAX_PLAYERS] = false;

public 
plugin_init() 
{
    
//Regist plugin
    
register_plugin (GetInfo[PluginName], GetInfo[PluginVersion], GetInfo[PluginCreator]);
    
    
//Regist commands
    
register_clcmd    ("say /shop""_shop");
    
    
//Regist functions
    
RegisterHam        (Ham_Spawn,"player","_spawn",1);     // Spawn
    
RegisterHam        (Ham_Killed"player","_death");     // Death
}

public 
_spawn(id) if(is_user_alive(id))
{
    if(!
Respawn[id])
    {
        
BunnyHop[id] = false;// Remove BunnyHop
        
DoubleJump[id] = false;// Remove Double Jump
        
Shop[id] = false;// User can use shop again
        
set_user_footsteps(id0);// Remove Silent Walk
    
}
    
    
Respawn[id] = false;
}

public 
_death(victimkillershouldgib)
{
    if(
Respawn[victim]) set_task(3.0"_respawn"victim);
}

public 
_respawn(id)
{
    if(
is_user_connected(id) && !is_user_alive(id)) 
    {
        
ExecuteHamB(Ham_CS_RoundRespawnid);
        
client_print(idprint_chat"You were respawned");
    }
}

public 
client_putinserver(id)
{
    
jumpnum[id] = 0;
    
dojump[id] = false;
}

public 
client_disconnect(id)
{
    if(
task_exists(id)) remove_task(id);
    
jumpnum[id] = 0;
    
dojump[id] = false;
}

public 
_shop(id)
{
    new 
menu menu_create("Shop""_shop_handler");
    new 
money cs_get_user_money(id);    
    
    static 
item[128];
    for(new 
0sizeof ShopItemsi++)
    {
        
formatex(itemcharsmax(item), "\r%i$ %s%s"ShopItems[i][_price], ShopItems[i][_price] > money "\d" "\y"ShopItems[i][_name]);
        
menu_additem(menuitem);
    }
            
    
menu_setprop(menuMPROP_BACKNAME,"Back");
    
menu_setprop(menuMPROP_NEXTNAME,"Next");
    
menu_setprop(menuMPROP_EXITNAME,"Exit");
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
}

public 
_shop_handler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    if(
Shop[id] || !is_user_alive(id))
    {
        
client_print(idprint_chat"You must be alive or haven't used the shop this round to access it.");
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }        
    
    new 
money cs_get_user_money(id);
    
    if(
ShopItems[item][_price] > money)
    {
        
client_print(idprint_chat"You don't have enough money to buy %s.",ShopItems[item][_name]);
        
_shop(id);
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(idprint_chat"You bought %s.",ShopItems[item][_name]);
        
cs_set_user_money(idmoney ShopItems[item][_price]);
        
Shop[id] = true;
        switch(
item)
        {
            case 
0give_item(id"weapon_hegrenade");
            case 
1BunnyHop[id] = true;
            case 
2DoubleJump[id] = true;
            case 
3set_user_footsteps(id1);
            case 
4Respawn[id] = true;
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
client_PreThink(id
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE;
    
    
//Credits to twistedeuphoria
    
if(DoubleJump[id])
    {
        new 
nbut get_user_button(id);
        new 
obut get_user_oldbutton(id);
        if((
nbut IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut IN_JUMP))
        {
            if(
jumpnum[id] < 1)
            {
                
dojump[id] = true;
                
jumpnum[id]++;
                return 
PLUGIN_CONTINUE;
            }
        }
        if((
nbut IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
        {
            
jumpnum[id] = 0;
            return 
PLUGIN_CONTINUE;
        }
        return 
PLUGIN_CONTINUE;
    }
    
//Credits to CheesyPeteza
    
if(BunnyHop[id])
    {
        
entity_set_float(idEV_FL_fuser20.0);
            
        if(
entity_get_int(idEV_INT_button) & 2
        {    
            new 
flags entity_get_int(idEV_INT_flags);
            
            if(
flags FL_WATERJUMP)
                return 
PLUGIN_CONTINUE;
            if(
entity_get_int(idEV_INT_waterlevel) >= 2)
                return 
PLUGIN_CONTINUE;
            if(!(
flags FL_ONGROUND))
                return 
PLUGIN_CONTINUE;
            
            new 
Float:velocity[3];
            
entity_get_vector(idEV_VEC_velocityvelocity);
            
velocity[2] += 250.0;
            
entity_set_vector(idEV_VEC_velocityvelocity);
            
            
entity_set_int(idEV_INT_gaitsequence6);
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_PostThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE;
    
    
//Credits to twistedeuphoria
    
if(DoubleJump[id] && dojump[id] == true)
    {
        new 
Float:velocity[3];    
        
entity_get_vector(id,EV_VEC_velocity,velocity);
        
velocity[2] = random_float(265.0,285.0);
        
entity_set_vector(id,EV_VEC_velocity,velocity);
        
dojump[id] = false;
        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_CONTINUE;

I didn't test it, so any bug or something wrong please report. Hope I could help you!
PS. Sorry if there are english errors, I'm not a good speaker eheh

Last edited by skatz_ws; 09-08-2019 at 13:01.
skatz_ws is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-08-2019 , 13:24   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #5

Quote:
Originally Posted by fLyiNG birdy View Post
i dont want everything in that oci shop
If you look carefully, you can notice that everything in the shop can be disabled, modified or added.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fLyiNG birdy
Junior Member
Join Date: Sep 2019
Old 09-08-2019 , 13:45   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #6

skatz_ws
Thank u so much for take time making this for me (also thank u ocixcrom for the notice msg)
But can u add 1 last thing to it, it would be amazing!
If not having money for it play sound
If bought something play sound
Sounds:
Mediafire: https://www.mediafire.com/file/5v2t4...ounds.rar/file
another link if mediafire isnt working
Zippyshare: https://www12.zippyshare.com/v/p45II0eF/file.html
fLyiNG birdy is offline
skatz_ws
Junior Member
Join Date: Aug 2019
Old 09-08-2019 , 20:03   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #7

Quote:
Originally Posted by fLyiNG birdy View Post
skatz_ws
Thank u so much for take time making this for me (also thank u ocixcrom for the notice msg)
But can u add 1 last thing to it, it would be amazing!
If not having money for it play sound
If bought something play sound
Sounds:
Mediafire: https://www.mediafire.com/file/5v2t4...ounds.rar/file
another link if mediafire isnt working
Zippyshare: https://www12.zippyshare.com/v/p45II0eF/file.html
Add this:
PHP Code:
public plugin_precache()  
{
    
precache_sound("yoursond.wav");

Put your sound into your cstrike/sounds server folder.
Than add this in your after if(ShopItems[item][_price] > money) condition
PHP Code:
client_cmd (id"spk sound/yoursound.wav"); 
skatz_ws is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-09-2019 , 03:28   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #8

Quote:
Originally Posted by skatz_ws View Post

PHP Code:
public client_putinserver(id)
{
    
jumpnum[id] = 0;
    
dojump[id] = false;
}

public 
client_disconnect(id)
{
    if(
task_exists(id)) remove_task(id);
    
jumpnum[id] = 0;
    
dojump[id] = false;

skatz_ws
there is no need to do these in client_putinserver
Code:
jumpnum[id] = 0 dojump[id] = false
doing it in disconnect is enough.

Last edited by LearninG; 09-09-2019 at 03:29.
LearninG is offline
skatz_ws
Junior Member
Join Date: Aug 2019
Old 09-09-2019 , 06:15   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #9

Quote:
Originally Posted by LearninG View Post
skatz_ws
there is no need to do these in client_putinserver
Code:
jumpnum[id] = 0 dojump[id] = false
doing it in disconnect is enough.
I know, but it was what twistedeuphoria used in his MultiJump plugin (aproved) https://forums.alliedmods.net/showth...=88160?p=88160
skatz_ws is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-09-2019 , 07:16   Re: [Help/Req] Shop Plugin/Sma
Reply With Quote #10

Quote:
Originally Posted by skatz_ws View Post
I know, but it was what twistedeuphoria used in his MultiJump plugin (aproved) https://forums.alliedmods.net/showth...=88160?p=88160
Yes, 14 years ago. That plugin is nowhere near approval standards today.
__________________

Last edited by OciXCrom; 09-09-2019 at 07:16.
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 15:47.


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