Raised This Month: $32 Target: $400
 8% 

Doing ladder


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-16-2008 , 14:54   Doing ladder
Reply With Quote #1

yes i saw many theards about it.. but i think i found a way how to do it

My idea is spawn info_null, and give mins/maxs, and give him classname or something, then check if player touching it - set velocity[2] to 250.0 (ah yea check the player pressing moving keys or no ? then add sounds and so on, also spawn at same place the model or skin or something else)

Have fun! 2morrow i will try todo something too
__________________
xPaw is offline
Old 12-17-2008, 14:51
xPaw
This message has been deleted by xPaw.
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-18-2008 , 07:18   Re: Doing ladder
Reply With Quote #2

omg! i did it climbable, kinda weird, but i can climb on it + hear the ladder sounds!
PHP Code:
#include <amxmodx>
#include <fakemeta_util>

#pragma semicolon 1

#define MODEL "models/ladder.mdl"

// ladder dimensions
new Float:gLadderMinY[3] = {-32.0,-4.0,-32.0};
new 
Float:gLadderMaxY[3] = { 32.04.032.0};

new 
bool:gOnLadder[33];

public 
plugin_init() {
    
register_plugin("Ladder""1.0""xPaw");
    
    
register_clcmd("say .ladder""cmdCreateLadder");
    
register_clcmd("say .removeladder""cmdDeleteLadder");
    
    
register_forwardFM_PlayerPreThink"fwdPlayerPreThink");
    
register_forwardFM_Touch"fwdTouch" );
}

public 
plugin_precache()
    
precache_modelMODEL );

public 
fwdPlayerPreThink(id) {
    if ( 
is_user_alive(id)) {
        if( 
gOnLadder[id] ) {
            new 
Float:velocity[3];
            
pev(idpev_velocityvelocity);
            
            if ( (
pev(idpev_button) & IN_FORWARD) && (velocity[0] == 0.0 || velocity[1] == 0.0) ) {
                
velocity[2] = 250.0;
                
set_pev(idpev_velocityvelocity);
            }
            
gOnLadder[id] = false;
        }
        
        new 
entbody;
        
get_user_aiming(identbody320);
        
        if (
isLadder(ent)) {
            
set_hudmessage(025255, -1.0, -0.9001.01.00.20.21);
            
show_hudmessage(id"First In-Game Ladder.");
        }
    }
}

public 
fwdTouch(entid) {
    if (
is_user_alive(id) && isLadder(ent)) {
        
set_pev(idpev_movetypeMOVETYPE_FLY);
        
        
gOnLadder[id] = true;
        
        
// Velocity way
        
new Float:velocity[3];
        
pev(idpev_velocityvelocity);
        
        if ( (
pev(idpev_button) & IN_FORWARD) && (velocity[0] == 0.0 || velocity[1] == 0.0) ) {
            
velocity[2] = 250.0;
            
set_pev(idpev_velocityvelocity);
        }
        
    }
}

public 
cmdCreateLadderid ) {
    if (
get_user_flags(id) & ADMIN_KICK) {
        new 
Float:vOrigin[3];
        new 
origin[3];
        
        
//get the origin of the player and add Z offset
        
get_user_origin(idorigin3);
        
IVecFVec(originvOrigin);
        
vOrigin[2] += 4.0;
        
        
createLaddervOrigin );
        
client_print(idprint_chat"* You Spawned Ladder, Have Fun! :-)");
    }
}

public 
cmdDeleteLadder(id) {
    if (
get_user_flags(id) & ADMIN_KICK) {
        new 
entbody;
        
get_user_aiming(identbody);
        
        if (
isLadder(ent)) {
            
fm_remove_entity(ent);
            
client_print(idprint_chat"* You Removed Ladder.");
        }
    }
}

createLadderFloat:vOrigin[3] ) {
    new 
ent fm_create_entity"info_target" );
    
    if (
fm_is_valid_ent(ent)) {
        
set_pev(entpev_classname"xpaw_ladder");
        
set_pev(entpev_solidSOLID_BBOX);
        
set_pev(entpev_movetypeMOVETYPE_NONE);
        
        new 
Float:vSizeMin[3];
        new 
Float:vSizeMax[3];
        new 
Float:vAngles[3];

        
vSizeMin gLadderMinY;
        
vSizeMax gLadderMaxY;
        
vAngles[0] = 90.0;
        
vAngles[2] = 90.0;
        
        
//adjust size min/max vectors depending on scale
        
for (new 03; ++i) {
            if (
vSizeMin[i] != 4.0 && vSizeMin[i] != -4.0)
                
vSizeMin[i] *= 1.0;
            
            if (
vSizeMax[i] != 4.0 && vSizeMax[i] != -4.0)
                
vSizeMax[i] *= 1.0;
        }
        
        
fm_entity_set_model(entMODEL);
        
set_pev(entpev_anglesvAngles);
        
fm_entity_set_size(entvSizeMinvSizeMax);
        
fm_entity_set_origin(entvOrigin);
        
        return 
ent;
    }
    
    return 
0;
}

bool:isLadder(ent) {
    if (
fm_is_valid_ent(ent)) {
        new 
szClassname[32];
        
pev(entpev_classnameszClassname32);
        
        if (
equal(szClassname"xpaw_ladder"))
            return 
true;
    }
    return 
false;

Attached Files
File Type: zip ladder_model.zip (1.6 KB, 412 views)
__________________
xPaw is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-18-2008 , 08:49   Re: Doing ladder
Reply With Quote #3

I quess you can't never make a perfect ladder. Because you don't do it same way it's done in maps, it's not possible.
SnoW is offline
Send a message via MSN to SnoW
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-18-2008 , 09:17   Re: Doing ladder
Reply With Quote #4

yes, but its a progress so i did it climbable anyway oO
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-18-2008 , 10:27   Re: Doing ladder
Reply With Quote #5

My attempt is not perfect (yet ?), i don't manage to stay with 0 velocity and also my velocity calculation is not perfect (yet ?).
I will need a model if i manage to code this better.
Attached Files
File Type: zip demo2.zip (265.2 KB, 332 views)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 12-18-2008 , 11:19   Re: Doing ladder
Reply With Quote #6

Good job xPaw!
__________________
minimiller is offline
Send a message via MSN to minimiller
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-18-2008 , 11:34   Re: Doing ladder
Reply With Quote #7

I have a good idea on how to get the velocity right, just let me get on my other computer in about 15 minutes.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-18-2008 , 11:37   Re: Doing ladder
Reply With Quote #8

oke lets do LadderMaker, when do ladder perfect
__________________
xPaw is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-18-2008 , 12:23   Re: Doing ladder
Reply With Quote #9

Here is my idea for simulating the ladder movement.
I didn't add the ladder making to it cause I got lazy.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 03-09-2009 at 22:55.
Exolent[jNr] is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-18-2008 , 12:34   Re: Doing ladder
Reply With Quote #10

Exolent watch demo of your plugin work

P.S. Download model.
Attached Files
File Type: zip Exolent_Crazy_Ladder.zip (403.1 KB, 467 views)
__________________
xPaw is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:37.


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