AlliedModders

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

r14170 08-10-2011 13:31

Noclip
 
Is it possible to make when you are with noclip you can't go throught walls and if so how?

ConnorMcLeod 08-10-2011 13:48

Re: Noclip
 
Quote:

Originally Posted by r14170 (Post 1529703)
Is it possible to make when you are with noclip you can't go throught walls and if so how?

This is called fly mode (MOVE_FLY)

Code:

// pev(entity, pev_movetype) values
#define        MOVETYPE_NONE                  0          // Never moves
#define        MOVETYPE_WALK                  3          // Player only - moving on the ground
#define        MOVETYPE_STEP                  4          // Gravity, special edge handling -- monsters use this
#define        MOVETYPE_FLY                    5          // No gravity, but still collides with stuff
#define        MOVETYPE_TOSS                  6          // Gravity/Collisions
#define        MOVETYPE_PUSH                  7          // No clip to world, push and crush
#define        MOVETYPE_NOCLIP                8          // No gravity, no collisions, still do velocity/avelocity
#define        MOVETYPE_FLYMISSILE            9          // Extra size to monsters
#define        MOVETYPE_BOUNCE                10          // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE          11          // Bounce w/o gravity
#define MOVETYPE_FOLLOW                12          // Track movement of aiment
#define        MOVETYPE_PUSHSTEP              13          // BSP model that needs physics/world collisions (uses nearest hull for world collision)


r14170 08-10-2011 14:42

Re: Noclip
 
how do i set movetype_fly to a player?

Exolent[jNr] 08-10-2011 14:45

Re: Noclip
 
Quote:

Originally Posted by r14170 (Post 1529771)
how do i set movetype_fly to a player?

You have to constantly set it in PreThink, maybe also PostThink.

abdul-rehman 08-10-2011 14:55

Re: Noclip
 
Quote:

Originally Posted by Exolent[jNr] (Post 1529774)
You have to constantly set it in PreThink, maybe also PostThink.

Wont it work if we set it one time (like playerspawn)

Exolent[jNr] 08-10-2011 15:01

Re: Noclip
 
Quote:

Originally Posted by abdul-rehman (Post 1529779)
Wont it work if we set it one time (like playerspawn)

No. Player movetype is constantly forced to walk if it is not walk or noclip.
Therefore, to set a different movetype, we have to constantly override this setting.

ConnorMcLeod 08-10-2011 15:12

Re: Noclip
 
Quote:

Originally Posted by Exolent[jNr] (Post 1529785)
No. Player movetype is constantly forced to walk if it is not walk or noclip.
Therefore, to set a different movetype, we have to constantly override this setting.

This is done in PM_PlayerMove, set in PostThink only should be enough.

Exolent[jNr] 08-10-2011 15:16

Re: Noclip
 
Quote:

Originally Posted by ConnorMcLeod (Post 1529795)
This is done in PM_PlayerMove, set in PostThink only should be enough.

I can't look at those references while at work, since everything I have scripting related is at home.
I remembered about making my fake ladder plugin, I had to set move type in PreThink (or PostThink, not sure) to make it work.

r14170 08-10-2011 16:36

Re: Noclip
 
lol, tryed 2-3 ways but i cant get it to work
this way i cant even go in-game :D
Code:


/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>


#define PLUGIN "plugin name"
#define VERSION "0.1"
#define AUTHOR "R14170"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_clcmd("say /noclip", "nocliptest");
        register_clcmd("say /nc", "nocliptest");
        // Add your code here...
}

public client_PreThink(id)
{
        if (get_user_noclip(id))
        {
                new ent = find_ent_by_class(id, "player");
                entity_set_int(ent, EV_INT_movetype, 1) == MOVETYPE_FLY
        }
}

public nocliptest(id)
{
        if(get_user_noclip(id) == 1)
        {
                set_user_noclip(id, 1)
        }
       
        if(is_user_alive(id) && !is_user_bot(id))
        {
                set_user_noclip(id, 1)
        }
        else
        {
                client_print(id, print_chat, "You cant use no clip when you are dead")
        }
}

help someone?

ConnorMcLeod 08-10-2011 17:01

Re: Noclip
 
It doesn't seem to work. Search for flightmode plugin and look at its code.


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

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