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

2 or more the same weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-14-2023 , 05:19   Re: 2 or more the same weapons
Reply With Quote #11

Quote:
Originally Posted by QuickDroLLL View Post
EDIT: the code is not working
is it can be allowed on knife ?
Any error Logs?
HTML Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("say /test", "CmdAwp");
}

bool:IsPlayerHoldingAWP(id) {
    new weapon = pev(id, pev_weaponmodel);
    new classname[32];
    get_weaponname(weapon, classname, sizeof(classname));

    if (equal(classname, "models/w_awp.mdl") || equal(classname, "models/v_awp.mdl")) {
        return true;
    }
    return false;
}

public CmdAwp(id) {
    if (is_user_connected(id) && is_user_alive(id)) {
        if (!IsPlayerHoldingAWP(id)) {
            GivePlayerAWP(id);
            client_print(id, print_chat, "You received two AWP.");
        } else {
            client_print(id, print_chat, "You already have an AWP.");
        }
    }
    return PLUGIN_HANDLED;
}

public GivePlayerAWP(id) {
    give_item(id, "weapon_awp");
    give_item(id, "weapon_awp");
}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 05-14-2023 , 06:17   Re: 2 or more the same weapons
Reply With Quote #12

Quote:
Originally Posted by Fuck For Fun View Post
Any error Logs?
HTML Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("say /test", "CmdAwp");
}

bool:IsPlayerHoldingAWP(id) {
    new weapon = pev(id, pev_weaponmodel);
    new classname[32];
    get_weaponname(weapon, classname, sizeof(classname));

    if (equal(classname, "models/w_awp.mdl") || equal(classname, "models/v_awp.mdl")) {
        return true;
    }
    return false;
}

public CmdAwp(id) {
    if (is_user_connected(id) && is_user_alive(id)) {
        if (!IsPlayerHoldingAWP(id)) {
            GivePlayerAWP(id);
            client_print(id, print_chat, "You received two AWP.");
        } else {
            client_print(id, print_chat, "You already have an AWP.");
        }
    }
    return PLUGIN_HANDLED;
}

public GivePlayerAWP(id) {
    give_item(id, "weapon_awp");
    give_item(id, "weapon_awp");
}
The problem is not on compilng the problem in the server when i type /test nothing happend
QuickDroLLL is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-14-2023 , 07:47   Re: 2 or more the same weapons
Reply With Quote #13

Quote:
Originally Posted by QuickDroLLL View Post
The problem is not on compilng the problem in the server when i type /test nothing happend
The function bool IsPlayerHoldingAWP(id) is written more correctly.
I used the get_pdata_int function to get the ID of the weapon left in the player's hand, then the get_weaponname function to check if the weapon left is an AWP.
The public GivePlayerAWP(id) function returns data, so I changed its title to a static function and added the word void before the title to indicate that it doesn't return data.
i added logs amx for it
HTML Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta_util>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("say /test", "CmdAwp");
}

public CmdAwp(id) {
    if (is_user_alive(id)) {
        if (!IsPlayerHoldingAWP(id)) {
            GivePlayerAWP(id);
            client_print(id, print_chat, "You received two AWP.");
            log_amx("Player %d received two AWP.", id);
        } else {
            client_print(id, print_chat, "You already have an AWP.");
            log_amx("Player %d already has an AWP.", id);
        }
    } else {
        client_print(id, print_chat, "You must be alive to use this command.");
        log_amx("Player %d tried to use the AWP command while dead.", id);
    }
    return PLUGIN_HANDLED;
}

public GivePlayerAWP(id) {
    strip_user_weapons(id);
    give_item(id, "weapon_awp");
    give_item(id, "weapon_awp");
}

public bool:IsPlayerHoldingAWP(id)
{
    new weapon[32];
    get_weaponname(id, weapon, charsmax(weapon));
    if (equal(weapon, "weapon_awp")) {
        return true;
    }
    return false;
}

Last edited by Fuck For Fun; 05-14-2023 at 10:25.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 05-14-2023 , 10:01   Re: 2 or more the same weapons
Reply With Quote #14

