|
Senior Member
|

08-30-2009
, 13:12
register_logevent/menu_additem
|
#1
|
Hello, sorry for my english. I need you help.
Why:
register_logevent( "logevent_round_start", 2, "1=Round_Start" );
don't work on some maps, but if delete:
RegisterHam( Ham_Player_Jump, "player", "bacon_playerJumping" );
this work.
And why:
menu_additem( menu, szText, "4", 1 );
is passed? (i can click from this).
you undestand?
code of my deathrun Shop:
Code:
/* AMX Mod X script.
*
* Deathrun Shop
* Copyright (C) 2009 tuty
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
* Credits:
* --------
* - xPaw ( for menu because new amxx menu doesnt suport cvars... thank you )
* - connor ( sugestion )
*/
#include <amxmodx>
#include <money_ul>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#define PLUGIN "Deathrun Shop"
#define VERSION "2.2"
#define AUTHOR "tuty/AlexALX"
#pragma semicolon 1
#define PICKUP_SND "items/gunpickup2.wav"
#define OFFSET_MONEY 115
new gDrShopOn;
new gHeCost;
new gHe2Cost;
new gBothGrenadesCost;
new gSilentCost;
new gHealthCost;
new gArmorCost;
new gSpeedCost;
new gGravityCost;
new gInvisCost;
new gMsgMoney;
new gMaxPlayers;
new gSpeedCvar;
new gGravityCvar;
new gJetCost;
new gJetTime;
new gDeagleCost;
new gAdvertiseCvar;
new gHealthPointCvar;
new gArmorPointCvar;
new gAdvertiseTimeCvar;
new HasHe[ 33 ];
new HasHe2[ 33 ];
new HasBothGren[ 33 ];
new HasSilent[ 33 ];
new HasHealth[ 33 ];
new HasArmor[ 33 ];
new HasSpeed[ 33 ];
new HasGravity[ 33 ];
new HasInvis[ 33 ];
new bool:bSilent[ 33 ];
new HasJet[ 33 ];
new HasNoclip[ 33 ];
new HasDeagle[ 33 ];
new gJetSprite;
new gWhave;
new gNoclipCost;
new gNoclipTime;
const KEYS_M = MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_9;
new drshop_gren = 1, drshop_grenh = 1, drshop_lj = 1, drshop_silent = 1, drshop_hp = 1, drshop_ap = 1, drshop_speed = 1, drshop_grav = 1, drshop_invis = 1, drshop_jet = 1, drshop_noclip = 1, drshop_deagle = 1;
enum
{
CS_TEAM_UNASSIGNED = 0,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
}
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_cvar( "drshop_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
//register_forward( FM_PlayerPreThink, "forward_player_prethink" );
register_logevent( "logevent_round_start", 2, "1=Round_Start" );
register_event( "DeathMsg", "Hook_Deathmessage", "a" );
RegisterHam( Ham_Player_Jump, "player", "bacon_playerJumping" );
register_clcmd( "say /drshop", "DeathrunShopD" );
register_clcmd( "say_team /drshop", "DeathrunShopD" );
register_clcmd( "say drshop", "DeathrunShopD" );
register_clcmd( "say_team drshop", "DeathrunShopD" );
register_clcmd( "/drshop", "DeathrunShop" );
register_clcmd( "drshop", "DeathrunShop" );
register_clcmd( "say /shop", "DeathrunShopD" );
register_clcmd( "say_team /shop", "DeathrunShopD" );
register_clcmd( "say shop", "DeathrunShopD" );
register_clcmd( "say_team shop", "DeathrunShopD" );
register_clcmd( "/shop", "DeathrunShop" );
register_clcmd( "shop", "DeathrunShop" );
register_clcmd( "amx_invis", "cmd_invis", ADMIN_BAN, "<nick or #userid>");
register_menucmd( register_menuid( "Deathrun Shop" ), KEYS_M, "menu_shop" );
//register_clcmd( "amx_shop", "cmd_shop", ADMIN_BAN, "<option> <on/off>");
gDrShopOn = register_cvar( "deathrun_shop", "1" );
gHeCost = register_cvar( "deathrun_he_cost", "1500" );
gHe2Cost = register_cvar( "deathrun_he2_cost", "2500" );
gBothGrenadesCost = register_cvar( "deathrun_bothgrenades_cost", "8000" );
gSilentCost = register_cvar( "deathrun_silent_cost", "3000" );
gHealthCost = register_cvar( "deathrun_health_cost", "4000" );
gArmorCost = register_cvar( "deathrun_armor_cost", "4000" );
gSpeedCost = register_cvar( "deathrun_speed_cost", "8000" );
gGravityCost = register_cvar( "deathrun_gravity_cost", "8000" );
gInvisCost = register_cvar( "deathrun_invisibility_cost", "10000" );
gSpeedCvar = register_cvar( "deathrun_speed_power", "350.0" );
gGravityCvar = register_cvar( "deathrun_gravity_power", "0.5" );
gAdvertiseCvar = register_cvar( "deathrun_advertise_message", "1" );
gHealthPointCvar = register_cvar( "deathrun_health_points", "255" );
gArmorPointCvar = register_cvar( "deathrun_armor_points", "255" );
gAdvertiseTimeCvar = register_cvar( "deathrun_advertise_time", "7.0" );
gJetTime = register_cvar( "deathrun_jetpack_duration", "15" );
gJetCost = register_cvar( "deathrun_jetpack_cost", "10000" );
gNoclipTime = register_cvar( "deathrun_noclip_duration", "5" );
gNoclipCost = register_cvar( "deathrun_noclip_cost", "12000" );
gDeagleCost = register_cvar( "deathrun_deagle_cost", "10000" );
gMsgMoney = get_user_msgid( "Money" );
gMaxPlayers = get_maxplayers();
register_dictionary( "deathrunshop.txt" );
new szMapName[ 64 ];
get_mapname( szMapName, 63 );
if( equal( szMapName, "deathrun_W0RMS" ) || equal( szMapName, "deathrun_tehnology_final" ) || equal( szMapName, "deathrun_moops" ) || equal( szMapName, "deathrun_proz_final" ) || equal( szMapName, "deathrun_spacebase" ) || equal( szMapName, "deathrun_laboratory" ) ) {
drshop_lj = 0;
}
if( equal( szMapName, "deathrun_paradise" ) || equal( szMapName, "deathrun_m4a1_beta2" ) ) {
drshop_hp = 0;
}
if( equal( szMapName, "deathrun_paradise" ) || equal( szMapName, "deathrun_m4a1_beta2" ) ) {
drshop_ap = 0;
}
if( contain( szMapName, "deathrun_labirint" ) != -1 || equal( szMapName, "deathrun_spacebase" ) || equal( szMapName, "deathrun_laboratory" ) ) {
drshop_speed = 0;
}
if( equal( szMapName, "deathrun_W0RMS" ) || equal( szMapName, "deathrun_paradise" ) || equal( szMapName, "deathrun_meadsy_final" ) || equal( szMapName, "deathrun_ryb_final" ) || equal( szMapName, "deathrun_trumavarium" )) {
drshop_grav = 0;
}
if( equal( szMapName, "Deathrun_aquarium_final" ) || equal( szMapName, "deathrun_famouz" ) || equal( szMapName, "deathrun_fs-facility" ) || equal( szMapName, "deathrun_ice" ) || equal( szMapName, "deathrun_proz_final" ) || equal( szMapName, "deathrun_spacebase" ) || equal( szMapName, "deathrun_laboratory" ) ) {
drshop_grav = 0;
}
}
public plugin_precache()
{
gJetSprite = precache_model( "sprites/explode1.spr" );
gWhave = precache_model( "sprites/shockwave.spr" );
precache_sound( PICKUP_SND );
}
public plugin_cfg()
{
if( get_pcvar_num( gDrShopOn ) != 0 )
{
new iCfgDir[ 32 ], iFile[ 192 ];
get_configsdir( iCfgDir, charsmax( iCfgDir ) );
formatex( iFile, charsmax( iFile ), "%s/deathrun_shop.cfg", iCfgDir );
if( !file_exists( iFile ) )
{
server_print( "*** File %s doesn't exist! ***", iFile );
server_print( "*** Creating a deafult Configuration file! ***" );
write_file( iFile, "// DeathrunShop Configuration file!" );
write_file( iFile, "// visit http://forums.alliedmods.net/showthread.php?t=87536 for info!" );
write_file( iFile, "// You can edit the cvars like u want :D" );
write_file( iFile, " " );
write_file( iFile, " " );
write_file( iFile, "// DeathrunShop enabled? Set 0 to disable de plugin" );
write_file( iFile, "deathrun_shop ^"1^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for single he grenade item" );
write_file( iFile, "deathrun_he_cost ^"2500^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for both grenades. FB+SM" );
write_file( iFile, "deathrun_bothgrenades_cost ^"5000^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for both grenades. HE" );
write_file( iFile, "deathrun_he2_cost ^"3000^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for silent-footsteps" );
write_file( iFile, "deathrun_silent_cost ^"4000^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for Health Points item" );
write_file( iFile, "deathrun_health_cost ^"6000^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for Armor Points item" );
write_file( iFile, "deathrun_armor_cost ^"6000^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for Speed item" );
write_file( iFile, "deathrun_speed_cost ^"16000^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for Gravity item" );
write_file( iFile, "deathrun_gravity_cost ^"8000^"" );
write_file( iFile, " " );
write_file( iFile, "// Cost for invisibility item. Only terrorist's can have this item!" );
write_file( iFile, "deathrun_invisibility_cost ^"16000^"" );
write_file( iFile, " " );
write_file( iFile, "// Set here the speed power. Default 400.0" );
write_file( iFile, "deathrun_speed_power ^"400.0^"" );
write_file( iFile, " " );
write_file( iFile, "// Set here the gravity power. Default is 0.5" );
write_file( iFile, "deathrun_gravity_power ^"0.5^"" );
write_file( iFile, " " );
write_file( iFile, "// Enable / disable the advertise message when a player join the server" );
write_file( iFile, "// Default is 1" );
write_file( iFile, "deathrun_advertise_message ^"1^"" );
write_file( iFile, " " );
write_file( iFile, "// Set here the Health Points. Default 255" );
write_file( iFile, "deathrun_health_points ^"255^"" );
write_file( iFile, " " );
write_file( iFile, "// Set here the Armor Points. Default 255" );
write_file( iFile, "deathrun_armor_points ^"255^"" );
write_file( iFile, " " );
write_file( iFile, "// Set here the advertise message time. Default is 7.0" );
write_file( iFile, "deathrun_advertise_time ^"7.0^"" );
write_file( iFile, " " );
}
server_cmd( "exec %s", iFile );
}
}
/*
public cmd_shop(id, level, cid) {
new flags[32] = "g";
if (!cmd_access(id, level, cid, 1) || !is_user_admin(id) || !has_flag(id,flags))
return PLUGIN_HANDLED;
new arg[32],arg2[32];
read_argv(1, arg, 31);
read_argv(2, arg2, 31);
if (arg[0] == '1') {
if (arg2[0] == 0)
drshop_gren = 0;
else
drshop_gren = 1;
} else if (arg[0] == '2') {
if (arg2[0] == 0)
drshop_grenh = 0;
else
drshop_grenh = 1;
} else if (arg[0] == '3') {
if (arg2[0] == 0)
drshop_lj = 0;
else
drshop_lj = 1;
} else if (arg[0] == '4') {
if (arg2[0] == 0)
drshop_silent = 0;
else
drshop_silent = 1;
} else if (arg[0] == '5') {
if (arg2[0] == 0)
drshop_hp = 0;
else
drshop_hp = 1;
} else if (arg[0] == '6') {
if (arg2[0] == 0)
drshop_ap = 0;
else
drshop_ap = 1;
} else if (arg[0] == '7') {
if (arg2[0] == 0)
drshop_speed = 0;
else
drshop_speed = 1;
} else if (arg[0] == '8') {
if (arg2[0] == 0)
drshop_grav = 0;
else
drshop_grav = 1;
} else if (arg[0] == '9') {
if (arg2[0] == 0)
drshop_invis = 0;
else
drshop_invis = 1;
} else if (arg[0] == '0') {
if (arg2[0] == 0)
drshop_jet = 0;
else
drshop_jet = 1;
}
} */
public client_connect( id )
{
HasHe[ id ] = false;
HasHe2[ id ] = false;
HasBothGren[ id ] = false;
HasSilent[ id ] = false;
HasHealth[ id ] = false;
HasArmor[ id] = false;
HasSpeed[ id ] = false;
HasGravity[ id ] = false;
HasInvis[ id ] = false;
HasJet[ id ] = false;
HasNoclip[ id ] = false;
HasDeagle[ id ] = false;
}
public client_disconnect( id )
{
bSilent[ id ] = false;
HasHe[ id ] = false;
HasHe2[ id ] = false;
HasBothGren[ id ] = false;
HasSilent[ id ] = false;
HasHealth[ id ] = false;
HasArmor[ id] = false;
HasSpeed[ id ] = false;
HasGravity[ id ] = false;
HasInvis[ id ] = false;
HasJet[ id ] = false;
HasNoclip[ id ] = false;
HasDeagle[ id ] = false;
}
public client_putinserver( id )
{
if( get_pcvar_num( gAdvertiseCvar ) != 0 )
{
set_task( get_pcvar_float( gAdvertiseTimeCvar ), "ShowPlayerInfo", id );
}
}
/*
public forward_player_prethink( id )
{
if( bSilent[ id ] )
{
set_pev( id, pev_flTimeStepSound, 999 );
}
}*/
public DeathrunShopD( id )
{
if( get_pcvar_num( gDrShopOn ) != 1 )
{
client_print( id, print_chat, "%L", id, "DRSHOP_DISABLED" );
return PLUGIN_HANDLED;
}
client_print( id, print_chat, "%L", id, "DRSHOP_CONSOLE" );
return PLUGIN_HANDLED;
}
/*
public DeathrunShop( id )
{
if( get_pcvar_num( gDrShopOn ) != 1 )
{
client_print( id, print_chat, "%L", id, "DRSHOP_DISABLED" );
return PLUGIN_HANDLED;
}
if( !is_user_alive( id ) )
{
client_print( id, print_chat, "%L", id, "DRSHOP_ONLY_ALIVE" );
return PLUGIN_HANDLED;
}
new szBuffer[ 512 ], iLen, keys = MENU_KEY_0|MENU_KEY_9;
iLen = formatex( szBuffer, charsmax( szBuffer ), "\rDeathrun Shop \yv%s^n^n", VERSION );
if (drshop_gren == 1) {
keys |= (1<<0);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r1. \w%L - \y%d$^n", id, "DRSHOP_1", get_pcvar_num( gHeCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d1. %L - %d$^n", id, "DRSHOP_1", get_pcvar_num( gHeCost ) );
}
if (drshop_grenh == 1) {
keys |= (1<<1);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r2. \w%L - \y%d$^n", id, "DRSHOP_2", get_pcvar_num( gHe2Cost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d2. %L - %d$^n", id, "DRSHOP_2", get_pcvar_num( gHe2Cost ) );
}
if (drshop_lj == 1) {
keys |= (1<<2);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r3. \w%L - \y%d$^n", id, "DRSHOP_3", get_pcvar_num( gBothGrenadesCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d3. %L - %d$^n", id, "DRSHOP_3", get_pcvar_num( gBothGrenadesCost ) );
}
if (drshop_silent == 1) {
keys |= (1<<3);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r4. \w%L - \y%d$^n", id, "DRSHOP_4", get_pcvar_num( gSilentCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d4. %L - %d$^n", id, "DRSHOP_4", get_pcvar_num( gSilentCost ) );
}
if (drshop_hp == 1) {
keys |= (1<<4);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r5. \w%L - \y%d$^n", id, "DRSHOP_5", get_pcvar_num( gHealthPointCvar ) , get_pcvar_num( gHealthCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d5. %L - %d$^n", id, "DRSHOP_5", get_pcvar_num( gHealthPointCvar ) , get_pcvar_num( gHealthCost ) );
}
if (drshop_ap == 1) {
keys |= (1<<5);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r6. \w%L - \y%d$^n", id, "DRSHOP_6", get_pcvar_num( gArmorPointCvar ), get_pcvar_num( gArmorCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d6. %L - %d$^n", id, "DRSHOP_6", get_pcvar_num( gArmorPointCvar ), get_pcvar_num( gArmorCost ) );
}
if (drshop_speed == 1) {
keys |= (1<<6);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r7. \w%L - \y%d$^n", id, "DRSHOP_7", get_pcvar_num( gSpeedCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d7. %L - %d$^n", id, "DRSHOP_7", get_pcvar_num( gSpeedCost ) );
}
if (drshop_grav == 1) {
keys |= (1<<7);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r8. \w%L - \y%d$^n", id, "DRSHOP_8", get_pcvar_num( gGravityCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d8. %L - %d$^n", id, "DRSHOP_8", get_pcvar_num( gGravityCost ) );
}
if (drshop_invis == 1) {
keys |= (1<<8);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r9. \w%L - \y%d$^n^n", id, "DRSHOP_9", get_pcvar_num( gInvisCost ) );
} else {
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\d9. %L - %d$^n^n", id, "DRSHOP_9", get_pcvar_num( gInvisCost ) );
}
keys |= (1<<9);
iLen += formatex( szBuffer[ iLen ], charsmax( szBuffer ) - iLen, "\r0. \w%L", id, "DRSHOP_0");
show_menu( id, keys, szBuffer );
return PLUGIN_CONTINUE;
} */
public DeathrunShop( id )
{
if( get_pcvar_num( gDrShopOn ) != 1 )
{
client_print( id, print_chat, "%L", id, "DRSHOP_DISABLED" );
return PLUGIN_HANDLED;
}
if( !is_user_alive( id ) )
{
client_print( id, print_chat, "%L", id, "DRSHOP_ONLY_ALIVE" );
return PLUGIN_HANDLED;
}
new szText[ 400 char ];
formatex( szText, charsmax( szText ), "\rDeathrun Shop \yv%s^n^n", VERSION );
new menu = menu_create( szText, "menu_shop" );
if (drshop_gren == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_1", get_pcvar_num( gHeCost ) );
menu_additem( menu, szText, "1", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_1d", get_pcvar_num( gHeCost ) );
menu_additem( menu, szText, "1", 1 );
}
if (drshop_grenh == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_2", get_pcvar_num( gHe2Cost ) );
menu_additem( menu, szText, "2", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_2d", get_pcvar_num( gHe2Cost ) );
menu_additem( menu, szText, "2", 1 );
}
if (drshop_lj == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_3", get_pcvar_num( gBothGrenadesCost ) );
menu_additem( menu, szText, "3", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_3d", get_pcvar_num( gBothGrenadesCost ) );
menu_additem( menu, szText, "3", _ );
}
if (drshop_silent == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_4", get_pcvar_num( gSilentCost ) );
menu_additem( menu, szText, "4", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_4d", get_pcvar_num( gSilentCost ) );
menu_additem( menu, szText, "4", 1 );
}
if (drshop_hp == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_5", get_pcvar_num( gHealthPointCvar ), get_pcvar_num( gHealthCost ) );
menu_additem( menu, szText, "5", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_5d", get_pcvar_num( gHealthPointCvar ), get_pcvar_num( gHealthCost ) );
menu_additem( menu, szText, "5", 1 );
}
if (drshop_ap == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_6", get_pcvar_num( gArmorPointCvar ), get_pcvar_num( gArmorCost ) );
menu_additem( menu, szText, "6", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_6d", get_pcvar_num( gArmorPointCvar ), get_pcvar_num( gArmorCost ) );
menu_additem( menu, szText, "6", 1 );
}
if (drshop_speed == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_7", get_pcvar_num( gSpeedCost ) );
menu_additem( menu, szText, "7", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_7d", get_pcvar_num( gSpeedCost ) );
menu_additem( menu, szText, "7", 1 );
}
if (drshop_grav == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_8", get_pcvar_num( gGravityCost ) );
menu_additem( menu, szText, "8", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_8d", get_pcvar_num( gGravityCost ) );
menu_additem( menu, szText, "8", 1 );
}
if (drshop_invis == 1 && get_user_team( id ) == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_9", get_pcvar_num( gInvisCost ) );
menu_additem( menu, szText, "9", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_9d", get_pcvar_num( gInvisCost ) );
menu_additem( menu, szText, "9", 1 );
}
if (drshop_jet == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_10", get_pcvar_num( gJetTime ), get_pcvar_num( gJetCost ) );
menu_additem( menu, szText, "10", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_10d", get_pcvar_num( gJetTime ), get_pcvar_num( gJetCost ) );
menu_additem( menu, szText, "10", 1 );
}
if (drshop_noclip == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_11", get_pcvar_num( gNoclipTime ), get_pcvar_num( gNoclipCost ) );
menu_additem( menu, szText, "11", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_11d", get_pcvar_num( gNoclipTime ), get_pcvar_num( gNoclipCost ) );
menu_additem( menu, szText, "11", 1 );
}
if (drshop_deagle == 1) {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_12", get_pcvar_num( gDeagleCost ) );
menu_additem( menu, szText, "12", 0 );
} else {
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_12d", get_pcvar_num( gDeagleCost ) );
menu_additem( menu, szText, "12", 1 );
}
/*
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_10", get_pcvar_num( gNoclipTime ), get_pcvar_num( gNoclipCost ) );
menu_additem( menu, szText, "10", 0 );
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_11", get_pcvar_num( gJetTime ), get_pcvar_num( gJetPackCost ) );
menu_additem( menu, szText, "11", 0 );
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_12", get_pcvar_num( gDeagleCost ) );
menu_additem( menu, szText, "12", 0 );
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_13", get_pcvar_num( gLongJumpTime ), get_pcvar_num( gLongJumpCost ) );
menu_additem( menu, szText, "13", 0 );
formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_14", get_pcvar_num( gGlowCost ) );
menu_additem( menu, szText, "14", 0 );
*/
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL);
new string[100],string2[100],string3[100];
formatex( string, sizeof string - 1, "%L", id, "DRSHOP_BACK" );
menu_setprop( menu, MPROP_BACKNAME, string );
formatex( string2, sizeof string2 - 1, "%L", id, "DRSHOP_NEXT" );
menu_setprop( menu, MPROP_NEXTNAME, string2 );
formatex( string3, sizeof string3 - 1, "%L", id, "DRSHOP_EXIT" );
menu_setprop( menu, MPROP_EXITNAME, string3 );
menu_display( id, menu, 0 );
return PLUGIN_CONTINUE;
}
public menu_shop( id, menu, item )
{
if( get_pcvar_num( gDrShopOn ) != 1 )
{
client_print( id, print_chat, "%L", id, "DRSHOP_DISABLED" );
return PLUGIN_HANDLED;
}
if( !is_user_alive( id ) )
{
client_print( id, print_chat, "%L", id, "DRSHOP_ONLY_ALIVE" );
return PLUGIN_HANDLED;
}
if( item == MENU_EXIT )
{
menu_destroy( menu );
//client_print( id, print_chat, "%L", id, "DRSHOP_MENU_CLOSED" );
return PLUGIN_HANDLED;
}
new data[ 6 ], iName[ 64 ], access, callback;
menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback );
new key = str_to_num( data );
new whichmoney = fm_get_user_money( id );
switch( key )
{
case 1:
{
if (drshop_gren != 1) {
return PLUGIN_HANDLED;
}
if( HasHe[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gHeCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
give_item( id, "weapon_smokegrenade" );
give_item( id, "weapon_flashbang" );
client_print( id, print_chat, "%L", id, "DRSHOP_GRENADE_ITEM" );
fm_set_user_money( id, whichmoney - get_pcvar_num( gHeCost ) );
HasHe[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 2:
{
if (drshop_grenh != 1) {
return PLUGIN_HANDLED;
}
if( HasHe2[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gHe2Cost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
give_item( id, "weapon_hegrenade" );
client_print( id, print_chat, "%L", id, "DRSHOP_HEGRENADE_ITEM" );
fm_set_user_money( id, whichmoney - get_pcvar_num( gHe2Cost ) );
HasHe2[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 3:
{
if (drshop_lj != 1) {
return PLUGIN_HANDLED;
}
if( HasBothGren[ id ] )
{
allready_have( id );
give_item( id, "item_longjump" );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gBothGrenadesCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
client_print( id, print_chat, "%L", id, "DRSHOP_BOTHGREN_ITEM" );
give_item( id, "item_longjump" );
fm_set_user_money( id, whichmoney - get_pcvar_num( gBothGrenadesCost ) );
client_sound_play( id );
HasBothGren[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 4:
{
if (drshop_silent != 1) {
return PLUGIN_HANDLED;
}
if( HasSilent[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gSilentCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
fm_set_user_footsteps( id, 1 );
client_print( id, print_chat, "%L", id, "DRSHOP_SILENTWALK_ITEM" );
fm_set_user_money( id, whichmoney - get_pcvar_num( gSilentCost ) );
client_sound_play( id );
HasSilent[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 5:
{
if (drshop_hp != 1) {
return PLUGIN_HANDLED;
}
if( HasHealth[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gHealthCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
//fm_set_user_health( id, get_user_health( id ) + get_pcvar_num( gHealthPointCvar ) );
set_user_health( id, get_user_health( id ) + get_pcvar_num( gHealthPointCvar ) );
client_print( id, print_chat, "%L", id, "DRSHOP_HEALTH_ITEM", get_pcvar_num( gHealthPointCvar ) );
fm_set_user_money( id, whichmoney - get_pcvar_num( gHealthCost ) );
client_sound_play( id );
HasHealth[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 6:
{
if (drshop_ap != 1) {
return PLUGIN_HANDLED;
}
if( HasArmor[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gArmorCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
//fm_set_user_armor( id, get_user_armor( id ) + get_pcvar_num( gArmorPointCvar ) );
set_user_armor( id, get_user_armor( id ) + get_pcvar_num( gArmorPointCvar ) );
client_print( id, print_chat, "%L", id, "DRSHOP_ARMOR_ITEM", get_pcvar_num( gArmorPointCvar ) );
fm_set_user_money( id, whichmoney - get_pcvar_num( gArmorCost ) );
client_sound_play( id );
HasArmor[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 7:
{
if (drshop_speed != 1) {
return PLUGIN_HANDLED;
}
if( HasSpeed[ id ] )
{
allready_have( id );
set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gSpeedCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
//fm_set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
client_print( id, print_chat, "%L", id, "DRSHOP_SPEED_ITEM" );
fm_set_user_money( id, whichmoney - get_pcvar_num( gSpeedCost ) );
client_sound_play( id );
set_task(2.0, "SpeedCheck",id,_,_, "b");
HasSpeed[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 8:
{
if (drshop_grav != 1) {
return PLUGIN_HANDLED;
}
if( HasGravity[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gGravityCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
set_user_gravity( id, get_pcvar_float( gGravityCvar ) );
client_print( id, print_chat, "%L", id, "DRSHOP_GRAVITY_ITEM" );
fm_set_user_money( id, whichmoney - get_pcvar_num( gGravityCost ) );
client_sound_play( id );
HasGravity[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 9:
{
if (drshop_invis != 1) {
return PLUGIN_HANDLED;
}
if( HasInvis[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( get_user_team( id ) == 2)
{
client_print( id, print_chat, "%L", id, "DRSHOP_ONLY_T" );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gInvisCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 );
client_print( id, print_chat, "%L", id, "DRSHOP_INVISIBILITY_ITEM" );
fm_set_user_money( id, whichmoney - get_pcvar_num( gInvisCost ) );
client_sound_play( id );
HasInvis[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 10:
{
if (drshop_jet != 1) {
return PLUGIN_HANDLED;
}
if( HasJet[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gJetCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
set_task( float( get_pcvar_num( gJetTime ) ), "remove_jetpack", id );
fm_set_user_money( id, whichmoney - get_pcvar_num( gJetCost ) );
client_print( id, print_chat, "%L", id, "DRSHOP_JETPACK_ITEM" );
client_sound_play( id );
HasJet[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 11:
{
if (drshop_noclip != 1) {
return PLUGIN_HANDLED;
}
if( HasNoclip[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gNoclipCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
set_task( float( get_pcvar_num( gNoclipTime ) ), "remove_noclip", id );
set_user_noclip( id, 1 );
client_print( id, print_chat, "%L", id, "DRSHOP_NOCLIP_ITEM" );
client_sound_play( id );
HasNoclip[ id ] = true;
fm_set_user_money( id, whichmoney - get_pcvar_num( gNoclipCost ) );
set_client_effect( id );
menu_destroy( menu );
}
case 12:
{
if (drshop_deagle != 1) {
return PLUGIN_HANDLED;
}
if( HasDeagle[ id ] )
{
allready_have( id );
return PLUGIN_HANDLED;
}
if( whichmoney < get_pcvar_num( gDeagleCost ) )
{
dont_have( id );
return PLUGIN_HANDLED;
}
give_item( id, "weapon_deagle" );
client_print( id, print_chat, "%L", id, "DRSHOP_DEAGLE_ITEM" );
client_sound_play( id );
HasDeagle[ id ] = true;
fm_set_user_money( id, whichmoney - get_pcvar_num( gDeagleCost ) );
set_client_effect( id );
menu_destroy( menu );
}
/*
case 10:
{
set_user_rendering( id, kRenderFxGlowShell, random( 256 ), random( 256 ), random( 256 ), kRenderNormal, random( 256 ) );
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GLOW_ITEM" );
client_sound_play( id );
HasGlow[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
}
case 12:
{
strip_user_weapons( id );
give_item( id, "weapon_knife" );
give_item( id, "weapon_deagle" );
//cs_set_user_bpammo(id, CSW_DEAGLE, 2);
ns_set_weap_clip(CSW_DEAGLE, 2);
client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DEAGLE_ITEM" );
client_sound_play( id );
HasDeagle[ id ] = true;
set_client_effect( id );
menu_destroy( menu );
} */
}
return PLUGIN_HANDLED;
}
public SpeedCheck(id) {
if( HasSpeed[ id ]) {
set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
}
return PLUGIN_CONTINUE;
}
public ShowPlayerInfo( id )
{
set_hudmessage( 0, 183, 255, -1.0, 0.82, 0, 6.0, 12.0 );
show_hudmessage( id, "%L", id, "DRSHOP_HUD_INFO" );
}
public cmd_invis(id, level, cid) {
new flags[32] = "g";
if (!cmd_access(id, level, cid, 1) || !is_user_admin(id) || !has_flag(id,flags))
return PLUGIN_HANDLED;
new arg[32],arg2[32];
read_argv(1, arg, 31);
read_argv(2, arg2, 31);
new invis = str_to_num(arg2);
if(arg[0] == '@') {
if(equali(arg[1],"ALL")) {
for(new i = 1; i < get_playersnum()+1; i++) {
if (is_user_connected(i) && is_user_alive(i)) {
if (!invis) set_user_rendering(i);
else set_user_rendering( i, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 );
}
}
}
} else {
new player = cmd_target(id, arg, CMDTARGET_ONLY_ALIVE);
if (!player)
return PLUGIN_HANDLED;
if (!invis) set_user_rendering(player);
else set_user_rendering( player, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0 );
}
return PLUGIN_HANDLED;
}
public bacon_playerJumping( id )
{
if( get_pcvar_num( gDrShopOn ) != 0 && HasJet[ id ] )
{
new iOrigin[ 3 ];
get_user_origin( id, iOrigin, 0 );
iOrigin[ 2 ] -= 10;
new Float:fVelocity[ 3 ];
pev( id, pev_velocity, fVelocity );
fVelocity[ 2 ] += 12; //93
set_pev( id, pev_velocity, fVelocity );
create_flame( iOrigin );
}
}
public logevent_round_start()
{
if( get_pcvar_num( gDrShopOn ) == 1 )
{
for( new id = 1; id <= gMaxPlayers; id++ )
{
HasHe[ id ] = false;
HasHe2[ id ] = false;
HasBothGren[ id ] = false;
HasSilent[ id ] = false;
HasHealth[ id ] = false;
HasArmor[ id] = false;
HasSpeed[ id ] = false;
HasGravity[ id ] = false;
HasInvis[ id ] = false;
HasJet[ id ] = false;
HasNoclip[ id ] = false;
HasDeagle[ id ] = false;
set_user_rendering( id );
set_user_gravity( id, 1.0 );
set_user_maxspeed( id, 0.0 );
fm_set_user_footsteps( id, 0 );
set_user_noclip( id, 0 );
remove_task( id );
}
}
return PLUGIN_CONTINUE;
}
public Hook_Deathmessage()
{
if( get_pcvar_num( gDrShopOn ) == 1 )
{
new id = read_data( 2 );
HasHe[ id ] = false;
HasHe2[ id ] = false;
HasBothGren[ id ] = false;
HasSilent[ id ] = false;
HasHealth[ id ] = false;
HasArmor[ id] = false;
HasSpeed[ id ] = false;
HasGravity[ id ] = false;
HasInvis[ id ] = false;
HasJet[ id ] = false;
HasNoclip[ id ] = false;
HasDeagle[ id ] = false;
set_user_rendering( id );
set_user_gravity( id, 1.0 );
set_user_maxspeed( id, 0.0 );
fm_set_user_footsteps( id, 0 );
set_user_noclip( id, 0 );
remove_task( id );
}
return PLUGIN_CONTINUE;
}
public remove_noclip( id )
{
HasNoclip[ id ] = false;
set_user_noclip( id, 0 );
client_print( id, print_chat, "%L", id, "DRSHOP_NOCLIP_OFF", get_pcvar_num( gNoclipTime ) );
}
public remove_jetpack( id )
{
HasJet[ id ] = false;
client_print( id, print_chat, "%L", id, "DRSHOP_JETPACK_OFF", get_pcvar_num( gJetTime ) );
}
stock create_flame( origin[ 3 ] )
{
message_begin( MSG_PVS, SVC_TEMPENTITY, origin );
write_byte( TE_SPRITE );
write_coord( origin[ 0 ] );
write_coord( origin[ 1 ] );
write_coord( origin[ 2 ] );
write_short( gJetSprite );
write_byte( 3 );
write_byte( 99 );
message_end();
}
stock set_client_effect( index )
{
new iOrigin[ 3 ];
get_user_origin( index, iOrigin );
message_begin( MSG_PAS, SVC_TEMPENTITY, iOrigin );
write_byte( TE_BEAMCYLINDER );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] + 8 );
write_coord( iOrigin[ 0 ] );
write_coord( iOrigin[ 1 ] );
write_coord( iOrigin[ 2 ] + 10 + 50 );
write_short( gWhave );
write_byte( 0 );
write_byte( 0 );
write_byte( 4 );
write_byte( 50 );
write_byte( 0 );
write_byte( 255 );
write_byte( 255 );
write_byte( 0 );
write_byte( 200 );
write_byte( 0 );
message_end();
}
stock allready_have( id)
{
client_print( id, print_chat, "%L", id, "DRSHOP_ALLREADY_HAVE" );
}
stock dont_have( id )
{
client_print( id, print_chat, "%L", id, "DRSHOP_DONTHAVE_MONEY" );
}
stock client_sound_play( index )
{
client_cmd( index, "speak %s", PICKUP_SND );
}
stock fm_get_user_money( index )
{
//new money = get_pdata_int( index, OFFSET_MONEY );
new money = cs_get_user_money_ul(index);
return money;
}
stock fm_set_user_money( index, money )
{
//set_pdata_int( index, OFFSET_MONEY, money );
//fm_set_money( index, money, flash );
cs_set_user_money_ul(index, money);
return 1;
} /*
stock fm_set_money( index, money, flash )
{
message_begin( MSG_ONE_UNRELIABLE, gMsgMoney, {0, 0, 0}, index );
write_long( money );
write_byte( flash ? 1 : 0 );
message_end();
} */
stock fm_set_user_footsteps( index, set = 1 )
{
if( set )
{
set_pev( index, pev_flTimeStepSound, 999 );
bSilent[ index ] = true;
}
else
{
set_pev( index, pev_flTimeStepSound, 400 );
bSilent[ index ] = false;
}
return 1;
}
Last edited by AlexALX; 08-30-2009 at 13:34.
|
|