Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP] Extra item: Sniper v1.6


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-21-2010 , 09:30   [ZP] Extra item: Sniper v1.6
Reply With Quote #1

Extra Item: Sniper

Description:
It gives you:
-More awp damage
-Health
-Armor
-Speed
-Gravity


Includes:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague> 
Cvars:
PHP Code:
-zp_sniper_health Can change the health of Sniper if bought
-zp_sniper_armor Changes the Armor of Sniper if bought
-zp_sniper_speed Set speed to X if bought
-zp_sniper_awp_damage Replace AWP damage with X damage 
-zp_sniper_gravity Change the gravity if Sniper bought 
Model:
Code:
-Custom Awp model included in version 1.6 and higher!
Version:
Code:
v1.0: -Release

v1.1: -Fixed mistakes, 
      -Added glow with cvars

v1.2: -Added new glow code (Thanks to Kiske)
      -Fixed some mistakes
      -Added to check if player is valid

v1.3: -Added Sniper gravity
      -Fixed the thing with get_user_weapon()

v1.4: -Fixed some bugs with Glow

v1.5: -Fixed the cool glow part..
      -Fixed the Speed thing (I hope)

v1.6: -Fixed weapon event
Credits
Code:
Kiske: For his glow code (I do not really know wot it works)
fiendshard: For the Awp Model
Abdul-rehman: Help with some codes for speed
Attached Files
File Type: zip zp_sniper_model.zip (557.0 KB, 5648 views)
File Type: sma Get Plugin or Get Source (zp_extra_sniper_v1.6.sma - 6497 views - 3.6 KB)

Last edited by Vechta; 10-23-2010 at 04:16.
Vechta is offline
John301
BANNED
Join Date: Jul 2010
Old 08-21-2010 , 09:38   Re: [ZP] Extra item: Sniper
Reply With Quote #2

Hmm i will test it ^^
John301 is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-21-2010 , 09:52   Re: [ZP] Extra item: Sniper
Reply With Quote #3

First : Check if a valid player.
Second: 'models/v_awp' != 'models/v_awp.mdl'
Third: Try to use parse to the glow colors, search 'Soldier UqZ' From Kiske.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
BillThailandUP
Member
Join Date: Jul 2010
Location: Thailand [Bangkok]
Old 08-21-2010 , 10:09   Re: [ZP] Extra item: Sniper
Reply With Quote #4

good jod xp
__________________
คนไทยเก่งเว้ย
BillThailandUP is offline
Send a message via MSN to BillThailandUP
Ciio
Veteran Member
Join Date: Oct 2009
Location: Arica, Chile
Old 08-21-2010 , 19:41   Re: [ZP] Extra item: Sniper
Reply With Quote #5

nice
__________________
Ciio is offline
Send a message via MSN to Ciio
sunx
Veteran Member
Join Date: Mar 2009
Location: Germany
Old 08-22-2010 , 05:27   Re: [ZP] Extra item: Sniper
Reply With Quote #6

gj
__________________

sunx is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 08-22-2010 , 05:49   Re: [ZP] Extra item: Sniper
Reply With Quote #7

Gj ..
Just one thing you should cache the player's current weapon on curweapon event since calling get_user_weapon in take damage is resource expensive as take damage is called very often
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
CS_ZVER
Member
Join Date: Jun 2010
Old 09-10-2010 , 10:55   Re: [ZP] Extra item: Sniper v1.3
Reply With Quote #8

