Raised This Month: $51 Target: $400
 12% 

[SOLVED] Block pickup jetpack+bazooka survivor/sniper


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-31-2015 , 17:54   [SOLVED] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #1

Hi, firt see this plugin .sma
in this topic
https://forums.alliedmods.net/showth...ighlight=flame
here survivor and sniper can't use jetpack
but survivor and sniper can pickup it
how to block him from pickup it ?

Last edited by arvEL.; 11-01-2015 at 10:29.
arvEL. is offline
Send a message via Skype™ to arvEL.
thekiller123
Member
Join Date: Dec 2012
Old 10-31-2015 , 18:16   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #2

The lock is here:

PHP Code:
public jp_forward(player) {

    if ( 
zp_is_survivor_round () || zp_is_sniper_round () )     
    return 
FMRES_IGNORED 
thekiller123 is offline
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-31-2015 , 19:16   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #3

Quote:
Originally Posted by thekiller123 View Post
The lock is here:

PHP Code:
public jp_forward(player) {

    if ( 
zp_is_survivor_round () || zp_is_sniper_round () )     
    return 
FMRES_IGNORED 
i know man!
survivor + sniper can't use it
but survivor and sniper can pickup jetpack -__-
i need block pickup in sniper and survivor mod
arvEL. is offline
Send a message via Skype™ to arvEL.
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 10-31-2015 , 19:24   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #4

Find in pfn_touch
Code:
  if(!hasjet[id] && !zp_get_user_zombie(id) && is_user_alive(id)) {
Code:
  if(!hasjet[id] && !zp_get_user_zombie(id) && !zp_is_survivor_round() && !zp_is_sniper_round() && is_user_alive(id)) {

Last edited by Chihuahuax; 10-31-2015 at 19:28.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-31-2015 , 20:09   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #5

Quote:
Originally Posted by Chihuahuax View Post
Find in pfn_touch
Code:
  if(!hasjet[id] && !zp_get_user_zombie(id) && is_user_alive(id)) {
Code:
  if(!hasjet[id] && !zp_get_user_zombie(id) && !zp_is_survivor_round() && !zp_is_sniper_round() && is_user_alive(id)) {
sorry my friend i tested it
not work :/
arvEL. is offline
Send a message via Skype™ to arvEL.
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 10-31-2015 , 21:43   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #6

Quote:
Originally Posted by arvEL. View Post
sorry my friend i tested it
not work :/
But it worked for me

PHP Code:
public pfn_touch(ptrptd) { 
    if(
is_valid_ent(ptr)) { 
        new 
classname[32
        
entity_get_string(ptr,EV_SZ_classname,classname,31
         
        if(
equal(classname"zp_jp_jetpack")) { 
            if(
is_valid_ent(ptd)) { 
                new 
id ptd 
                
if(id && id 34) { 
                    if(!
hasjet[id] && !zp_get_user_zombie(id) && !zp_is_survivor_round() && !zp_is_sniper_round() && is_user_alive(id)) { 
                         
                        
hasjet[id] = 
                        g_flyEnergy
[id] = (g_flyEnergy[id] > g_flyEnergy[id] : get_pcvar_num(cvar_fly_max_engery))
                        
rocket[id] = true 
                        client_cmd
(id,"spk items/gunpickup2.wav"
                        
engclient_cmd(id,"weapon_knife"
                        
switchmodel(id
                        
remove_entity(ptr)
                    }
                }
            }
        }else if(
equal(classname"zp_jp_rocket")) {
            new 
Float:fOrigin[3]
            new 
iOrigin[3]
            
entity_get_vector(ptrEV_VEC_originfOrigin)
            
FVecIVec(fOrigin,iOrigin)
            
jp_radius_damage(ptr)
                
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(3)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(31)
            
write_byte(15)
            
write_byte(0)
            
message_end()

            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(3)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(30)
            
write_byte(15)
            
write_byte(0)
            
message_end()

        for (new 
Iter 0Iter 4Iter++)
        {                
                
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
                
write_byte(21)
                
write_coord(iOrigin[0])
                
write_coord(iOrigin[1])
                
write_coord(iOrigin[2])
                
write_coord(iOrigin[0])
                
write_coord(iOrigin[1])
                
write_coord(iOrigin[2]+350+Iter*100)
                
write_short(shockwave)
                
write_byte(0)
                
write_byte(0)
                
write_byte(4)
                
write_byte(Iter*40)
                
write_byte(0)
                
write_byte(121)
                
write_byte(121)
                
write_byte(121)
                
write_byte(random_num(150240))
                
write_byte(0)
                
message_end()
        }
            
            if(
is_valid_ent(ptd)) {
                new 
classname2[32]
                
entity_get_string(ptd,EV_SZ_classname,classname2,31)
                
                if(
equal(classname2,"func_breakable"))
                    
force_use(ptr,ptd)
            }
            
            
remove_entity(ptr)
        }
    }
    return 
PLUGIN_CONTINUE

Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 10-31-2015 , 23:06   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #7

Quote:
Originally Posted by Chihuahuax View Post
But it worked for me

PHP Code:
public pfn_touch(ptrptd) { 
    if(
is_valid_ent(ptr)) { 
        new 
classname[32
        
entity_get_string(ptr,EV_SZ_classname,classname,31
         
        if(
equal(classname"zp_jp_jetpack")) { 
            if(
is_valid_ent(ptd)) { 
                new 
id ptd 
                
if(id && id 34) { 
                    if(!
hasjet[id] && !zp_get_user_zombie(id) && !zp_is_survivor_round() && !zp_is_sniper_round() && is_user_alive(id)) { 
                         
                        
hasjet[id] = 
                        g_flyEnergy
[id] = (g_flyEnergy[id] > g_flyEnergy[id] : get_pcvar_num(cvar_fly_max_engery))
                        
rocket[id] = true 
                        client_cmd
(id,"spk items/gunpickup2.wav"
                        
engclient_cmd(id,"weapon_knife"
                        
switchmodel(id
                        
remove_entity(ptr)
                    }
                }
            }
        }else if(
equal(classname"zp_jp_rocket")) {
            new 
Float:fOrigin[3]
            new 
iOrigin[3]
            
entity_get_vector(ptrEV_VEC_originfOrigin)
            
FVecIVec(fOrigin,iOrigin)
            
jp_radius_damage(ptr)
                
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(3)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(31)
            
write_byte(15)
            
write_byte(0)
            
message_end()

            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
            
write_byte(3)
            
write_coord(iOrigin[0])
            
write_coord(iOrigin[1])
            
write_coord(iOrigin[2])
            
write_short(explosion)
            
write_byte(30)
            
write_byte(15)
            
write_byte(0)
            
message_end()

        for (new 
Iter 0Iter 4Iter++)
        {                
                
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin)
                
write_byte(21)
                
write_coord(iOrigin[0])
                
write_coord(iOrigin[1])
                
write_coord(iOrigin[2])
                
write_coord(iOrigin[0])
                
write_coord(iOrigin[1])
                
write_coord(iOrigin[2]+350+Iter*100)
                
write_short(shockwave)
                
write_byte(0)
                
write_byte(0)
                
write_byte(4)
                
write_byte(Iter*40)
                
write_byte(0)
                
write_byte(121)
                
write_byte(121)
                
write_byte(121)
                
write_byte(random_num(150240))
                
write_byte(0)
                
message_end()
        }
            
            if(
is_valid_ent(ptd)) {
                new 
classname2[32]
                
entity_get_string(ptd,EV_SZ_classname,classname2,31)
                
                if(
equal(classname2,"func_breakable"))
                    
force_use(ptr,ptd)
            }
            
            
remove_entity(ptr)
        }
    }
    return 
PLUGIN_CONTINUE

really you are legend coder!
work 100%
but i have 1 edit can you make
when the survivor round or sniper round
ended sniper or survivor will can picup the jetpack
thx bro <3

Last edited by arvEL.; 10-31-2015 at 23:07.
arvEL. is offline
Send a message via Skype™ to arvEL.
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 11-01-2015 , 01:29   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #8

Replace
PHP Code:
if(!hasjet[id] && !zp_get_user_zombie(id) && !zp_is_survivor_round() && !zp_is_sniper_round() && is_user_alive(id)) { 
with
PHP Code:
if(!hasjet[id] && !zp_get_user_zombie(id) && is_user_alive(id) && !((zp_is_survivor_round() || zp_is_sniper_round()) && !g_endround)) { 

And add
PHP Code:
new g_endround

public plugin_init() {
    
register_logevent("logevent_round_end"2"1=Round_End")
}

public 
event_round_start()
{
    
g_endround false
}

public 
logevent_round_end()
{
    
g_endround true


Last edited by Chihuahuax; 11-01-2015 at 01:30.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 11-01-2015 , 04:13   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #9

Quote:
Originally Posted by Chihuahuax View Post
Replace
PHP Code:
if(!hasjet[id] && !zp_get_user_zombie(id) && !zp_is_survivor_round() && !zp_is_sniper_round() && is_user_alive(id)) { 
with
PHP Code:
if(!hasjet[id] && !zp_get_user_zombie(id) && is_user_alive(id) && !((zp_is_survivor_round() || zp_is_sniper_round()) && !g_endround)) { 

And add
PHP Code:
new g_endround

public plugin_init() {
    
register_logevent("logevent_round_end"2"1=Round_End")
}

public 
event_round_start()
{
    
g_endround false
}

public 
logevent_round_end()
{
    
g_endround true

legend coder!
last request can you add this lines
PHP Code:
if ( zp_is_survivor_round () || zp_is_sniper_round ())     
        
drop_jetpack(id)
        
FMRES_IGNORED 
when the survivor or sniper round started i want survivor or sniper
droped the jetpack
i try write here
PHP Code:
public jp_forward(player
but the plugin crashed
arvEL. is offline
Send a message via Skype™ to arvEL.
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 11-01-2015 , 04:52   Re: [HELP] Block pickup jetpack+bazooka survivor/sniper
Reply With Quote #10

PHP Code:
public zp_round_started(modeid)
{
    if(
mode == MODE_SURVIVOR || mode == MODE_SNIPER) {
          
drop_jetpack(id)
    }

Not tested

Last edited by Chihuahuax; 11-01-2015 at 04:57.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
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 17:08.


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