Raised This Month: $ Target: $400
 0% 

[ZP] Extra Item: Thermal Googles


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
roadrage
Senior Member
Join Date: Dec 2008
Old 03-18-2009 , 06:34   [ZP] Extra Item: Thermal Googles
Reply With Quote #1

Guys, thanks to you guys I was able to edit a cool plugin and make another cool plugin. Since we have invisibility options and ghosts zombies, I have come up with Thermal Goggles. Tested and works.
Thanks to Cheapsuit for thermal zombie class plugin!

I am all new to scripting so if there are bugs please tell me so I can try to fix and learn at the same time. Also if you guys like this plugin...show some love and give me +karma?

Enjoy.
Attached Files
File Type: sma Get Plugin or Get Source (zp_extra_thermal_goggles.sma - 4869 views - 4.4 KB)

Last edited by roadrage; 03-18-2009 at 22:17. Reason: fixed problem.
roadrage is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-18-2009 , 06:54   Re: Thermal Googles
Reply With Quote #2

in FW_PlayerPreThink function you have this check at the top
PHP Code:
if(!is_user_alive(id) || !zp_get_user_zombie(id)||!g_ThermalOn[id]) 
 return 
PLUGIN_CONTINUE 
remove the !zp_get_user_zombie(id) check and it should work for both humans and zombie, for human only just remove the ! before zp_get_user_zombie(id)
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
kazuki
Senior Member
Join Date: Dec 2008
Old 03-18-2009 , 11:27   Re: Thermal Googles
Reply With Quote #3

it weird , when i brought the item nothing happen , beside the [ZP] you have brought a Thermal Goggles.....
kazuki is offline
roadrage
Senior Member
Join Date: Dec 2008
Old 03-18-2009 , 14:16   Re: Thermal Googles
Reply With Quote #4

Quote:
Originally Posted by G-Dog View Post
in FW_PlayerPreThink function you have this check at the top
PHP Code:
if(!is_user_alive(id) || !zp_get_user_zombie(id)||!g_ThermalOn[id]) 
 return 
PLUGIN_CONTINUE 
remove the !zp_get_user_zombie(id) check and it should work for both humans and zombie, for human only just remove the ! before zp_get_user_zombie(id)
Hi G-Dog, I appreciate your help a lot. I tired your advice but when you buy it, it says "[ZP] you have just bough goggles" but nothing happens, the minute you get infected the thermal vision works.

This code came from Cheapsuits Thermal zombie, so I am assuming there is part code that it is just for zombie?
roadrage is offline
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 03-18-2009 , 14:26   Re: Thermal Googles
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <engine>
#include <xs>
#include <zombieplague>
 
new const g_item_name[] = { "Thermal Goggles" };
const 
g_item_cost 5;
new 
Float:g_fDelay[33]
new 
g_itemid_goggles;
new 
g_ThermalOn[33]
new 
sprite_playerheat
new cvar_maxdistance
new cvar_updatedelay
 
static const PLUGIN_NAME[]  = "Thermal Goggles"
static const PLUGIN_AUTHOR[]  = "Cheap_Suit"
static const PLUGIN_VERSION[] = "1.0"
public plugin_init()
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
 
register_cvar(PLUGIN_NAMEPLUGIN_VERSIONFCVAR_SPONLY|FCVAR_SERVER)
 
 
g_itemid_goggles zp_register_extra_item(g_item_nameg_item_costZP_TEAM_HUMAN);
 
cvar_maxdistance register_cvar("amx_tig_distance",  "600")
 
cvar_updatedelay register_cvar("amx_tig_updatedelay""0.2")
 
