Raised This Month: $13 Target: $400
 3% 

Knife menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
itoxicreal
Member
Join Date: Jun 2018
Old 05-31-2020 , 16:50   Knife menu
Reply With Quote #1

Is there a knife menu plugin with just 1 knife in the menu,Ive searched and i couldnt find any.If anyone can make a simple knife menu with 1 knife menu that would be amazing
itoxicreal is offline
itoxicreal
Member
Join Date: Jun 2018
Old 05-31-2020 , 18:38   Re: Knife menu
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Thank you very much,Your plugins are really amazing and well coded.
Can you tell me if i did it right

[Karambit]
V_MODEL = models/v_knife_karambit.mdl
P_MODEL = models/p_knife_karambit.mdl
FLAG = b
itoxicreal is offline
itoxicreal
Member
Join Date: Jun 2018
Old 05-31-2020 , 19:21   Re: Knife menu
Reply With Quote #4

Oh and,your subplugin for that plugin,DAMAGE = +25% had no effect for me my knife did same damage
itoxicreal is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-31-2020 , 20:42   Re: Knife menu
Reply With Quote #5

You did it right. Make sure the plugin is running. Check with the "amxx plugins" command. If it is, you probably have another plugin that's blocking it.
__________________

Last edited by OciXCrom; 05-31-2020 at 20:42.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Supremache
Senior Member
Join Date: Sep 2019
Old 05-31-2020 , 21:24   Re: Knife menu
Reply With Quote #6

Quote:
Originally Posted by itoxicreal View Post
Is there a knife menu plugin with just 1 knife in the menu,Ive searched and i couldnt find any.If anyone can make a simple knife menu with 1 knife menu that would be amazing
Simple + With One Knife

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

#define int new
/*--------------------------------*/
new const PREFIX[] = { "!g[KnifeMenu]" };
/*--------------------------------*/

new knife[33];
new 
precache_list[][] = {"models/knifemenu/v_karambit.mdl","models/knifemenu/p_karambit.mdl"};

new 
v_karambitknife[55] = {"models/knifemenu/v_karambit.mdl"};
new 
p_karambitknife[55] = {"models/knifemenu/p_karambit.mdl"};

public 
plugin_init() {
    
    
register_plugin("KnifeMenu","1.0","MrAbdoO")
    
register_clcmd("say /knife","knife_menu");
    
register_event("CurWeapon","set_model","be","1=1");
}

public 
client_putinserver(idknife[id] = 0;

public 
plugin_precache() {
    for(
int i 0<= charsmax(precache_list); i++)
            
precache_model(precache_list[i]);
}
public 
knife_menu(id) {

    new 
menu menu_create("\yKnife Menu:","cmdKnifesMenu");
    
menu_additem(menu,"\wKarambit Knife","",0);
    
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL);
    
menu_display(id,menu,0);
    
    return 
PLUGIN_HANDLED;

}
public 
cmdKnifesMenu(id,menu,item) {
    switch(
item) {
        case 
0: {
            
knife[id] = 1;
            
client_printc(id"%s You have selected !gKarambit Knife!"PREFIX);
        }
    }
    
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
}
public 
set_model(id) {
    if(
is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE ) {
        new 
knife[id];
        switch(
x) {
            case 
1: {
                
set_pev(idpev_viewmodel2v_karambitknife);
                
set_pev(idpev_weaponmodel2p_karambitknife);
            }

        }
    }
}

stock client_printc(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }


Last edited by Supremache; 05-31-2020 at 21:28.
Supremache is offline
itoxicreal
Member
Join Date: Jun 2018
Old 05-31-2020 , 23:23   Re: Knife menu
Reply With Quote #7

[AMXX] Plugin file open error (plugin "knifemenu")

Thats from the code

Last edited by itoxicreal; 05-31-2020 at 23:27.
itoxicreal is offline
itoxicreal
Member
Join Date: Jun 2018
Old 05-31-2020 , 23:42   Re: Knife menu
Reply With Quote #8

There were warning for loose indentation so i fixed it but it didnt solve the problem that the plugin was a bad load.

Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

#define int new
/*--------------------------------*/
new const PREFIX[] = { "!g[KnifeMenu]" };
/*--------------------------------*/

new knife[33];
new precache_list[][] = {"models/knifemenu/v_karambit.mdl","models/knifemenu/p_karambit.mdl"};

new v_karambitknife[55] = {"models/knifemenu/v_karambit.mdl"};
new p_karambitknife[55] = {"models/knifemenu/p_karambit.mdl"};

public plugin_init() {
    
    register_plugin("KnifeMenu","1.0","MrAbdoO")
    register_clcmd("say /knife","knife_menu");
    register_event("CurWeapon","set_model","be","1=1");
}

public client_putinserver(id) knife[id] = 0;