NEED help!
I have the error
Quote:
L 09/10/2010 - 17:44:26: Invalid CVAR pointer
L 09/10/2010 - 17:44:26: [AMXX] Displaying debug trace (plugin "zp_extra_sniper_
v1.3.amxx")
L 09/10/2010 - 17:44:26: [AMXX] Run time error 10: native error (native "get_pcv
ar_string")
L 09/10/2010 - 17:44:26: [AMXX] [0] zp_extra_sniper_v1.3.sma::zp_extra_item_s
elected (line 71)
And don't work the damage!
CS_ZVER is offline
Send a message via ICQ to CS_ZVER
Vechta
Veteran Member
Join Date: Jun 2010
Old 09-10-2010 , 11:06   Re: [ZP] Extra item: Sniper v1.3
Reply With Quote #9

Test this

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "[ZP] Sniper"
#define VERSION "1.0"
#define AUTHOR "Vechta"

new cvar_healthcvar_armorcvar_speedcvar_damagecvar_glowcvar_gravity
new g_sniper[33], g_hassniper[33]
new 
g_item_sniper

new const g_item_name[] =  "Sniper" // Item name
new const g_item_cost 10 // Item cost
new const g_item_team ZP_TEAM_HUMAN // Item team

new const SNIPER_AWP[] = "models/v_awp.mdl" // here you can change to your awp model

#define is_valid_player(%1) (1 <= %1 <= 32) // Check player

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_item_sniper zp_register_extra_item(g_item_nameg_item_costg_item_team// Register Sniper as Item
    
    
cvar_health register_cvar("zp_sniper_health""1000"// Default - 100
    
cvar_armor register_cvar("zp_sniper_armor""100"// Default - 100
    
cvar_speed register_cvar("zp_sniper_speed""240.0"// Default - 240.0
    
cvar_gravity register_cvar("zp_sniper_gravity""0.5"// Default - 0.5 (Half gravity)
    
cvar_damage register_cvar("zp_sniper_awp_damage""1000"// Default - 1000
    
cvar_glow register_cvar("zp_sniper_glow""0 255 0"// Default - 0 255 0
    
    
register_event("DeathMsg""Sniper_Killed""a"// Remove Sniper if he was killed
    
register_event("CurWeapon""Ev_CurWeapon""be""1=1"); // Awp model

    
RegisterHam(Ham_TakeDamage"player""Fw_PlayerDamaged"1// Register sniper damage
    
register_forward(FM_PlayerPreThink"fm_PlayerPreThink"// it's for glow thing
}

public 
plugin_precache()
    
precache_model(SNIPER_AWP// Precache Awp model

public zp_extra_item_selected(playeritemid)
{
    if (
itemid == g_item_sniper)
    {
        if (!
g_hassniper[player])
        {
            
// Set the player to Sniper
            
g_sniper[player] = true
            g_hassniper
[player] = true
            
            
// Change users: health, armor, speed, gravity
            
set_user_health(playerget_user_health(player) + get_pcvar_num(cvar_health))
            
set_user_armor(playerget_user_armor(player) + get_pcvar_num(cvar_armor))
            
set_pev(playerpev_speedget_pcvar_float(cvar_speed))
            
set_pev(playerpev_gravityget_pcvar_float(cvar_gravity))
            
            
// Strip first users weapon to give Awp
            
strip_user_weapons(player)
            
            
// Give weapon awp
            
give_item(player"weapon_knife")
            
give_item(player"weapon_awp")
        }
        else
        {
            
client_print(playerprint_chat"[ZP] You are already a Sniper!")
            return 
ZP_PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_HANDLED;
}
    
public 
Sniper_Killed()
{
    new 
victim read_data(2)
    
    
g_sniper[victim] = false
    g_hassniper
[victim] = false

    
if (g_sniper[victim])
    {
        
set_user_rendering(victimkRenderFxGlowShell255255255kRenderNormal25)
    }
}

public 
Fw_PlayerDamaged(idinflictorattackerdamagedamagebits

    if ( 
is_valid_player(attacker) && get_user_weapon(attacker) == CSW_AWP && g_hassniper[attacker] ) 
    {
        
SetHamParamFloat(4damage *= get_pcvar_float(cvar_damage))
    }
}

public 
Event_CurWeapon(id)
{
    if (
get_user_weapon(id) == CSW_AWP && g_hassniper[id])
    {
        
set_pev(idpev_viewmodel2SNIPER_AWP)
    }
}

public 
fm_PlayerPreThink(id)
{
    if (
g_hassniper[id] && is_user_alive(id))
    {
        if (
zp_get_user_zombie(id) || zp_get_user_nemesis(id)) return;
    
        
// Glow part
        
new szColors[16]
        
get_pcvar_string(cvar_glowszColors15)
                
        new 
gRed[4], gGreen[4], gBlue[4], iRediGreeniBlue
        parse
(szColorsgRed3gGreen3gBlue3)
                
        
iRed clamp(str_to_num(gRed), 0255)
        
iGreen clamp(str_to_num(gGreen), 0255)
        
iBlue clamp(str_to_num(gBlue), 0255)
                
        
set_user_rendering(idkRenderFxGlowShelliRediGreeniBluekRenderNormal20)
    }

Vechta is offline
fiendshard
Senior Member
Join Date: Dec 2009
Location: In Water
Old 09-10-2010 , 12:14   Re: [ZP] Extra item: Sniper v1.3
Reply With Quote #10

Here's cool sniper model:

http://www.mediafire.com/?dnmzyyfdmcn
__________________
fiendshard 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 15:54.


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