AlliedModders

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

GXLZPGX 08-05-2010 09:38

Edited
 
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_task60.0"TASK_PushButton"TASKID )
    
RegisterHamHam_Use"func_button""HAM_Button_Pushed")
}

public 
EVENT_NewRound()
{
    
remove_taskTASKID )
    
set_task60.0"TASK_PushButton"TASKID )
}

public 
HAM_Button_PushediButton // someone pushed a button, so see if it's the button used to open cells
{
    new 
targ[32]
    
peviButtonpev_targettarg31 // get name of what the button affects
    
    
new target engfuncEngFunc_FindEntityByString0"targetname"targ // get ent that is affected
    
    
    
if( !pev_validtarget ) )
        return;
        
    new 
classname[32]
    
pevtargetpev_classnameclassname31 // func_door, func_button, worldspawn, etc.
    
    
if( equalclassname"func_door" ) ) // if button pushed opened a door
    
{
        
remove_taskTASKID // stop the task from auto-opening
    
}
}

public 
TASK_PushButton() // do freeday shit
{
    
client_print_color0Blue"^4[Jailbreak] ^1It's a freeday!" )
    
Push_Button() // open all cells
}

public 
CMD_PushButtonidlevelcid )
{
    if( !
cmd_accessidlevelcid) ) // no access
    
{
        return 
PLUGIN_HANDLED
    
}
    
    else
    {
        new 
name[32]
        
get_user_nameidname31 )
        
        
client_print_color0Blue"^4[Jailbreak] ^1ADMIN^4 %s ^1opened the cells^4!" )
        
Push_Button() // open cells
        
        
remove_taskTASKID )
    }
    
    return 
PLUGIN_HANDLED
}

/* ----- joropito ----- */

public Push_Button() 

        new 
ent 
        
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_FindEntityByStringent"classname""info_player_deathmatch"))) // info_player_deathmatch = tspawn
        

                new 
ent2 
                pev
(entpev_originorigin
                while((
ent2 engfunc(EngFunc_FindEntityInSphereent2originradius)))  // find doors near T spawn
                

                        if(!
pev_valid(ent2)) 
                                continue 

                        
pev(ent2pev_classname, class, charsmax(class)) 
                        if(!
equal(class, "func_door")) // if it's not a door, move on to the next iteration
                                
continue 

                        
pev(ent2pev_targetnamenamecharsmax(name)) 
                        
ent3 engfunc(EngFunc_FindEntityByString0"target"name// find button that opens this door
                        
if(pev_valid(ent3) && (in_array(ent3foundsizeof(found)) < 0)) 
                        { 
                                
ExecuteHamB(Ham_Useent30011.0// zomg poosh it
                                
found[pos] = ent3 
                                pos
++ // next
                                
break // break from current while loop
                        

                } 
        } 
        return 
pos 


stock in_array(needledata[], size

        for(new 
0sizei++) 
        { 
                if(
data[i] == needle
                        return 

        

        return -

}  
/* 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?


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

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