|
Veteran Member
|

08-05-2010
, 09:38
Edited
|
#1
|
Alright, so I took wrecked_'s auto cell opener and edited it.
PHP Code:
#include <amxmodx>
#include <amxmisc> // dumb access command...
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <chatcolor>
#include <fun>
#define TASKID 1996
new found[10]
public plugin_init()
{
register_concmd( "amx_open", "CMD_PushButton", ADMIN_KICK )
register_event( "HLTV", "EVENT_NewRound", "a", "1=0", "2=0" )
set_task( 60.0, "TASK_PushButton", TASKID )
RegisterHam( Ham_Use, "func_button", "HAM_Button_Pushed", 1 )
}
public EVENT_NewRound()
{
remove_task( TASKID )
set_task( 60.0, "TASK_PushButton", TASKID )
}
public HAM_Button_Pushed( iButton ) // someone pushed a button, so see if it's the button used to open cells
{
new targ[32]
pev( iButton, pev_target, targ, 31 ) // get name of what the button affects
new target = engfunc( EngFunc_FindEntityByString, 0, "targetname", targ ) // get ent that is affected
if( !pev_valid( target ) )
return;
new classname[32]
pev( target, pev_classname, classname, 31 ) // func_door, func_button, worldspawn, etc.
if( equal( classname, "func_door" ) ) // if button pushed opened a door
{
remove_task( TASKID ) // stop the task from auto-opening
}
}
public TASK_PushButton() // do freeday shit
{
client_print_color( 0, Blue, "^4[Jailbreak] ^1It's a freeday!" )
Push_Button() // open all cells
}
public CMD_PushButton( id, level, cid )
{
if( !cmd_access( id, level, cid, 1 ) ) // no access
{
return PLUGIN_HANDLED
}
else
{
new name[32]
get_user_name( id, name, 31 )
client_print_color( 0, Blue, "^4[Jailbreak] ^1ADMIN^4 %s ^1opened the cells^4!" )
Push_Button() // open cells
remove_task( TASKID )
}
return PLUGIN_HANDLED
}
/* ----- joropito ----- */
public Push_Button()
{
new ent = 1
new ent3
new Float:origin[3]
new Float:radius = 200.0
new class[32]
new name[32]
new pos
while((pos <= sizeof(found)) && (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "info_player_deathmatch"))) // info_player_deathmatch = tspawn
{
new ent2 = 1
pev(ent, pev_origin, origin)
while((ent2 = engfunc(EngFunc_FindEntityInSphere, ent2, origin, radius))) // find doors near T spawn
{
if(!pev_valid(ent2))
continue
pev(ent2, pev_classname, class, charsmax(class))
if(!equal(class, "func_door")) // if it's not a door, move on to the next iteration
continue
pev(ent2, pev_targetname, name, charsmax(name))
ent3 = engfunc(EngFunc_FindEntityByString, 0, "target", name) // find button that opens this door
if(pev_valid(ent3) && (in_array(ent3, found, sizeof(found)) < 0))
{
ExecuteHamB(Ham_Use, ent3, 0, 0, 1, 1.0) // zomg poosh it
found[pos] = ent3
pos++ // next
break // break from current while loop
}
}
}
return pos
}
stock in_array(needle, data[], size)
{
for(new i = 0; i < size; i++)
{
if(data[i] == needle)
return i
}
return -1
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1044\\ f0\\ fs16 \n\\ par }
*/
for some reason, it executes about once.. then from then on, it will display the "[Jailbreak] Its a freeday" message but won't open the cells. It will also do the same with amx_open, it will display the message, but not open the cells. Any reason as to why it would do so?
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
|
|