public plugin_precache() {
    for(int i = 0; i <= charsmax(precache_list); i++)
            precache_model(precache_list[i]);
}
public knife_menu(id) {

    new menu = menu_create("\yKnife Menu:","cmdKnifesMenu");
    menu_additem(menu,"\wKarambit Knife","",0);
    menu_setprop(menu,MPROP_EXIT,MEXIT_ALL);
    menu_display(id,menu,0);
    
    return PLUGIN_HANDLED;

}
public cmdKnifesMenu(id,menu,item) {
    switch(item) {
        case 0: {
            knife[id] = 1;
            client_printc(id, "%s You have selected !gKarambit Knife!", PREFIX);
        }
    }
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
public set_model(id) {
    if(is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE ) {
        new x = knife[id];
        switch(x) {
            case 1: {
                set_pev(id, pev_viewmodel2, v_karambitknife);
                set_pev(id, pev_weaponmodel2, p_karambitknife);
            }

        }
    }
}

stock client_printc(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!g", "^x04"); // Green Color
    replace_all(msg, 190, "!n", "^x01"); // Default Color
    replace_all(msg, 190, "!t", "^x03"); // Team Color
    
    if (id) players[0] = id; else get_players(players, count, "ch");
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
[ 10] unknown unknown unknown knifemenu bad load

Last edited by itoxicreal; 05-31-2020 at 23:42.
itoxicreal is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-01-2020 , 07:36   Re: Knife menu
Reply With Quote #9

@Supremache - you're once again trying to ruin a good plugin by creating a terrible alternative and suggesting other people to use it. 70% of your code is plain bad. Please learn how to write proper plugins before trying to recreate something that has already been done. Not only you hardcoded everything in the .sma file, but you didn't even use variables/defines to store the strings you use on 5 different places.

You didn't remember anything I explained to you previously. You're still using is_user_connected() and is_user_alive() in the same place even though I told you multiple times that is_user_alive() contains is_user_connected(). You're checking the same thing twice.

The "CurWeapon" function has an argument that lets you specify which weapon should tirgger it. You're using get_user_weapon() which is redundant. Also, how can the user change his weapon if he's not connected or not alive?

Code:
new x = knife[id];         switch(x) {             case 1: {

Why is all of this needed? There is only 1 knife in the menu and a simple if-check doesn't require "switch" nor unnecessary variables. Where is the default knife?

Why did you include cstrike, fun and hamsandwich?

Code:
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL);

Again - why? This is already the default behavior for menus.

The knife skin won't even update when you select it until you change your weapon.

@itoxicreal - just use the plugin I provided. There's no point in using poorly written plugins.
__________________

Last edited by OciXCrom; 06-01-2020 at 07:42.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
alferd
Veteran Member
Join Date: Dec 2019
Old 06-01-2020 , 08:17   Re: Knife menu
Reply With Quote #10

Quote:
Originally Posted by Supremache View Post
Simple + With One Knife

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

#define int new
/*--------------------------------*/
new const PREFIX[] = { "!g[KnifeMenu]" };
/*--------------------------------*/

new knife[33];
new 
precache_list[][] = {"models/knifemenu/v_karambit.mdl","models/knifemenu/p_karambit.mdl"};

new 
v_karambitknife[55] = {"models/knifemenu/v_karambit.mdl"};
new 
p_karambitknife[55] = {"models/knifemenu/p_karambit.mdl"};

public 
plugin_init() {
    
    
register_plugin("KnifeMenu","1.0","MrAbdoO")
    
register_clcmd("say /knife","knife_menu");
    
register_event("CurWeapon","set_model","be","1=1");
}

public 
client_putinserver(idknife[id] = 0;

public 
plugin_precache() {
    for(
int i 0<= charsmax(precache_list); i++)
            
precache_model(precache_list[i]);
}
public 
knife_menu(id) {

    new 
menu menu_create("\yKnife Menu:","cmdKnifesMenu");
    
menu_additem(menu,"\wKarambit Knife","",0);
    
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL);
    
menu_display(id,menu,0);
    
    return 
PLUGIN_HANDLED;

}
public 
cmdKnifesMenu(id,menu,item) {
    switch(
item) {
        case 
0: {
            
knife[id] = 1;
            
client_printc(id"%s You have selected !gKarambit Knife!"PREFIX);
        }
    }
    
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
}
public 
set_model(id) {
    if(
is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE ) {
        new 
knife[id];
        switch(
x) {
            case 
1: {
                
set_pev(idpev_viewmodel2v_karambitknife);
                
set_pev(idpev_weaponmodel2p_karambitknife);
            }

        }
    }
}

stock client_printc(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

PHP Code:
#include <cromchat>

new knife[33], on_off[32];

public 
plugin_init() {
    
    
register_clcmd("say /knife""knifee");
}

public 
knifee(id)
{
    if(
on_off[id])
    {
        
knife[id] = false;
        
        
CC_SendMessage(id"&x05Knife Skin : &x04OFF");
    }
    
    else
    {
        
knife[id] = true;
        
        
CC_SendMessage(id"&x05Knife Skin : &x04ON");
    }
    
    return 
PLUGIN_CONTINUE;

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <cromchat>

new knife[33], on_off[32];
new 
precache_list[][] = {"models/knifemenu/v_karambit.mdl","models/knifemenu/p_karambit.mdl"};

new 
v_karambitknife[55] = {"models/knifemenu/v_karambit.mdl"};
new 
p_karambitknife[55] = {"models/knifemenu/p_karambit.mdl"};

public 
plugin_init() {
    
    
register_plugin("KnifeMenu","1.0","MrAbdoO")
    
register_clcmd("say /knife","knifee");
    
register_event("CurWeapon","set_model","be","1=1");
}

public 
client_putinserver(id)
{
    
knife[id] = false;
}

public 
plugin_precache()
{
    for(
int i 0<= charsmax(precache_list); i++)
            
precache_model(precache_list[i]);
}

public 
knifee(id)
{
    if( 
on_off[id] )
    {
        
knife[id] = false;
        
        
CC_SendMessage(id"&x05Knife Skin : &x04OFF");
    }
    
    else
    {
        
knife[id] = true;
        
        
CC_SendMessage(id"&x05Knife Skin : &x04ON");
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
set_model(id)
{
    if(
is_user_connected(id) && is_user_alive(id) && knife[id] &&  get_user_weapon(id) == CSW_KNIFE ) {
                
set_pev(idpev_viewmodel2v_karambitknife);
                
set_pev(idpev_weaponmodel2p_karambitknife);

    }


Last edited by alferd; 06-01-2020 at 08:29.
alferd is offline
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 05:42.


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