AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ROUND-START (https://forums.alliedmods.net/showthread.php?t=113273)

ProIcons 12-25-2009 03:36

ROUND-START
 
PHP Code:


register_logevent
("RSZ",2,"1=Round_Start")  



public 
remove_bomb()
{
        new 
g_MaxClients get_maxplayers ();
    
        for ( new 
1<= g_MaxClients; ++)
        {
            
engclient_cmd(i"drop""weapon_c4")
        }

        new 
weapboxbomb fm_find_ent_by_class(-1"weapon_c4")
        if (
bomb && (weapbox pev(bombpev_owner)) > get_maxplayers()) {
(
187)            dllfunc(DLLFunc_Thinkweapbox// will remove weaponbox + weapon_c4 entity pair
            // remove blinking red bomb mark on the radar
            
message_begin(MSG_ALLget_user_msgid("BombPickup"))
            
message_end()
        }    
}  
public 
RSZ() 
{
   if (
get_cvar_num("respawn") == 1)   
   {
(
197)      remove_bomb()
      new 
players[32], pnum
      get_players
(playerspnum);
      for( new 
ii<pnumi++ )
      {
          
give_item(players[i],"weapon_m4a1")
          
give_item(players[i],"weapon_awp"
          
give_item(players[i],"weapon_m4a1"
          
give_item(players[i],"weapon_ak47"
          
give_item(players[i],"weapon_deagle"
          
give_item(players[i],"weapon_flashbang"
          
give_item(players[i],"weapon_flashbang")
          
give_item(players[i],"weapon_flashbang")
          
give_item(players[i],"weapon_flashbang")
          
give_item(players[i],"weapon_hegrenade")
          
give_item(players[i],"weapon_smokegrenade")
          
give_item(players[i],"item_kevlar")
          
give_item(players[i],"ammo_338magnum")
          
give_item(players[i],"ammo_556nato")
          
give_item(players[i],"ammo_762nato")
          
give_item(players[i],"ammo_50ae")
          
give_item(players[i],"ammo_338magnum")
          
give_item(players[i],"ammo_556nato")
          
give_item(players[i],"ammo_762nato")
          
give_item(players[i],"ammo_50ae")
          
give_item(players[i],"ammo_338magnum")
          
give_item(players[i],"ammo_556nato")
          
give_item(players[i],"ammo_762nato")
          
give_item(players[i],"ammo_50ae")
          
give_item(players[i],"ammo_45acp")
          
give_item(players[i],"ammo_45acp")
          
give_item(players[i],"ammo_45acp")
          
give_item(players[i],"ammo_45acp")
          
give_item(players[i],"ammo_9mm")
          
give_item(players[i],"ammo_9mm")
          
give_item(players[i],"ammo_9mm")
          
give_item(players[i],"ammo_9mm")
          
set_user_health (players[i],500
          
AmmoMaster[players[i]]=true 
      
}
   }
   return 
PLUGIN_CONTINUE


I Have this code, but it has a problem, Sometimes is working and sometimes is not:
Code:

L 12/25/2009 - 02:20:11: [FAKEMETA] Invalid entity
L 12/25/2009 - 02:20:11: [AMXX] Displaying debug trace (plugin "gather.amxx")
L 12/25/2009 - 02:20:11: [AMXX] Run time error 10: native error (native "dllfunc")
L 12/25/2009 - 02:20:11: [AMXX]    [0] Gather.sma::remove_bomb (line 187)
L 12/25/2009 - 02:20:11: [AMXX]    [1] Gather.sma::RSZ (line 197)


ProIcons 12-26-2009 04:13

Re: ROUND-START
 
(187) dllfunc(DLLFunc_Think, weapbox) // will remove weaponbox + weapon_c4 entity pair

Probably this is the wrong but whY?

Hasler 12-26-2009 04:16

Re: ROUND-START
 
You can leave all the code?

ProIcons 12-26-2009 04:25

Re: ROUND-START
 
Quote:

Originally Posted by Hasler (Post 1031589)
You can leave all the code?

What?:S
my code is on top of the page

Hasler 12-26-2009 04:44

Re: ROUND-START
 
Quote:

Originally Posted by ProIcons (Post 1031585)
(187) dllfunc(DLLFunc_Think, weapbox) // will remove weaponbox + weapon_c4 entity pair

Probably this is the wrong but whY?


yes, the error is that, i remove (187) and my server shutingdown

ProIcons 12-26-2009 04:51

Re: ROUND-START
 
Omg... i added the 187 to see the line

Code:

L 12/25/2009 - 02:20:11: [FAKEMETA] Invalid entity
L 12/25/2009 - 02:20:11: [AMXX] Displaying debug trace (plugin "gather.amxx")
L 12/25/2009 - 02:20:11: [AMXX] Run time error 10: native error (native "dllfunc")
L 12/25/2009 - 02:20:11: [AMXX]    [0] Gather.sma::remove_bomb (line 187)

L 12/25/2009 - 02:20:11: [AMXX] [1] Gather.sma::RSZ (line 197)

ProIcons 04-24-2011 11:31

Re: ROUND-START
 
bump

Bugsy 04-24-2011 12:10

Re: ROUND-START
 
vato loco, your code looked like it would work except you forgot to register the forward for SetModel. Here is your code with a couple modifications for efficiency.
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "ned"

new g_iMaxPlayers
new bool:g_bDroppingBomb;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("ev_RoundStart",2,"1=Round_Start")
    
register_forwardFM_SetModel "SetModel" );
    
    
g_iMaxPlayers get_maxplayers()
}

public 
ev_RoundStart()
{
    new 
id
    
for(id 1id <= g_iMaxPlayersid++)
    {
        if(
is_user_alive(id) && user_has_weapon(idCSW_C4))
        {
            
g_bDroppingBomb true;
            
engclient_cmd(id"drop""weapon_c4")
            break;
        }
    }
}

public 
SetModel(iEntModel[])
{
    if( !
g_bDroppingBomb || !Model] || !pev_validiEnt ) )
        return 
FMRES_IGNORED
    
    
static szClassName32];
    
peviEnt pev_classname szClassName charsmaxszClassName ) )
    
    if(
equalszClassName "weaponbox" ) && equalModel "models/w_backpack.mdl" ) )
    {
        
set_peviEnt pev_flags FL_KILLME )
        
dllfuncDLLFunc_Think iEnt )
        
