Raised This Month: $ Target: $400
 0% 

[Request] AntiFurien Shield


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Argon Svng
Member
Join Date: Sep 2014
Old 12-27-2014 , 11:00   [Request] AntiFurien Shield
Reply With Quote #1

Help me Code remove_entity(entity) & remove_entity_name(entclas) is Crashed cs


# Image



# Code

PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fakemeta_util>
#include <Colorchat>
#include <hamsandwich>

new cvar_knockbackcvar_timerBlockg_Shield
new const entclas[] = "antifurien_shield"

public plugin_init() 
{
    
register_plugin("[AntiFurien] Shield""1.0""EaGle & Medox*")
    
    
register_clcmd("say /sh","get_user_shield"// Cmd Get Shield
    
    
register_touch(entclas"player""knockback_touch")  // Shield knockback_touch    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
cvar_timer register_cvar("Countdown""60.0")  // Time Remove Shield
    
cvar_knockback register_cvar("knockback""25.0")  // Shield knockback     
}

public 
event_round_start(id) {    
    
remove_entity_name(entclas)
}
    
public 
plugin_precache() 
{
    
g_Shield precache_model("models/s_shield.mdl"// Model Shield
}

public 
fw_PlayerKilled(victimattackershouldgib)
{
    
remove_task(victim)
    
Block false 
}

public 
get_user_shield(id)

    if(!(
cs_get_user_team(id) == CS_TEAM_CT))
    {
        
ColorChat(idGREEN"^4[M#G][Shield] ^1Only AntiFurien ^4!")
        return
    }    
    if(
Block)
    {
        
ColorChat(idGREEN"^4[M#G][Shield] ^1You already have a force field ^4!");
        return    
    }
    else if(!
Block)
    {    
        
Block true // Block Cmd Of 1 Round        
        
set_task(0.1"TaskShow_mdl"id__"b")    // Create Shield
        
ColorChat(idGREEN"^4[M#G][Shield] ^1You Bought a force field ^4[%d sec]"get_pcvar_num(cvar_timer))
    }    
    return
}


public 
TaskShow_mdl(id)
{
    
    if(!
is_user_alive(id)){
        
remove_task(id)
        return
    }
    
    new 
origin[3]
    
    
get_user_origin(idorigin)
    
    
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
    
write_byte(TE_SPRITE)      //  TE_SPRITE
    
write_coord(origin[0])     // x coordinate
    
write_coord(origin[1])     // y coordinate
    
write_coord(origin[2]-5)   // z coordinate
    
write_short(g_Shield)    
    
write_byte(5)     // Scale
    
write_byte(200)   // Brightnessi
    
    
message_end()
    
    
entity_set_string(idEV_SZ_modelentclas)
    
entity_set_int(idEV_INT_solidSOLID_TRIGGER)
    
set_task(get_pcvar_float(cvar_timer), "DeleteShield"id)    
}

public 
DeleteShield(entity)
{
    if(
is_valid_ent(entity)) 
    
remove_entity(entity)
    
remove_task(entity)    
}

public 
knockback_touch(touchedtoucher)
{
    if(
cs_get_user_team(toucher) == CS_TEAM_T)
    {
        new 
Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power get_pcvar_float(cvar_knockback)
        
        
pev(touchedpev_originpos_ptr)
        
pev(toucherpev_originpos_ptd)
        
        for(new 
02i++)
        {
            
pos_ptd[i] -= pos_ptr[i]
            
pos_ptd[i] *= push_power
        
}
        
set_pev(toucherpev_velocitypos_ptd)
        
set_pev(toucherpev_impulsepos_ptd)
    }

# Download Model
Attached Files
File Type: zip model.zip (40.5 KB, 62 views)
__________________
(Moroccan Coders) # I Love Morocco

Last edited by Argon Svng; 12-27-2014 at 11:12.
Argon Svng is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2014 , 12:04   Re: [Request] AntiFurien Shield
Reply With Quote #2

PHP Code:
set_task(get_pcvar_float(cvar_timer), "DeleteShield"id
PHP Code:
public DeleteShield(entity
Here you send the index of a player with the task, and when you try to remove a player entity the server will crash.
__________________
HamletEagle is offline
Argon Svng
Member
Join Date: Sep 2014
Old 12-27-2014 , 12:18   Re: [Request] AntiFurien Shield
Reply With Quote #3

What is the solution
__________________
(Moroccan Coders) # I Love Morocco
Argon Svng is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2014 , 13:00   Re: [Request] AntiFurien Shield
Reply With Quote #4

Don't remove a player entity
In remove_entity remove the entity that should be removed, I think it's about shield entity and not the player.
__________________
HamletEagle is offline
Argon Svng
Member
Join Date: Sep 2014
Old 12-27-2014 , 13:29   Re: [Request] AntiFurien Shield
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
Don't remove a player entity
In remove_entity remove the entity that should be removed, I think it's about shield entity and not the player.
Is there any other way to remove

- entity_set_string(id, EV_SZ_model, entclas)
-
entity_set_int(id, EV_INT_solid, SOLID_TRIGGER)
__________________
(Moroccan Coders) # I Love Morocco
Argon Svng is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2014 , 13:48   Re: [Request] AntiFurien Shield
Reply With Quote #6

You didn't understood, just don't use remove_entity on a player index, change the index to the one of the entity you want to remove, the shield or whatever it is.
__________________
HamletEagle is offline
Argon Svng
Member
Join Date: Sep 2014
Old 12-27-2014 , 14:41   Re: [Request] AntiFurien Shield
Reply With Quote #7

- pass Example Code for remove "knockback_touch" after 60 sec
__________________
(Moroccan Coders) # I Love Morocco
Argon Svng is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-27-2014 , 22:58   Re: [Request] AntiFurien Shield
Reply With Quote #8

Just use bool.

When player bought the item, then set the bool to true. After 60 seconds, just set the bool to false.

Last edited by zmd94; 12-27-2014 at 22:58.
zmd94 is offline
Argon Svng
Member
Join Date: Sep 2014
Old 12-28-2014 , 07:57   Re: [Request] AntiFurien Shield
Reply With Quote #9

I want knockback to Model g_Shield

In this code found knockback in player model

I mean, when I put this code remove_entity(entity) & remove_entity_name(entclas) cs is Crashed

I want to put knockback in Model g_Shield !

Help Me please !
Give Me Code !


__________________
(Moroccan Coders) # I Love Morocco

Last edited by Argon Svng; 12-28-2014 at 07:59.
Argon Svng is offline
Old 01-01-2015, 08:14
Argon Svng
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
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 07:24.


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