Solved wall climb

Unpaid Requests, Public Plugins
Post Reply
czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

wall climb

#1

Post by czirimbolo » 5 years ago

hello, can someone make it working only for 90 seconds? Or make the cvar to change this value?

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>

new bool:g_WallClimb[33]
new Float:g_wallorigin[32][3]
new g_maxplayers, g_iItemID

public plugin_init() 
{
	register_plugin("[ZE] Extra Item: Wall climb ", "1.0", "Python1320 & Accelerator")
	g_iItemID = ze_register_item("Wall Climb", 10, 0)
	register_forward(FM_Touch, "fwd_touch")
	register_forward(FM_PlayerPreThink, "fwd_playerprethink")
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	
	g_maxplayers = get_maxplayers()
}

public  ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    if (itemid != g_iItemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Zombies only, So don't show it for Humans
    if (!ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW  
   
    // If he bought it more than 3 so return that it's not Available
    if (g_WallClimb[id]) 
        return ZE_ITEM_UNAVAILABLE
   
    return ZE_ITEM_AVAILABLE
}  

public ze_select_item_post(player, itemid, id) 
{
	if (itemid != g_iItemID)
	     return 
	{
		g_WallClimb[player] = true
		client_print(player, print_chat, "[ZE] You bought Wall climb");
	}
}

public ze_user_infected(id, infector)
{
	g_WallClimb[id] = false
} 

public ze_user_humanized(id) 
{
	g_WallClimb[id] = false
} 

public fw_PlayerKilled(victim, attacker, shouldgib)
	g_WallClimb[victim] = false

public ze_roundend(winteam)
{
	for (new id=1; id<=g_maxplayers; id++)
		g_WallClimb[id] = false
}

public client_connect(id)
	g_WallClimb[id] = false

public fwd_touch(id, world)
{
	if(!is_user_alive(id) || !g_WallClimb[id])
		return FMRES_IGNORED
		
	pev(id, pev_origin, g_wallorigin[id])

	return FMRES_IGNORED
}

public wallclimb(id, button)
{
	static Float:origin[3]
	pev(id, pev_origin, origin)

	if(get_distance_f(origin, g_wallorigin[id]) > 25.0)
		return FMRES_IGNORED  // if not near wall
	
	if(fm_get_entity_flags(id) & FL_ONGROUND)
		return FMRES_IGNORED
		
	if(button & IN_FORWARD)
	{
		static Float:velocity[3]
		velocity_by_aim(id, 120, velocity)
		fm_set_user_velocity(id, velocity)
	}
	else if(button & IN_BACK)
	{
		static Float:velocity[3]
		velocity_by_aim(id, -120, velocity)
		fm_set_user_velocity(id, velocity)
	}
	return FMRES_IGNORED
}	

public fwd_playerprethink(id) 
{
	if(!g_WallClimb[id]) 
		return FMRES_IGNORED
	
	new button = fm_get_user_button(id)
	
	if(button & IN_USE) //Use button = climb
		wallclimb(id, button)

	return FMRES_IGNORED
}
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 5 years ago

Here, cvar wallclimb_time 90 (In seconds):
    1. #include <zombie_escape>
    2. #include <fakemeta_util>
    3.  
    4. new bool:g_WallClimb[33]
    5. new Float:g_wallorigin[32][3]
    6. new g_maxplayers, g_iItemID
    7.  
    8. new g_pCvarUseTime
    9.  
    10. public plugin_init()
    11. {
    12.     register_plugin("[ZE] Extra Item: Wall climb ", "1.0", "Python1320 & Accelerator")
    13.     g_iItemID = ze_register_item("Wall Climb", 10, 0)
    14.     register_forward(FM_Touch, "fwd_touch")
    15.     register_forward(FM_PlayerPreThink, "fwd_playerprethink")
    16.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    17.    
    18.     g_pCvarUseTime = register_cvar("wallclimb_time", "90")
    19.    
    20.     g_maxplayers = get_maxplayers()
    21. }
    22.  
    23. public  ze_select_item_pre(id, itemid)
    24. {
    25.     // Return Available and we will block it in Post, So it dosen't affect other plugins
    26.     if (itemid != g_iItemID)
    27.         return ZE_ITEM_AVAILABLE
    28.    
    29.     // Available for Zombies only, So don't show it for Humans
    30.     if (!ze_is_user_zombie(id))
    31.         return ZE_ITEM_DONT_SHOW  
    32.    
    33.     // If he bought it more than 3 so return that it's not Available
    34.     if (g_WallClimb[id])
    35.         return ZE_ITEM_UNAVAILABLE
    36.    
    37.     return ZE_ITEM_AVAILABLE
    38. }  
    39.  
    40. public ze_select_item_post(player, itemid)
    41. {
    42.     if (itemid != g_iItemID)
    43.          return
    44.     {
    45.         g_WallClimb[player] = true
    46.         client_print(player, print_chat, "[ZE] You bought Wall climb");
    47.         set_task(get_pcvar_float(g_pCvarUseTime), "RemoveWallClimb", player)
    48.     }
    49. }
    50.  
    51. public RemoveWallClimb(id)
    52. {
    53.     if (!is_user_connected(id))
    54.     {
    55.         remove_task(id)
    56.         return
    57.     }
    58.    
    59.     g_WallClimb[id] = false
    60. }
    61.  
    62. public client_disconnected(id)
    63. {
    64.     g_WallClimb[id] = false
    65. }
    66.  
    67. public ze_user_infected(id, infector)
    68. {
    69.     g_WallClimb[id] = false
    70. }
    71.  
    72. public ze_user_humanized(id)
    73. {
    74.     g_WallClimb[id] = false
    75. }
    76.  
    77. public fw_PlayerKilled(victim, attacker, shouldgib)
    78.     g_WallClimb[victim] = false
    79.  
    80. public ze_roundend(winteam)
    81. {
    82.     for (new id=1; id<=g_maxplayers; id++)
    83.         g_WallClimb[id] = false
    84. }
    85.  
    86. public client_connect(id)
    87.     g_WallClimb[id] = false
    88.  
    89. public fwd_touch(id, world)
    90. {
    91.     if(!is_user_alive(id) || !g_WallClimb[id])
    92.         return FMRES_IGNORED
    93.        
    94.     pev(id, pev_origin, g_wallorigin[id])
    95.  
    96.     return FMRES_IGNORED
    97. }
    98.  
    99. public wallclimb(id, button)
    100. {
    101.     static Float:origin[3]
    102.     pev(id, pev_origin, origin)
    103.  
    104.     if(get_distance_f(origin, g_wallorigin[id]) > 25.0)
    105.         return FMRES_IGNORED  // if not near wall
    106.    
    107.     if(fm_get_entity_flags(id) & FL_ONGROUND)
    108.         return FMRES_IGNORED
    109.        
    110.     if(button & IN_FORWARD)
    111.     {
    112.         static Float:velocity[3]
    113.         velocity_by_aim(id, 120, velocity)
    114.         fm_set_user_velocity(id, velocity)
    115.     }
    116.     else if(button & IN_BACK)
    117.     {
    118.         static Float:velocity[3]
    119.         velocity_by_aim(id, -120, velocity)
    120.         fm_set_user_velocity(id, velocity)
    121.     }
    122.     return FMRES_IGNORED
    123. }  
    124.  
    125. public fwd_playerprethink(id)
    126. {
    127.     if(!g_WallClimb[id])
    128.         return FMRES_IGNORED
    129.    
    130.     new button = fm_get_user_button(id)
    131.    
    132.     if(button & IN_USE) //Use button = climb
    133.         wallclimb(id, button)
    134.  
    135.     return FMRES_IGNORED
    136. }
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#3

Post by czirimbolo » 5 years ago

Solved, thanks
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 3 guests