Raised This Month: $51 Target: $400
 12% 

Knife menu


Post New Thread Reply   
 
Thread Tools Display Modes
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-01-2020 , 09:09   Re: Knife menu
Reply With Quote #11

Quote:
Originally Posted by itoxicreal View Post
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
Fixed
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <colorchat>


#define int new
/*--------------------------------*/
new const PREFIX[] = { "^x04[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<= 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;
        
ColorChat(idNORMAL"%s ^x01You have selected ^x04Karambit 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);
            }

        }
    }

Picture : https://i.ibb.co/jgSnLT3/143.png

Last edited by Supremache; 06-01-2020 at 09:17.
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-01-2020 , 09:28   Re: Knife menu
Reply With Quote #12

Quote:
Originally Posted by OciXCrom View Post
@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.
I wouldn't to open a new long discussion again If you saw my plugin is bad then tell that for who want to get my plugin.

@itoxicreal

His plugin is better than my plugin with a perfect coded but i gave you what you want " Simple + With One Knife".
You have the choice, and I do not force you to choose anything.

Last edited by Supremache; 06-01-2020 at 09:28.
Supremache is offline
itoxicreal
Senior Member
Join Date: Jun 2018
Old 06-01-2020 , 16:00   Re: Knife menu
Reply With Quote #13

Quote:
Originally Posted by OciXCrom View Post
@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.
Yes i will.Your iq is much higher than the rest and your coding is great according to many people!
itoxicreal is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-04-2020 , 22:13   Re: Knife menu
Reply With Quote #14

Quote:
Originally Posted by itoxicreal View Post
Yes i will.Your iq is much higher than the rest and your coding is great according to many people!
Idk why, but this answer is so f*ing funny to me @OciXCrom
supertrio17 is offline
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 02:27.


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