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

Solved Transfer c4


Post New Thread Reply   
 
Thread Tools Display Modes
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-23-2020 , 09:22   Re: c4 trasnfer
Reply With Quote #11

Quote:
Originally Posted by Bugsy View Post
To confirm:

If C4 holding player is camping for 5 seconds, transfer C4 to closest T player

If C4 holding player dies, do the same
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>

#define AUTHOR                         "Aoi.Kagase (+ARUKARI-)"
#define VERSION                     "0.01"
#define PLUGIN                        "C4 Transfer"

#define TASK_ID    1122039

#define C4        "weapon_c4"
new gTime;
new 
gMsgBombPickup;
new 
gTask;
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_logevent("DropTheC4",    3"2=Dropped_The_Bomb");
    
register_logevent("GotTheC4",    3"2=Got_The_Bomb");
 
    
gTime             register_cvar("c4_transfer_time""2.0"); // seconds
    
gMsgBombPickup     get_user_msgid("BombPickup");

}

public 
DropTheC4()
{
    
set_task(0.2"CheckBomb");
}
public 
GotTheC4()
{
    if(
task_exists(gTask))
    {
        
remove_task(gTask);
    }
}

public 
CheckBomb()
{
    new 
bomb fm_find_ent_by_class(-1C4);
    
gTask TASK_ID bomb;
    
set_task(get_pcvar_float(gTime), "PickUpC4"gTask);
}

public 
PickUpC4(taskId)
{
    new 
weapboxbomb fm_find_ent_by_class(-1C4);
    if (
bomb && (weapbox pev(bombpev_owner)) > get_maxplayers()) 
    {
        
dllfunc(DLLFunc_Thinkweapbox);
        
message_begin(MSG_ALLgMsgBombPickup);
        
message_end();
        
fm_remove_entity(weapbox);

        new 
players[MAX_PLAYERS], pnum;
        
get_players(playerspnum"aeh""TERRORIST");
        
fm_give_item(players[random_num(0pnum 1)], C4);
    }

    if(
task_exists(gTask))
    {
        
remove_task(gTask);
    }

No Camping logic.
Please write afterwards.
__________________
GitHub
SteamWishlist

六四天安門事件

Last edited by +ARUKARI-; 04-23-2020 at 10:51.
+ARUKARI- is offline
lantimilan
Senior Member
Join Date: May 2016
Old 04-23-2020 , 10:41   Re: c4 trasnfer
Reply With Quote #12

Quote:
Originally Posted by Bugsy View Post
To confirm:

If C4 holding player is camping for 5 seconds, transfer C4 to closest T player

If C4 holding player dies, do the same
Dont worry for drop i find one solution, just for trasnfer c4 when if im terrorist i died and i have c4 , c4 dont stay in down where i died but to trasnfer you or any my team friend who is live do you understand
lantimilan is offline
Send a message via MSN to lantimilan
lantimilan
Senior Member
Join Date: May 2016
Old 04-23-2020 , 10:45   Re: c4 trasnfer
Reply With Quote #13

Quote:
Originally Posted by +ARUKARI- View Post
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>

#define AUTHOR                         "Aoi.Kagase (+ARUKARI-)"
#define VERSION                     "0.01"
#define PLUGIN                        "C4 Transfer"

#define TASK_ID    1122039

#define C4        "weapon_c4"
new gTime;
new 
gMsgBombPickup;
new 
gTask;
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_forward(FM_SetModel"SetModel"true);
    
register_logevent("DropTheC4",    3"2=Dropped_The_Bomb");
    
register_logevent("GotTheC4",    3"2=Got_The_Bomb");
 
    
gTime             register_cvar("c4_transfer_time""2.0"); // seconds
    
gMsgBombPickup     get_user_msgid("BombPickup");

}

public 
DropTheC4()
{
    
set_task(0.2"CheckBomb");
}
public 
GotTheC4()
{
    if(
task_exists(gTask))
    {
        
remove_task(gTask);
    }
}

public 
CheckBomb()
{
    new 
bomb fm_find_ent_by_class(-1C4);
    
gTask TASK_ID bomb;
    
set_task(get_pcvar_float(gTime), "PickUpC4"gTask);
}

