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

Help with my code / Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 03-05-2008 , 23:44   Help with my code / Plugin
Reply With Quote #1

Well me and Reaper2331 where working on a plugin before he got dumped with work.

I need someone to help me fix the two known bugs Ive figured out with this plugin.

What it does is give an awp to an admin with a certian flag when he types "amx_awpme" in console.

The two bugs are as follows: If you are holding a gun other then a deagle or a awp it will give you an awp anyways, Allowing admins to have two guns in there inventory. Also it seems the restriction does not work, people without admin can still use the amx_awpme command for a awp.


PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define PLUGIN "give awp"
#define VERSION "1.0"
#define AUTHOR "Reaper2331"

#define AMX_ADMIN_FLAG ADMIN_VOTE

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("amx_awpme","checkGuns",AMX_ADMIN_FLAG,"- Gives Admins with Flag J an Awp")
    
}
public 
checkGuns(id)
    
{

if(
is_user_admin(id) && (is_user_alive(id) && (!access(idAMX_ADMIN_FLAG))))
    
strip_user_weapons(id)
    
give_item(id,"weapon_knife")
    
give_item(id,"weapon_awp")
    
give_item(id,"ammo_338magnum")
    
give_item(id,"ammo_338magnum")
    
give_item(id,"ammo_338magnum")
    
give_item(id,"weapon_deagle")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"weapon_hegrenade")
    
give_item(id,"weapon_smokegrenade")
    
give_item(id,"weapon_flashbang")
    
give_item(id,"weapon_flashbang")
    
client_print(idprint_chat"[AMXX] You Now Have An Awp Enjoy")
    
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
hoboman
Senior Member
Join Date: Jul 2007
Old 03-06-2008 , 00:26   Re: Help with my code / Plugin
Reply With Quote #2

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

#define PLUGIN "give awp"
#define VERSION "1.0"
#define AUTHOR "Reaper2331"

#define AMX_ADMIN_FLAG ADMIN_VOTE

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_concmd("amx_awpme","checkGuns",AMX_ADMIN_FLAG,"- Gives Admins with Flag J an Awp")
    
}
public checkGuns(id, level, cid)
{
    if( !cmd_access( id, level, cid, 1 ) )
        return PLUGIN_HANDLED

    if (is_user_alive(id)
   {
    strip_user_weapons(id)
    
    give_item(id,"weapon_knife")
    give_item(id,"weapon_awp")
    give_item(id,"ammo_338magnum")
    give_item(id,"ammo_338magnum")
    give_item(id,"ammo_338magnum")
    give_item(id,"weapon_deagle")
    give_item(id,"ammo_50ae")
    give_item(id,"ammo_50ae")
    give_item(id,"ammo_50ae")
    give_item(id,"ammo_50ae")
    give_item(id,"ammo_50ae")
    give_item(id,"ammo_50ae")
    give_item(id,"ammo_50ae")
    give_item(id,"weapon_hegrenade")
    give_item(id,"weapon_smokegrenade")
    give_item(id,"weapon_flashbang")
    give_item(id,"weapon_flashbang")
    
    client_print(id, print_chat, "[AMXX] You Now Have An Awp Enjoy")
    }
    return PLUGIN_CONTINUE
}
instead of stripping all the weapons from the user it would probably make sense to check if he has a primary gun...like an awp, scout, ak47, and all the others...also next time u should post this in the scripting help forum
__________________

Last edited by hoboman; 03-06-2008 at 00:33.
hoboman is offline
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 04-27-2008 , 00:50   Re: Help with my code / Plugin
Reply With Quote #3

Alright Ive tried that, but I can still run around with multiple weapons is there something missing?
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
hoboman
Senior Member
Join Date: Jul 2007
Old 04-27-2008 , 01:21   Re: Help with my code / Plugin
Reply With Quote #4

I don't see any loop hole in my code, it should work and no player should be able to have more than two weapons. There is a typo in the code though...there should be an extra bracket ) after the "if (is_user_alive(id)"
__________________
hoboman is offline
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 05-30-2008 , 19:43   Re: Help with my code / Plugin
Reply With Quote #5

Worked great thanks alot!
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami 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:31.


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