register_event("HLTV""EVENT_round_start""a""1=0""2=0")
}
public 
plugin_precache()
{
 
sprite_playerheat precache_model("sprites/poison.spr")
 
}
public 
FW_PlayerPreThink(id)
{
 if(!
is_user_alive(id) || !g_ThermalOn[id]) 
 return 
PLUGIN_CONTINUE
 
 
if((g_fDelay[id] + get_pcvar_float(cvar_updatedelay)) > get_gametime())
  return 
PLUGIN_CONTINUE
 
 g_fDelay
[id] = get_gametime()
 
 new 
Float:fMyOrigin[3]
 
entity_get_vector(idEV_VEC_originfMyOrigin)
 
 static 
Players[32], iNum
 get_players
(PlayersiNum"a")
 for(new 
0iNum; ++i) if(id != Players[i])
 {
  new 
target Players[i]
 
  new 
Float:fTargetOrigin[3]
  
entity_get_vector(targetEV_VEC_originfTargetOrigin)
 
  if((
get_distance_f(fMyOriginfTargetOrigin) > get_pcvar_num(cvar_maxdistance)) 
  || !
is_in_viewcone(idfTargetOrigin))
   continue
  new 
Float:fMiddle[3], Float:fHitPoint[3]
  
xs_vec_sub(fTargetOriginfMyOriginfMiddle)
  
trace_line(-1fMyOriginfTargetOriginfHitPoint)
 
  new 
Float:fWallOffset[3], Float:fDistanceToWall
  fDistanceToWall 
vector_distance(fMyOriginfHitPoint) - 10.0
  normalize
(fMiddlefWallOffsetfDistanceToWall)
 
  new 
Float:fSpriteOffset[3]
  
xs_vec_add(fWallOffsetfMyOriginfSpriteOffset)
  new 
Float:fScaleFloat:fDistanceToTarget vector_distance(fMyOriginfTargetOrigin)
  if(
fDistanceToWall 100.0)
   
fScale 8.0 * (fDistanceToWall fDistanceToTarget)
  else
   
fScale 2.0
 
  te_sprite
(idfSpriteOffsetsprite_playerheatfloatround(fScale), 125)
 }
 return 
PLUGIN_CONTINUE
}
stock te_sprite(idFloat:origin[3], spritescalebrightness)
{
 
message_begin(MSG_ONESVC_TEMPENTITY_id)
 
write_byte(TE_SPRITE)
 
write_coord(floatround(origin[0]))
 
write_coord(floatround(origin[1]))
 
write_coord(floatround(origin[2]))
 
write_short(sprite)
 
write_byte(scale
 
write_byte(brightness)
 
message_end()
}
stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul)
{
 new 
Float:fLen xs_vec_len(fIn)
 
xs_vec_copy(fInfOut)
 
 
fOut[0] /= fLenfOut[1] /= fLenfOut[2] /= fLen
 fOut
[0] *= fMulfOut[1] *= fMulfOut[2] *= fMul
}
public 
zp_extra_item_selected(playeritemid)
{
 if ( 
g_ThermalOn[player] )
 {
  
client_print(playerprint_chat"[ZP] You already bought this.")
  return 
PLUGIN_HANDLED
 

 if (
itemid == g_itemid_goggles)
 {
  
g_ThermalOn[player] = true
  client_print
(playerprint_chat"[ZP] You've bought thermal goggles")
 }
 return 
PLUGIN_CONTINUE
}
// Reset goggles for all players on newround
public EVENT_round_start()
{
 for (new 
idid <= 32id++) g_ThermalOn[id] = false;

AlejandroSk is offline
Send a message via MSN to AlejandroSk
tiago_mix
Member
Join Date: Jul 2008
Old 03-18-2009 , 15:24   Re: Thermal Googles
Reply With Quote #6

I tried to use here and nothing happened
tiago_mix is offline
roadrage
Senior Member
Join Date: Dec 2008
Old 03-18-2009 , 15:27   Re: Thermal Googles
Reply With Quote #7

Alejandro, thanks but it still doesn't work....
roadrage is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 03-18-2009 , 15:39   Re: Thermal Googles
Reply With Quote #8

Try this:

PHP Code:
#include <amxmodx>
#include <engine>
#include <xs>
#include <zombieplague>

new const g_item_name[] = { "Thermal Goggles" };
const 
g_item_cost 5;
new 
Float:g_fDelay[33]
new 
g_itemid_goggles;
new 
g_ThermalOn[33]
new 
sprite_playerheat
new cvar_maxdistance
new cvar_updatedelay

static const PLUGIN_NAME[]  = "Thermal Goggles"
static const PLUGIN_AUTHOR[]  = "Cheap_Suit"
static const PLUGIN_VERSION[] = "1.0"
public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_cvar(PLUGIN_NAMEPLUGIN_VERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
    
g_itemid_goggles zp_register_extra_item(g_item_nameg_item_costZP_TEAM_HUMAN);
    
cvar_maxdistance register_cvar("amx_tig_distance",  "600")
    
cvar_updatedelay register_cvar("amx_tig_updatedelay""0.2")
    
register_event("HLTV""EVENT_round_start""a""1=0""2=0")
}
public 
plugin_precache()
{
    
sprite_playerheat precache_model("sprites/poison.spr")
}

public 
FW_PlayerPreThink(id)
{
    if(!
is_user_alive(id) || !zp_get_user_zombie(id)||!g_ThermalOn[id]) 
        return 
PLUGIN_CONTINUE
    
    
if((g_fDelay[id] + get_pcvar_float(cvar_updatedelay)) > get_gametime())
        return 
PLUGIN_CONTINUE
    
    g_fDelay
[id] = get_gametime()
    
    new 
Float:fMyOrigin[3]
    
entity_get_vector(idEV_VEC_originfMyOrigin)
    
    static 
Players[32], iNum
    get_players
(PlayersiNum"a")
    for(new 
0iNum; ++i) if(id != Players[i])
{
    new 
target Players[i]
    
    new 
Float:fTargetOrigin[3]
    
entity_get_vector(targetEV_VEC_originfTargetOrigin)
    
    if((
get_distance_f(fMyOriginfTargetOrigin) > get_pcvar_num(cvar_maxdistance)) 
    || !
is_in_viewcone(idfTargetOrigin))
    continue
    new 
Float:fMiddle[3], Float:fHitPoint[3]
    
xs_vec_sub(fTargetOriginfMyOriginfMiddle)
    
trace_line(-1fMyOriginfTargetOriginfHitPoint)
    
    new 
Float:fWallOffset[3], Float:fDistanceToWall
    fDistanceToWall 
vector_distance(fMyOriginfHitPoint) - 10.0
    normalize
(fMiddlefWallOffsetfDistanceToWall)
    
    new 
Float:fSpriteOffset[3]
    
xs_vec_add(fWallOffsetfMyOriginfSpriteOffset)
    new 
Float:fScaleFloat:fDistanceToTarget vector_distance(fMyOriginfTargetOrigin)
    if(
fDistanceToWall 100.0)
        
fScale 8.0 * (fDistanceToWall fDistanceToTarget)
    else
        
fScale 2.0
        
    te_sprite
(idfSpriteOffsetsprite_playerheatfloatround(fScale), 125)
    }
    return 
PLUGIN_CONTINUE
}
stock te_sprite(idFloat:origin[3], spritescalebrightness)
{
    
message_begin(MSG_ONESVC_TEMPENTITY_id)
    
write_byte(TE_SPRITE)
    
write_coord(floatround(origin[0]))
    
write_coord(floatround(origin[1]))
    
write_coord(floatround(origin[2]))
    
write_short(sprite)
    
write_byte(scale
    
write_byte(brightness)
    
message_end()
}
stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul)
{
    new 
Float:fLen xs_vec_len(fIn)
    
xs_vec_copy(fInfOut)
    
    
fOut[0] /= fLenfOut[1] /= fLenfOut[2] /= fLen
    fOut
[0] *= fMulfOut[1] *= fMulfOut[2] *= fMul
}
public 
zp_extra_item_selected(playeritemid)
{
    if ( 
g_ThermalOn[player] )
    {
        
client_print(playerprint_chat"[ZP] You already bought this.")
        return 
PLUGIN_HANDLED
    

    if (
itemid == g_itemid_goggles)
    {
        
FW_PlayerPreThink(player)
        
g_ThermalOn[player] = true
        client_print
(playerprint_chat"[ZP] You've bought thermal goggles")
    }
    return 
PLUGIN_CONTINUE
}
// Reset goggles for all players on newround
public EVENT_round_start()
{
    for (new 
idid <= 32id++) g_ThermalOn[id] = false;

__________________
alan_el_more is offline
roadrage
Senior Member
Join Date: Dec 2008
Old 03-18-2009 , 18:47   Re: Thermal Googles
Reply With Quote #9

Quote:
Originally Posted by alan_el_more View Post
Try this:

PHP Code:
#include <amxmodx>
#include <engine>
#include <xs>
#include <zombieplague>
 
new const g_item_name[] = { "Thermal Goggles" };
const 
g_item_cost 5;
new 
Float:g_fDelay[33]
new 
g_itemid_goggles;
new 
g_ThermalOn[33]
new 
sprite_playerheat
new cvar_maxdistance
new cvar_updatedelay
 
static const PLUGIN_NAME[]  = "Thermal Goggles"
static const PLUGIN_AUTHOR[]  = "Cheap_Suit"
static const PLUGIN_VERSION[] = "1.0"
public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_cvar(PLUGIN_NAMEPLUGIN_VERSIONFCVAR_SPONLY|FCVAR_SERVER)
 
    
g_itemid_goggles zp_register_extra_item(g_item_nameg_item_costZP_TEAM_HUMAN);
    
cvar_maxdistance register_cvar("amx_tig_distance",  "600")
    
cvar_updatedelay register_cvar("amx_tig_updatedelay""0.2")
    
register_event("HLTV""EVENT_round_start""a""1=0""2=0")
}
public 
plugin_precache()
{
    
sprite_playerheat precache_model("sprites/poison.spr")
}
 
public 
FW_PlayerPreThink(id)
{
    if(!
is_user_alive(id) || !zp_get_user_zombie(id)||!g_ThermalOn[id]) 
        return 
PLUGIN_CONTINUE
 
    
if((g_fDelay[id] + get_pcvar_float(cvar_updatedelay)) > get_gametime())
        return 
PLUGIN_CONTINUE
 
    g_fDelay
[id] = get_gametime()
 
    new 
Float:fMyOrigin[3]
    
entity_get_vector(idEV_VEC_originfMyOrigin)
 
    static 
Players[32], iNum
    get_players
(PlayersiNum"a")
    for(new 
0iNum; ++i) if(id != Players[i])
{
    new 
target Players[i]
 
    new 
Float:fTargetOrigin[3]
    
entity_get_vector(targetEV_VEC_originfTargetOrigin)
 
    if((
get_distance_f(fMyOriginfTargetOrigin) > get_pcvar_num(cvar_maxdistance)) 
    || !
is_in_viewcone(idfTargetOrigin))
    continue
    new 
Float:fMiddle[3], Float:fHitPoint[3]
    
xs_vec_sub(fTargetOriginfMyOriginfMiddle)
    
trace_line(-1fMyOriginfTargetOriginfHitPoint)
 
    new 
Float:fWallOffset[3], Float:fDistanceToWall
    fDistanceToWall 
vector_distance(fMyOriginfHitPoint) - 10.0
    normalize
(fMiddlefWallOffsetfDistanceToWall)
 
    new 
Float:fSpriteOffset[3]
    
xs_vec_add(fWallOffsetfMyOriginfSpriteOffset)
    new 
Float:fScaleFloat:fDistanceToTarget vector_distance(fMyOriginfTargetOrigin)
    if(
fDistanceToWall 100.0)
        
fScale 8.0 * (fDistanceToWall fDistanceToTarget)
    else
        
fScale 2.0
 
    te_sprite
(idfSpriteOffsetsprite_playerheatfloatround(fScale), 125)
    }
    return 
PLUGIN_CONTINUE
}
stock te_sprite(idFloat:origin[3], spritescalebrightness)
{
    
message_begin(MSG_ONESVC_TEMPENTITY_id)
    
write_byte(TE_SPRITE)
    
write_coord(floatround(origin[0]))
    
write_coord(floatround(origin[1]))
    
write_coord(floatround(origin[2]))
    
write_short(sprite)
    
write_byte(scale
    
write_byte(brightness)
    
message_end()
}
stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul)
{
    new 
Float:fLen xs_vec_len(fIn)
    
xs_vec_copy(fInfOut)
 
    
fOut[0] /= fLenfOut[1] /= fLenfOut[2] /= fLen
    fOut
[0] *= fMulfOut[1] *= fMulfOut[2] *= fMul
}
public 
zp_extra_item_selected(playeritemid)
{
    if ( 
g_ThermalOn[player] )
    {
        
client_print(playerprint_chat"[ZP] You already bought this.")
        return 
PLUGIN_HANDLED
    

    if (
itemid == g_itemid_goggles)
    {
        
FW_PlayerPreThink(player)
        
g_ThermalOn[player] = true
        client_print
(playerprint_chat"[ZP] You've bought thermal goggles")
    }
    return 
PLUGIN_CONTINUE
}
// Reset goggles for all players on newround
public EVENT_round_start()
{
    for (new 
idid <= 32id++) g_ThermalOn[id] = false;


Thanks Alan, I had to use fakemeta instead, although it had 2 warnings with loose indentation. It works!!!!!
roadrage is offline
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 03-18-2009 , 18:48   Re: Thermal Googles
Reply With Quote #10

what u edited alan?
AlejandroSk is offline
Send a message via MSN to AlejandroSk
Reply


Thread Tools
Display Modes

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 17:04.


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