g_bDroppingBomb false;
    }
    
    return 
FMRES_IGNORED



vato loco [GE-S] 04-24-2011 12:27

Re: ROUND-START
 
hehe you are right Bugsy :wink:
thx for making the code more efficient :up:
add Bombpickup msg to remove Bomb form radar

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "ned"

new g_iMaxPlayers
new bool:g_bDroppingBomb;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("ev_RoundStart",2,"1=Round_Start")
    
register_forwardFM_SetModel "SetModel" );
    
    
g_iMaxPlayers get_maxplayers()
}

public 
ev_RoundStart()
{
    new 
id
    
for(id 1id <= g_iMaxPlayersid++)
    {
        if(
is_user_alive(id) && user_has_weapon(idCSW_C4))
        {
            
g_bDroppingBomb true;
            
engclient_cmd(id"drop""weapon_c4")
            break;
        }
    }
}

public 
SetModel(iEntModel[])
{
    if( !
g_bDroppingBomb || !Model] || !pev_validiEnt ) )
        return 
FMRES_IGNORED
    
    
static szClassName32];
    
peviEnt pev_classname szClassName charsmaxszClassName ) )
    
    if(
equalszClassName "weaponbox" ) && equalModel "models/w_backpack.mdl" ) )
    {
        
set_peviEnt pev_flags FL_KILLME )
        
dllfuncDLLFunc_Think iEnt )
        
message_begin(MSG_ALLget_user_msgid("BombPickup"))
        
message_end()
        
g_bDroppingBomb false;
    }
    
    return 
FMRES_IGNORED



ProIcons 04-24-2011 12:34

Re: ROUND-START
 
thx


All times are GMT -4. The time now is 04:16.

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