public 
PickUpC4(taskId)
{
    new 
weapboxbomb fm_find_ent_by_class(-1C4);
    if (
bomb && (weapbox pev(bombpev_owner)) > get_maxplayers()) 
    {
        
dllfunc(DLLFunc_Thinkweapbox);
        
message_begin(MSG_ALLgMsgBombPickup);
        
message_end();
        
fm_remove_entity(weapbox);

        new 
players[MAX_PLAYERS], pnum;
        
get_players(playerspnum"aeh""TERRORIST");
        
fm_give_item(players[random_num(0pnum 1)], C4);
    }

    if(
task_exists(gTask))
    {
        
remove_task(gTask);
    }

No Camping logic.
Please write afterwards.
Thaks man, its possible to add one line when he take c4 to write - You have C4 - PLANT
lantimilan is offline
Send a message via MSN to lantimilan
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2020 , 17:30   Re: c4 trasnfer
Reply With Quote #14

Do you need camping functionality?
__________________
Bugsy is offline
lantimilan
Senior Member
Join Date: May 2016
Old 04-23-2020 , 18:02   Re: c4 trasnfer
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
Do you need camping functionality?
I try to compile plugin akku i cant compile just i want some simple my request ; transfer c4 when somebody who have c4 died to trabsfer c4 in other same team in other player who is live form team terrorist dont stay c4 down
lantimilan is offline
Send a message via MSN to lantimilan
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2020 , 18:31   Re: c4 trasnfer
Reply With Quote #16

I changed a few things and removed fakemeta_util, this is probably why it wouldn't compile.
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>

#define AUTHOR    "Aoi.Kagase (+ARUKARI-)"
#define VERSION    "0.01"
#define PLUGIN    "C4 Transfer"

#define TASK_ID    1122039

new g_pTime;
new 
g_iTask;
new 
g_iMaxPlayers;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);

    
register_logevent"DropTheC4" "2=Dropped_The_Bomb" );
    
register_logevent"GotTheC4" "2=Got_The_Bomb" );
 
    
g_iMaxPlayers get_maxplayers();
    
g_pTime register_cvar"c4_transfer_time" "2" ); // seconds
}

public 
DropTheC4()
{
    
set_taskget_pcvar_floatg_pTime ) , "PickUpC4" , ( g_iTask find_ent_by_class( -"weapon_c4" ) + TASK_ID ) );
}

public 
GotTheC4()
{
    
remove_taskg_iTask );
}

public 
PickUpC4iTaskID )
{
    new 
iBombEnt iWeaponBoxEnt iPlayersMAX_PLAYERS ] , iNum;
    
    
iBombEnt = ( iTaskID TASK_ID ) ;
    
    if ( 
pev_validiBombEnt ) && ( ( iWeaponBoxEnt peviBombEnt pev_owner ) ) > g_iMaxPlayers ) ) 
    {
        
get_playersiPlayers iNum "aeh""TERRORIST" );
        
        if ( 
iNum )
        {
            
fake_touchiWeaponBoxEnt iPlayersrandomiNum ) ] );
        }
    }

__________________

Last edited by Bugsy; 04-23-2020 at 18:36.
Bugsy is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-23-2020 , 20:54   Re: c4 trasnfer
Reply With Quote #17

@Bugsy
I didn't know about fake_touch because I don't usually use engine.
I learned something.
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
lantimilan
Senior Member
Join Date: May 2016
Old 04-24-2020 , 04:40   Re: c4 trasnfer
Reply With Quote #18

I test working good thanks bugsy thanks Arukari for your help i like i test in distance workign perfect, maybe just one message when you take c4 to set : YOU HAVE NOW C4, PLANT!
lantimilan is offline
Send a message via MSN to lantimilan
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-24-2020 , 05:57   Re: c4 trasnfer
Reply With Quote #19

modify this function.
PHP Code:
public PickUpC4iTaskID )
{
    new 
iBombEnt iWeaponBoxEnt iPlayersMAX_PLAYERS ] , iNum;
    
    
iBombEnt = ( iTaskID TASK_ID ) ;
    
    if ( 
pev_validiBombEnt ) && ( ( iWeaponBoxEnt peviBombEnt pev_owner ) ) > g_iMaxPlayers ) ) 
    {
        
get_playersiPlayers iNum "aeh""TERRORIST" );
        
        if ( 
iNum )
        {
            new 
pId iPlayersrandomiNum ) ];
            
fake_touchiWeaponBoxEnt pId );
            
client_print(pIdprint_chat"YOU HAVE NOW C4, PLANT!");
        }
    }

__________________
GitHub
SteamWishlist

六四天安門事件

Last edited by +ARUKARI-; 04-24-2020 at 07:17.
+ARUKARI- is offline
lantimilan
Senior Member
Join Date: May 2016
Old 04-24-2020 , 10:42   Re: c4 trasnfer
Reply With Quote #20

Quote:
Originally Posted by +ARUKARI- View Post
modify this function.
PHP Code:
public PickUpC4iTaskID )
{
    new 
iBombEnt iWeaponBoxEnt iPlayersMAX_PLAYERS ] , iNum;
    
    
iBombEnt = ( iTaskID TASK_ID ) ;
    
    if ( 
pev_validiBombEnt ) && ( ( iWeaponBoxEnt peviBombEnt pev_owner ) ) > g_iMaxPlayers ) ) 
    {
        
get_playersiPlayers iNum "aeh""TERRORIST" );
        
        if ( 
iNum )
        {
            new 
pId iPlayersrandomiNum ) ];
            
fake_touchiWeaponBoxEnt pId );
            
client_print(pIdprint_chat"YOU HAVE NOW C4, PLANT!");
        }
    }

Thanks very much ;)
lantimilan is offline
Send a message via MSN to lantimilan
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 09:44.


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