|
Senior Member
Join Date: May 2009
Location: Lithuania
|

05-26-2009
, 23:10
[ZP] 3rd person view who could mofify this?
|
#1
|
Who could mofify this soo when you buy it and bind the key you dont need to hold the key just press it and it turns on 3rd person view press the key again and the view will be normal
Quote:
/*
/
/
/ [ZP] Extra Item : 3rd Person View
/ (ability for both teams)
/
/ by The_Thing
/
/
/ Description :
/
/ Have You ever wanted to know what is going on behind You when You are left alone or with some people?
/ Now You can for a small fee You can buy this ability to see whats going on around You. Bind [key] +view .
/
/
/
/ Cvars :
/
/ zp_3rdview <1|0> - Default is 1
/ zp_view_cost "6" - How much this ability will cost tou You.
/
/
/
/ Commands :
/
/ say /bview - to buy this ability or use
/ say_team /bview - to buy it.
/
/
/
/ Credits :
/
/ Throstur - for his Third Person(and others) Viewmode plugin
/
/
/
/ Changelog :
/
/ 26/10/2008 - v1.0 - First release
/ 26/10/2008 - v1.1 - fixed bug that if had bought this ability and didn't get it
/ 28/10/2008 - v1.2 - Added ability that now You can reset Your 3rd person view and set it back to normal and fixed some bugs.
/ 28/10/2008 - v1.2.2 - removed some client print messages due it spam server. Fixed some other bugs.
/ 27/11/2008 - v1.2.4 - added posibility that now you can press binded buton any time you want, removed reset function.
*/
#include <amxmodx>
#include <engine>
#include <zombieplague>
#define PLUGIN "[ZP] Extra : 3rd person view"
#define VERSION "1.2.4"
#define AUTHOR "The_Thing"
new g_item_name[] = { "3rd Person View" }
new g_itemid_view, g_view_toggle, g_view_cost, g_thirdperson_mode, g_firstperson_mode
new bool:g_hasView[33], bool:g_hasView_reset[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_view_toggle = register_cvar("zp_3rdview", "1")
g_view_cost = register_cvar("zp_view_cost", "6")
g_firstperson_mode = register_cvar("zp_firstperson_mode", "1")
g_thirdperson_mode = register_cvar("zp_thirdperson_mode", "1")
register_clcmd("say /bview", "fnView_Thirdperson")
register_clcmd("say_team /bview", "fnView_Thirdperson")
register_concmd("+view","cmd_view", ADMIN_USER, "bind [key] +view")
register_clcmd("-view","cmd_off")
g_itemid_view = zp_register_extra_item(g_item_name, get_pcvar_num(g_view_cost), ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
register_event("DeathMsg", "Death", "a")
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
}
public client_connect(id)
{
g_hasView_reset[id] = true
}
public client_disconnect(id)
{
g_hasView_reset[id] = true
}
public Death()
{
new id = read_data( 2 )
if ( g_hasView[id] )
set_view(id, CAMERA_NONE)
}
public Event(id)
{
if ( get_pcvar_num(g_thirdperson_mode) == 1 )
set_task(1.0, "fnView_Thirdperson", id)
}
public Event2(id)
{
if ( get_pcvar_num(g_firstperson_mode) == 1 )
set_task(0.5, "fnView_Firstperson", id)
}
public event_new_round()
{
for (new i = 1; i <= 32; i++)
if ( g_hasView[i] )
set_view(i, CAMERA_NONE)
}
public cmd_view(player)
{
if ( !is_user_alive(player) )
return PLUGIN_HANDLED
if ( !g_hasView[player] )
return PLUGIN_HANDLED
g_hasView[player] = true
set_view(player, CAMERA_3RDPERSON)
set_task(0.5, "fnView_Thirdperson", player)
return PLUGIN_CONTINUE
}
public cmd_off(player)
{
if ( !is_user_alive(player))
return PLUGIN_HANDLED
if ( !g_hasView_reset[player] )
return PLUGIN_HANDLED
set_view(player, CAMERA_NONE)
set_task(0.5, "fnView_Firstperson", player)
return PLUGIN_CONTINUE
}
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid_view)
{
if ( is_user_alive(player) )
{
g_hasView[player] = true
client_print(player, print_chat, "[ZP] To active your ability just (Bind [key] +view)")
}
}
}
public fnView_Firstperson(id)
{
if ( !get_pcvar_num(g_view_toggle) )
{
client_print(id, print_chat, "[ZP] 3rd view plugin are disabled")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
g_hasView_reset[id] = true
set_view(id, CAMERA_NONE)
return PLUGIN_HANDLED
}
if ( g_hasView_reset[id] )
{
set_view(id, CAMERA_NONE)
return PLUGIN_HANDLED
}
if ( is_user_alive(id) )
{
g_hasView_reset[id] = true
}
return PLUGIN_HANDLED
}
public fnView_Thirdperson(id)
{
if ( !get_pcvar_num(g_view_toggle) )
{
client_print(id, print_chat, "[ZP] 3rd view plugin are disabled")
return PLUGIN_HANDLED
}
if ( !is_user_alive(id) )
{
g_hasView[id] = false
client_print(id, print_chat, "[ZP] Dead people can't buy this ability")
return PLUGIN_HANDLED
}
if ( g_hasView[id] )
{
set_view(id, CAMERA_3RDPERSON)
return PLUGIN_HANDLED
}
new money = zp_get_user_ammo_packs(id)
if ( money < get_pcvar_num(g_view_cost) )
{
client_print(id, print_chat, "[ZP] You don't have enough ammo packs", get_pcvar_num(g_view_cost))
return PLUGIN_HANDLED
}
if ( is_user_alive(id) )
{
g_hasView[id] = true
client_print(id, print_chat, "[ZP] To active your ability just (Bind [key] +view)")
}
zp_set_user_ammo_packs(id, money - get_pcvar_num(g_view_cost))
client_print(id, print_chat, "[ZP] You have purchased 3rd Person View")
return PLUGIN_HANDLED
}
public plugin_precache()
{
precache_model("models/rpgrocket.mdl")
}
|
|
|