Quote:
Originally Posted by Fuck For Fun View Post
The function bool IsPlayerHoldingAWP(id) is written more correctly.
I used the get_pdata_int function to get the ID of the weapon left in the player's hand, then the get_weaponname function to check if the weapon left is an AWP.
The public GivePlayerAWP(id) function returns data, so I changed its title to a static function and added the word void before the title to indicate that it doesn't return data.
i added logs amx for it
HTML Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta_util>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("say /test", "CmdAwp");
}

public CmdAwp(id) {
    if (is_user_alive(id)) {
        if (!IsPlayerHoldingAWP(id)) {
            GivePlayerAWP(id);
            client_print(id, print_chat, "You received two AWP.");
            log_amx("Player %d received two AWP.", id);
        } else {
            client_print(id, print_chat, "You already have an AWP.");
            log_amx("Player %d already has an AWP.", id);
        }
    } else {
        client_print(id, print_chat, "You must be alive to use this command.");
        log_amx("Player %d tried to use the AWP command while dead.", id);
    }
    return PLUGIN_HANDLED;
}

public GivePlayerAWP(id) {
    strip_user_weapons(id);
    give_item(id, "weapon_awp");
    give_item(id, "weapon_awp");
}

public bool:IsPlayerHoldingAWP(id)
{
    new weapon[32];
    /*get_user_weapon(id, weapon, sizeof(weapon));*/
    get_user_weapon(charsmax(weapon));
    if (equal(weapon, "weapon_awp")) {
        return true;
    }
    return false;
}
EDIT: its not working again when i type /test i get the awp but only one and i cant change my weapons for example i want change to knife i cant and when i drop the awp the server crashes

Last edited by QuickDroLLL; 05-14-2023 at 10:07.
QuickDroLLL is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-14-2023 , 10:17   Re: 2 or more the same weapons
Reply With Quote #15

Quote:
Originally Posted by QuickDroLLL View Post
EDIT: its not working again when i type /test i get the awp but only one and i cant change my weapons for example i want change to knife i cant and when i drop the awp the server crashes
Lol You're confusing me when you say it doesn't work at all, the plugin works only you don't get 2 weapons? Maybe it has to do with something on the server that doesn't allow you to do that

i edit my last post:
added log / strip

Last edited by Fuck For Fun; 05-14-2023 at 10:25.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 05-14-2023 , 11:34   Re: 2 or more the same weapons
Reply With Quote #16

Quote:
Originally Posted by Fuck For Fun View Post
Lol You're confusing me when you say it doesn't work at all, the plugin works only you don't get 2 weapons? Maybe it has to do with something on the server that doesn't allow you to do that

i edit my last post:
added log / strip
bro its not working and the server is simple no plugins are loaded its for testing i think its imposbile to have two same weapons
QuickDroLLL is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 05-14-2023 , 12:20   Re: 2 or more the same weapons
Reply With Quote #17

Quote:
Originally Posted by Fuck For Fun View Post
Lol You're confusing me when you say it doesn't work at all, the plugin works only you don't get 2 weapons? Maybe it has to do with something on the server that doesn't allow you to do that

i edit my last post:
added log / strip
Dude there is nothing wrong with his server.
You can never give the same weapon twice with give_item.
I forgot about this thread. I’ll try to look into Orpheu this week
__________________
Jhob94 is offline
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 05-14-2023 , 12:42   Re: 2 or more the same weapons
Reply With Quote #18

Quote:
Originally Posted by Jhob94 View Post
Dude there is nothing wrong with his server.
You can never give the same weapon twice with give_item.
I forgot about this thread. I’ll try to look into Orpheu this week
ok take your time
QuickDroLLL is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-16-2023 , 06:24   Re: 2 or more the same weapons
Reply With Quote #19

You cant give a player two same weapons unless you trick the "mod" by hooking AddplayerItem and do stuff so the mod think the player doesn't have the weapon.
__________________
@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
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 05-16-2023 , 08:16   Re: 2 or more the same weapons
Reply With Quote #20

Quote:
Originally Posted by Natsheh View Post
You cant give a player two same weapons unless you trick the "mod" by hooking AddplayerItem and do stuff so the mod think the player doesn't have the weapon.
can you give full example for that ?
QuickDroLLL 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 03:44.


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