Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP] Nice Owner Menu [18/06/2015]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Linkin Hisoka
Senior Member
Join Date: Sep 2014
Location: Morocco, Marrakesh
Old 06-18-2015 , 16:33   [ZP] Nice Owner Menu [18/06/2015]
Reply With Quote #1

Owner Menu


Description :

Type Say /owner to open owner menu
case 1 Give Ammopacks menu
case 2 Reset Ammopacks to player
case 3 Show player ammopack

PHP Code:
/*================================================================================

-----------------------
-*- [UP] Ammo Packs -*-
-----------------------

This plugin is part of Zombie Plague Mod and is distributed under the
terms of the GNU General Public License. Check ZP_ReadMe.txt for details.

================================================================================*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zp50_core>
#include <colorchat>

#define is_user_valid(%1) (1 <= %1 <= g_MaxPlayers)

#define TASK_HIDEMONEY 100
#define ID_HIDEMONEY (taskid - TASK_HIDEMONEY)

// CS Player PData Offsets (win32)
const PDATA_SAFE 2
const OFFSET_CSMONEY 115

const HIDE_MONEY_BIT = (1<<5)

#define MAXPLAYERS 32

new g_MaxPlayers
new g_MsgHideWeapong_MsgCrosshair
new g_AmmoPacks[MAXPLAYERS+1]
new 
g_iTarget[33]


new 
cvar_starting_ammo_packscvar_disable_money

public plugin_init()
{
    
register_plugin("[UP] Ammo Packs"ZP_VERSION_STRING"ZP Dev Team")
    
register_clcmd("say /showammo""cmd_showammo")
    
    
register_clcmd("cmd_reset""Reset_Menu",ADMIN_IMMUNITY)
    
register_clcmd("cmd_give""Donate_Menu",ADMIN_IMMUNITY)
    
register_clcmd"gives""CmdDonate",ADMIN_IMMUNITY)
    
    
g_MaxPlayers get_maxplayers()
    
g_MsgHideWeapon get_user_msgid("HideWeapon")
    
g_MsgCrosshair get_user_msgid("Crosshair")
    
    
cvar_starting_ammo_packs register_cvar("zp_starting_ammo_packs""5")
    
cvar_disable_money register_cvar("zp_disable_money""0")
    
    
register_event("ResetHUD""event_reset_hud""be")
    
register_message(get_user_msgid("Money"), "message_money")
}

public 
plugin_natives()
{
    
register_library("zp50_ammopacks")
    
register_native("zp_ammopacks_get""native_ammopacks_get")
    
register_native("zp_ammopacks_set""native_ammopacks_set")
}

public 
native_ammopacks_get(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_valid(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return -
1;
    }
    
    return 
g_AmmoPacks[id];
}

public 
native_ammopacks_set(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_valid(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    new 
amount get_param(2)
    
    
g_AmmoPacks[id] = amount
    
return true;
}

public 
client_putinserver(id)
{
    
g_AmmoPacks[id] = get_pcvar_num(cvar_starting_ammo_packs)
}

public 
client_disconnect(id)
{
    
remove_task(id+TASK_HIDEMONEY)
}

public 
event_reset_hud(id)
{
    
// Hide money?
    
if (get_pcvar_num(cvar_disable_money))
        
set_task(0.1"task_hide_money"id+TASK_HIDEMONEY)
}

// Hide Player's Money Task
public task_hide_money(taskid)
{
    
// Hide money
    
message_begin(MSG_ONEg_MsgHideWeapon_ID_HIDEMONEY)
    
write_byte(HIDE_MONEY_BIT// what to hide bitsum
    
message_end()
    
    
// Hide the HL crosshair that's drawn
    
message_begin(MSG_ONEg_MsgCrosshair_ID_HIDEMONEY)
    
write_byte(0// toggle
    
message_end()
}

public 
message_money(msg_idmsg_destmsg_entity)
{
    
// Disable money setting enabled?
    
if (!get_pcvar_num(cvar_disable_money))
        return 
PLUGIN_CONTINUE;
    
    
fm_cs_set_user_money(msg_entity0)
    return 
PLUGIN_HANDLED;
}

// Set User Money
stock fm_cs_set_user_money(idvalue)
{
    
// Prevent server crash if entity's private data not initalized
    
if (pev_valid(id) != PDATA_SAFE)
        return;
    
    
set_pdata_int(idOFFSET_CSMONEYvalue)
}
public 
cmd_showammo(id){
    static 
opcion[64]
    
    
formatex(opcioncharsmax(opcion),"Show Players AmmoPacks :")
    new 
iMenu menu_create(opcion"Handleammo")
    
    new 
players[32], pnumtempid
    
new szName[32], szTempid[10]
    
    
get_players(playerspnum"ch")
    
    for( new 
ii<pnumi++ )
    {
        
        
tempid players[i]
        
        
get_user_name(tempidszName31)
        
num_to_str(tempidszTempid9)
        
        
formatex(opcion,127,"%s - \y[\r%i AmmoPacks\y]",szNameg_AmmoPacks[tempid]);
        
menu_additem(iMenuopcionszTempid0)
    }
    
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
Handleammo(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], name[64]
    new 
accesscallback
    
    menu_item_getinfo 
(menuitemaccessdata5name63callback)
    new 
tempid str_to_num (data)
    
    new 
szName[33], szPlayerName[33]
    
    
get_user_name(idszName32)
    
get_user_name(tempidszPlayerName32)
    
    
ColorChat(idGREEN"^4[ZP] ^1Player ^4%s ^1Have ^4%i ^1AmmoPacks!"szPlayerNameg_AmmoPacks[tempid])
    
    
cmd_showammo(id);
    
    return 
PLUGIN_CONTINUE
}

public 
Donate_Menu(idlevelcid)
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;    
        
    new 
iMenu menu_create("[ZP] Give AmmoPack to Players Menu""handleDonate");
        
    new 
iPlayers[32], szName[32], szKey[3], iNumiPlayer;
    
get_players(iPlayersiNum,"ch");
        
    for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
            
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
get_user_name(iPlayerszNamecharsmax(szName));
            
        
menu_additem(iMenuszNameszKey);
    }
        
    
menu_setprop(iMenuMPROP_EXITNAME"Back");
    
menu_display(idiMenu0);
    
    return 
PLUGIN_CONTINUE;
}
public 
handleDonate(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
szData[6], iAccessiCallback;
    
menu_item_getinfo(menuitemiAccessszDatacharsmax(szData), __iCallback);
    
    
g_iTarget[id] = str_to_num(szData);
    new 
szName[32];
    
get_user_name(g_iTarget[id], szNamecharsmax(szName));
    
    
client_cmd(id"messagemode gives");
    return 
PLUGIN_HANDLED;
}

public 
CmdDonate(idlevelcid)
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;    
        
    new 
szArg[5];
    
read_argv(1szArgcharsmax(szArg));
        
    new 
iValue str_to_num(szArg);
    new 
iTarget g_iTarget[id];
    
    
g_AmmoPacks[iTarget] += iValue
    
    
new szName[2][32];
    
get_user_name(iTargetszName[0], charsmax(szName[]));
    
get_user_name(idszName[1], charsmax(szName[]));
        
    
ColorChat(idGREEN"[ZP] ^1you gives ^4%i ^1AmmoPacks to player ^4%s"iValueszName[0]);
    
ColorChat(iTargetGREEN"[ZP] ^1owner ^4%s ^1gives you ^4%i ^1AmmoPack."szName[1], iValue);
        
        
    
    
    return 
PLUGIN_HANDLED;
}
public 
Reset_Menu(idlevelcid)
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;    
        
    new 
iMenu menu_create("[ZP] Reset AmmoPacks to Players Menu""handleReset");
        
    new 
iPlayers[32], szName[32], szKey[3], iNumiPlayer;
    
get_players(iPlayersiNum,"ch");
        
    for( new 
iiNumi++ )
    {
        
iPlayer iPlayers[i];
            
        
num_to_str(iPlayerszKeycharsmax(szKey));
        
get_user_name(iPlayerszNamecharsmax(szName));
            
        
menu_additem(iMenuszNameszKey);
    }
        
    
menu_setprop(iMenuMPROP_EXITNAME"Back");
    
menu_display(idiMenu0);
        
    return 
PLUGIN_CONTINUE;
}
public 
handleReset(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
szData[6], iAccessiCallback;
    
menu_item_getinfo(menuitemiAccessszDatacharsmax(szData), __iCallback);
    
    
g_iTarget[id] = str_to_num(szData);
    new 
iTarget g_iTarget[id];
    
    
g_AmmoPacks[iTarget] = 0
    
    
new szName[2][32];
    
get_user_name(iTargetszName[0], charsmax(szName[]));
    
get_user_name(idszName[1], charsmax(szName[]));
    
    
ColorChat(idGREEN"^3[ZP] ^1you reset AmmoPacks to player ^4%s"szName[0]);
    
ColorChat(iTargetGREEN"^3[ZP] ^1owner ^4%s ^1reset your AmmoPacks."szName[1]);
    
    return 
PLUGIN_HANDLED;

Ramadan Mubarak ^^
Attached Files
File Type: sma Get Plugin or Get Source (owner.sma - 638 views - 1.2 KB)
File Type: sma Get Plugin or Get Source (zp50_ammopacks.sma - 656 views - 7.6 KB)
__________________
Moroccan and proud

Last edited by Linkin Hisoka; 06-19-2015 at 11:21.
Linkin Hisoka is offline
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 06-18-2015 , 21:47   Re: [ZP] Nice Owner Menu [18/06/2015]
Reply With Quote #2

Nice plug +karma
__________________
Invisible System | 100%
ـــــــــــــــــــــــــــــ
Anti setinfo check | Ez Plugin and lite
ـــــــــــــــــــــــــــــ
[ZP] Free VIP Menu | Free VIP menu | ZP-Mod |
Dr Zayd is offline
Linkin Hisoka
Senior Member
Join Date: Sep 2014
Location: Morocco, Marrakesh
Old 06-18-2015 , 22:13   Re: [ZP] Nice Owner Menu [18/06/2015]
Reply With Quote #3

ok tnx
__________________
Moroccan and proud
Linkin Hisoka is offline
RiFGanG
Member
Join Date: May 2015
Location: AL-Houceïma, Morroco
Old 06-23-2015 , 10:52   Re: [ZP] Nice Owner Menu [18/06/2015]
Reply With Quote #4

Nice Plugin
__________________
AL-Houceïma

[RiF#GanG] - [RiF#BoYs] - [Bario#Briro] - [Morroco]
RiFGanG is offline
Linkin Hisoka
Senior Member
Join Date: Sep 2014
Location: Morocco, Marrakesh
Old 07-16-2015 , 18:40   Re: [ZP] Nice Owner Menu [18/06/2015]
Reply With Quote #5

Tnx ..
__________________
Moroccan and proud
Linkin Hisoka is offline
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 09-07-2015 , 10:45   Re: [ZP] Nice Owner Menu [18/06/2015]
Reply With Quote #6

Nice One
Dr Zayd 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 19:46.


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