AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [Help/Req] Shop Plugin/Sma (https://forums.alliedmods.net/showthread.php?t=318582)

fLyiNG birdy 09-08-2019 11:52

[Help/Req] Shop Plugin/Sma
 
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;



Fuck For Fun 09-08-2019 12:03

Re: [Help/Req] Shop Plugin/Sma
 
https://forums.alliedmods.net/showthread.php?t=284603

fLyiNG birdy 09-08-2019 12:22

Re: [Help/Req] Shop Plugin/Sma
 
i dont want everything in that oci shop

skatz_ws 09-08-2019 12:56

Re: [Help/Req] Shop Plugin/Sma
 
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

OciXCrom 09-08-2019 13:24

Re: [Help/Req] Shop Plugin/Sma
 
Quote:

Originally Posted by fLyiNG birdy (Post 2666288)
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.

fLyiNG birdy 09-08-2019 13:45

Re: [Help/Req] Shop Plugin/Sma
 
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

skatz_ws 09-08-2019 20:03

Re: [Help/Req] Shop Plugin/Sma
 
Quote:

Originally Posted by fLyiNG birdy (Post 2666302)
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"); 


LearninG 09-09-2019 03:28

Re: [Help/Req] Shop Plugin/Sma
 
Quote:

Originally Posted by skatz_ws (Post 2666296)

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.

skatz_ws 09-09-2019 06:15

Re: [Help/Req] Shop Plugin/Sma
 
Quote:

Originally Posted by LearninG (Post 2666368)
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

OciXCrom 09-09-2019 07:16

Re: [Help/Req] Shop Plugin/Sma
 
Quote:

Originally Posted by skatz_ws (Post 2666374)
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.


All times are GMT -4. The time now is 18:05.

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