AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Better method (https://forums.alliedmods.net/showthread.php?t=185601)

Lolz0r 05-19-2012 14:01

[Solved] Better method
 
Hi, this plugins makes one cycle at start of every round - makes, drops and hides the bomb after drop. I want to ask the way its made is ot good ?

Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_plugin( "Round End", "1.0", "hleV/Exolent/<VeCo>" )     register_logevent( "LogeventSpawnWithBomb", 3, "2=Spawned_With_The_Bomb" )         register_forward( FM_SetModel, "SetModel" ) } //Code by hleV(CREATE BOMB) public plugin_precache() {     new iEntity = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "func_bomb_target" ) )     set_pev( iEntity, pev_solid, SOLID_NOT ) } //Code by Exolent(DROPPED BOMB) public LogeventSpawnWithBomb( iEntity ) {     engclient_cmd( 0, "drop", "weapon_c4" ) } //this code by <VeCo>(DELETE BOMB AFTER THROW) public SetModel( iEntity, const szModel[] ) {     if( !pev_valid( iEntity ) ) return         static szClassName[ 10 ]     pev( iEntity, pev_classname, szClassName, 9 )         if( !equal( szClassName, "weaponbox" ) || szModel[ 9 ] != 'b' ) return     engfunc( EngFunc_SetOrigin, iEntity, Float:{ 0.0, 0.0, 0.0 } ) }

ConnorMcLeod 05-19-2012 14:17

Re: [Suggestion] Better method
 
What do you want to do ?

Lolz0r 05-19-2012 14:28

Re: [Suggestion] Better method
 
Quote:

Originally Posted by Lolz0r (Post 1712306)
Hi, this plugins makes one cycle at start of every round - makes, drops and removes the bomb after drop

Just round end for surf_ski_2 map.

ConnorMcLeod 05-19-2012 14:51

Re: [Suggestion] Better method
 
Why don't you create an hostage rescue zone instead ?
Is rage module installed on your server ?

Lolz0r 05-19-2012 15:49

Re: [Suggestion] Better method
 
Quote:

Originally Posted by ConnorMcLeod (Post 1712352)
Why don't you create an hostage rescue zone instead ?

I did that first, but there were problems with the money ct's had 0$ I think, I dont remember.

Quote:

Originally Posted by ConnorMcLeod (Post 1712352)
Is rage module installed on your server ?

No, but if need ill install it.

ConnorMcLeod 05-19-2012 17:01

Re: [Suggestion] Better method
 
No it is not needed.

In fact code is fine, you could just enable SetModel forward only when needed :

PHP Code:

#include <amxmodx>
#include <fakemeta>

new g_iFwdSetModel = -1

public plugin_init() 
{
    
register_plugin"Round End""1.0""hleV/Exolent/<VeCo>" )

    
register_logevent"LogeventSpawnWithBomb"3"2=Spawned_With_The_Bomb" )
}

//Code by hleV(CREATE BOMB)
public plugin_precache() 
{
    new 
iEntity engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString"func_bomb_target" ) )
    
set_peviEntitypev_solidSOLID_NOT )
}

//Code by Exolent(DROPPED BOMB)
public LogeventSpawnWithBombiEntity )
{
    if( 
g_iFwdSetModel != -)
    {
        
g_iFwdSetModel register_forward(FM_SetModel"SetModel" )
    }
    
engclient_cmd0"drop""weapon_c4" )
}

public 
SetModeliEntity, const szModel[] )
{
    if( 
equal(szModel"models/w_backpack.mdl") )
    {
        
unregister_forward(FM_SetModelg_iFwdSetModel)
        
g_iFwdSetModel = -1
        
        set_pev
iEntitypev_solidSOLID_NOT )
        
set_peviEntitypev_effectsEF_NODRAW)
    }



Lolz0r 05-19-2012 17:24

Re: [Suggestion] Better method
 
What's the diffrence between <VeCo>'s code and yours (SetModel), because you edited it twice. And now the bomb doesn't hide when it drops.

ConnorMcLeod 05-20-2012 09:59

Re: [Suggestion] Better method
 
More efficient code :

PHP Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN ""

new gmsgBombPickup

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
register_logevent"LogEvent_Got_Bomb"3"2=Spawned_With_The_Bomb" )
    
register_logevent"LogEvent_Got_Bomb"3"2=Got_The_Bomb" )

    
gmsgBombPickup get_user_msgid("BombPickup")
}

public 
plugin_precache()
{
    
create_entity("func_bomb_target")
}

public 
LogEvent_Got_Bomb( )
{
    new 
iFwd register_forward(FM_SetModel"SetModel"1)
    
engclient_cmd(0"drop""weapon_c4")
    
unregister_forward(FM_SetModeliFwd1)
}

public 
SetModelentmodel[] )
{
    if( 
equal(model"models/w_backpack.mdl") )
    {
        
call_think(ent)
        
message_begin(MSG_ALLgmsgBombPickup)
        
message_end()
    }



Lolz0r 05-20-2012 16:24

Re: [Suggestion] Better method
 
Yes, this one really looks better and doens't shows every time that the bomb is dropped (and she is), which is very good.

Actually I think this method (with bomb) has some prons, and he is that at round end terrorirst's don't get any money compared to ct's. And till I tested, I was thinking for method, which will be more for fairness everyone: after round end from both teams (every player) to be taken 200$ for example, but this isn't the place for me to want it, this is "scripting help". Im just saying it like idea. :)

Thank for this!

ConnorMcLeod 05-20-2012 17:12

Re: [Suggestion] Better method
 
Could alternate T win and CT win, but would need to use Rage module, or maybe arkshine round terminator can do such a thing, dunno, try it.


All times are GMT -4. The time now is 00:19.

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