AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Remove Glock After Spawn (https://forums.alliedmods.net/showthread.php?t=299615)

PurposeLessx 07-20-2017 09:33

Remove Glock After Spawn
 
Hello guys,
I have a problem. I am using a plugin that fixing glock bug after spawn.
But Some friends said me that "there are 2 bugs". And I am here to fix this problems with all of you :)

First bug;

After spawn; "If the user kills before plugin deletes his glock, It falls to ground. Everyone can take it from ground.

Second bug;

After spawn; "If the user drops the glock before plugin deletes his glock. It falls to ground. Everyone can take it from ground. Same things :D

I want to fix this problems like that "When the user kill, Will remove his glock automatic.
And When the user uses drop, Will not drop :)
Thanks for helping

PHP Code:

#include <amxmodx>
#include <reapi>

public plugin_init() {
    
register_plugin("Auto Weapon""1.0""PurposeLess")
    
    
RegisterHookChain(RG_CBasePlayer_Spawn"RGC_BasePlayerSpawn"1)
}

public 
RGC_BasePlayerSpawn(id)
{
    
remove_task(id)
    
remove_task(id+1907)

    if(
is_user_alive(id))
    {
        
rg_remove_all_items(id)
        
rg_give_item(id"weapon_knife")

        if(
get_member(idm_iTeam) == TEAM_CT)
        {
            
rg_give_item(id"weapon_usp")
            
rg_give_item(id"weapon_p90")
            
rg_give_item(id"weapon_deagle")
            
rg_give_item(id"weapon_m4a1")
            
rg_give_item(id"weapon_awp")
            
rg_give_item(id"weapon_ak47")
            
rg_set_user_bpammo(idWEAPON_M4A1200)
            
rg_set_user_bpammo(idWEAPON_AWP200)
            
rg_set_user_bpammo(idWEAPON_AK47200)
            
rg_set_user_bpammo(idWEAPON_USP100)
            
rg_set_user_bpammo(idWEAPON_P90200)
            
rg_set_user_bpammo(idWEAPON_DEAGLE100)
        }
        else if(
get_member(idm_iTeam) == TEAM_TERRORIST)
        {
            if(
task_exists(id)) remove_task(id)
            if(
task_exists(id+1907)) remove_task(id+1907)

            
set_task(0.1"glock_control"id 1907""0"b")
            
set_task(1.5"removetask"id)
            
engclient_cmd(id"weapon_knife")
        }
    }
}

public 
glock_control(TaskId)
{
    new 
id TaskId -= 1907
    
if(is_user_alive(id))
    {
        if(
rg_has_item_by_name(id"weapon_glock18"))
        {
            
rg_remove_item(id"weapon_glock18")
            if(
task_exists(id)) remove_task(id)
            if(
task_exists(id+1907)) remove_task(id+1907)
        }
    }
    else {
        if(
task_exists(id)) remove_task(id)
        if(
task_exists(id+1907)) remove_task(id+1907)
    }
}

public 
removetask(id)
{
    if(
task_exists(id)) remove_task(id)
    if(
task_exists(id+1907)) remove_task(id+1907)



DjSoftero 07-20-2017 14:43

Re: Remove Glock After Spawn
 
remove the glock before enemy dies.
Spoiler

PurposeLessx 07-20-2017 14:59

Re: Remove Glock After Spawn
 
Still there is a problem,
I used "amx_revive and kill"
Glock falls to ground many times.
Unfortunately it ain't working very well. It blocks some times

CrazY. 07-20-2017 18:30

Re: Remove Glock After Spawn
 
Search.

https://forums.alliedmods.net/showthread.php?p=2364171

PurposeLessx 07-21-2017 10:40

Re: Remove Glock After Spawn
 
Quote:

Originally Posted by CrazY. (Post 2536648)

You are king!!! Solved


All times are GMT -4. The time now is 23:02.

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