AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to set user can't on ladder (https://forums.alliedmods.net/showthread.php?t=182940)

wwzw 04-15-2012 13:01

How to set user can't on ladder
 
I want to block one or some player climbed the ladder, but I do not know how to do it!
Please help me, thanks!

Exolent[jNr] 04-15-2012 14:09

Re: How to set user can't on ladder
 
Hook when player touches ladder and block it.

wwzw 04-16-2012 00:43

Re: How to set user can't on ladder
 
Thank you for your help, but I can not get the event of player contact with the ladder.
I tried the code:
PHP Code:

RegisterHam(Ham_Touch"player""Ham_Touch_Ladder_Pre"0);
RegisterHam(Ham_Touch"player""Ham_Touch_Ladder_Pre"1);
public 
Ham_Touch_Ladder_Pre(id,ent)
{
 if (
is_user_alive(id)) {
  new 
classname[32]
  
pev(ent,pev_classname,classname,31)
  
client_print(idprint_chat"=======Touch===Test====%s====",classname);
 }


And:
PHP Code:

register_forwardFM_Touch"fwdTouch" );
public 
fwdTouch(entid) { 
 if (
is_user_alive(id)) {
  new 
classname[32]
  
pev(ent,pev_classname,classname,31)
  
client_print(idprint_chat"=======Touch===Test====%s====",classname);
 } 


But all fails, please continue to help me!

rak 04-16-2012 01:59

Re: How to set user can't on ladder
 
func_ladder and check if is valid ent

wwzw 04-16-2012 03:09

Re: How to set user can't on ladder
 
Please tell me exactly how to do and code demonstration!


register_touch( "player", "func_ladder", "FwdTouchLadder" );
public FwdTouchLadder(id, ent)
{
client_print(0, print_chat, "=======Touch===%d====%d====",id,ent);
}

The above code does not work...

rak 04-16-2012 07:32

Re: How to set user can't on ladder
 
sorry; now i see this

Code:

This is an internal entity. When the map is compiled by VBSP it is processed and then removed: it does not exist when the map is running.

Quote:

Originally Posted by Exolent[jNr] (Post 833435)
If a player is on a ladder, his move type will be fly.
Code:
// at the top of your plugin #define IsOnLadder(%1) (entity_get_int(%1, EV_INT_movetype) == MOVETYPE_FLY) // in your plugin if( IsOnLadder(index) ) {     // player is on a ladder }
That code requires the engine module.

Quote:

Originally Posted by xPaw (Post 833529)
PHP Code:

#define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY) 



wwzw 04-16-2012 08:01

Re: How to set user can't on ladder
 
Yes, I have been tried.But my purpose is to prevent players climb the ladder.

if( IsOnLadder(index) )
{
// How can I stop or let him down?
}

rak 04-16-2012 08:56

Re: How to set user can't on ladder
 
PHP Code:

#include < amxmodx >
#include < engine >

public plugin_init( ) {
    
register_plugin"Disable func_ladder""0.0.1""Exolent" );
    
    new 
iEntity;
    while( ( 
iEntity find_ent_by_class( -1"func_ladder" ) ) ) {
        
remove_entityiEntity );
    }



i found this and work xD

Backstabnoob 04-16-2012 09:31

Re: How to set user can't on ladder
 
All that does is remove all the ladders from the map. He asked for blocking the passage, not removing them.

Exolent[jNr] 04-16-2012 10:57

Re: How to set user can't on ladder
 
Try this.

Requirements:
- Orpheu
- PM Functions pack

Code:
#include <amxmodx> #include <orpheu> #include <orpheu_stocks> new gHideLadder; #define CanSeeLadder(%1) (~gHideLadder &   (1 << (%1 & 31))) #define HideLadder(%1)     gHideLadder |=  (1 << (%1 & 31)) #define ShowLadder(%1)     gHideLadder &= ~(1 << (%1 & 31)) new OrpheuStruct:ppmove; public plugin_init() {     register_plugin("Ladder Disabler", "0.0.1", "Exolent");         register_clcmd("say /ladder", "CmdLadder");         OrpheuRegisterHook(OrpheuGetDLLFunction("pfnPM_Move", "PM_Move"), "PM_Move");     OrpheuRegisterHook(OrpheuGetFunction("PM_Ladder"), "PM_Ladder"); } public client_disconnect(id) {     ShowLadder(id); } public CmdLadder(id) {     if(CanSeeLadder(id)) {         HideLadder(id);                 client_print(id, print_chat, "* Ladders are now unusable.");     } else {         ShowLadder(id);                 client_print(id, print_chat, "* Ladders are now usable.");     } } public OrpheuHookReturn:PM_Move(OrpheuStruct:_ppmove, server) {     ppmove = _ppmove; } public OrpheuHookReturn:PM_Ladder() {     new id = OrpheuGetStructMember(ppmove, "player_index") + 1;         if(!CanSeeLadder(id)) {         OrpheuSetReturn(0);         return OrpheuOverride;     }         return OrpheuIgnored; }


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

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