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

Noclip without godmode?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
proffs
Senior Member
Join Date: Jul 2013
Old 07-14-2015 , 13:11   Noclip without godmode?
Reply With Quote #1

I am trying to give all Terrorist on the server noclip without godmode so they CAN be killed.

PHP Code:
        new iTeam GetClientTeam(client);
    
        if(
iTeam == CS_TEAM_T)
        {
            
SetEntityHealth(client100);
            
SetEntityMoveType(clientMOVETYPE_NOCLIP);
            
SetEntProp(client,Prop_Data,"m_takeDamage",0,1);  
        }     
        else if(
iTeam == CS_TEAM_CT)
        {    
            
SetEntityHealth(client100);
            
GivePlayerItem(client"weapon_scout");
        } 
__________________

Last edited by proffs; 07-14-2015 at 13:15.
proffs is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 07-14-2015 , 15:37   Re: Noclip without godmode?
Reply With Quote #2

Fairly certain that the final argument for your SetEntProp needs to be 2. 0 is godmode and 1 is Buddha mode (IIRC)
__________________
ddhoward is offline
proffs
Senior Member
Join Date: Jul 2013
Old 07-14-2015 , 16:37   Re: Noclip without godmode?
Reply With Quote #3

PHP Code:
SetEntProp(client,Prop_Data,"m_takeDamage",0,2); 
Like this?
__________________
proffs is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 07-14-2015 , 16:42   Re: Noclip without godmode?
Reply With Quote #4

SetEntProp(client, Prop_Data, "m_takeDamage", 2, 1);
Miu is offline
proffs
Senior Member
Join Date: Jul 2013
Old 07-14-2015 , 16:45   Re: Noclip without godmode?
Reply With Quote #5

Quote:
Originally Posted by Miu View Post
SetEntProp(client, Prop_Data, "m_takeDamage", 2, 1);
Thank you! One more question how can I strip clients weapon before giving them a weapon?

In CS 1.6 I simply use
PHP Code:
strip_user_weaponsid 
__________________
proffs is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 07-14-2015 , 17:40   Re: Noclip without godmode?
Reply With Quote #6

PHP Code:
int slot GetPlayerWeaponSlot(client0); if(slot != -1RemoveEdict(slot); 
should remove the primary weapon
Miu is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 07-15-2015 , 18:29   Re: Noclip without godmode?
Reply With Quote #7

Code:
#include <sdktools>

int iOffset = FindDataMapOffs(iClient, "m_hMyWeapons") - 4;

for (int i; i < 48; i++)
{
    iOffset += 4;

    int iWeapon = GetEntDataEnt2(iClient, iOffset);
    
    if (iWeapon <= 0) continue;

    if (RemovePlayerItem(iClient, iWeapon)) AcceptEntityInput(iWeapon, "Kill");
}


This was originally taken from SMLIB. I've changed it a bit, I think. This will take away every weapon a client has (knife, primary + secondary, grenades, equip, etc).

Last edited by Marcus_Brown001; 07-15-2015 at 18:30.
Marcus_Brown001 is offline
thorgot
AlliedModders Donor
Join Date: Aug 2013
Old 07-16-2015 , 00:18   Re: Noclip without godmode?
Reply With Quote #8

The damage thing doesn't work. Even with m_takedamage 2 you don't take damage in noclip.

Edit: a thought. You could hook damage, which probably happens to a certain degree because blood shows up, subtract that from the players health manually, and drop them out of noclip if they would go below 1hp.

Edit: An easier way which I've now tested and works is to set movetype to MOVETYPE_WALK in a pre damage hook and back to MOVETYPE_NOCLIP in a post damage hook.

Last edited by thorgot; 07-17-2015 at 12:24.
thorgot is offline
proffs
Senior Member
Join Date: Jul 2013
Old 07-18-2015 , 18:00   Re: Noclip without godmode?
Reply With Quote #9

Quote:
Originally Posted by thorgot View Post
The damage thing doesn't work. Even with m_takedamage 2 you don't take damage in noclip.

Edit: a thought. You could hook damage, which probably happens to a certain degree because blood shows up, subtract that from the players health manually, and drop them out of noclip if they would go below 1hp.

Edit: An easier way which I've now tested and works is to set movetype to MOVETYPE_WALK in a pre damage hook and back to MOVETYPE_NOCLIP in a post damage hook.
Could you do a example for me? Since I am pretty new I would love to review the code and learn from it!
__________________
proffs is offline
thorgot
AlliedModders Donor
Join Date: Aug 2013
Old 07-19-2015 , 18:29   Re: Noclip without godmode?
Reply With Quote #10

The version I had was for war3 so it was slightly different, but something like this should work:

Code:
new bool:noclip[MaxClients];

public OnClientPutInServer(client)
{
    SDKHook(client, SDKHook_OnTakeDamage, SDK_Forwarded_OnTakeDamage);
    SDKHook(client, SDKHook_OnTakeDamagePost, OnTakeDamagePostHook);
    noclip[client] = false;
}
public OnClientDisconnect(client)
{
    SDKUnhook(client, SDKHook_OnTakeDamage, SDK_Forwarded_OnTakeDamage);
    SDKUnhook(client, SDKHook_OnTakeDamagePost, OnTakeDamagePostHook); 
}

public Action:SDK_Forwarded_OnTakeDamage(victim,&attacker,&inflictor,&Float:damage,&damagetype)
{
    if (ValidPlayer(victim) && GetEntityMoveType(victim) == MOVETYPE_NOCLIP)
    {
        SetEntityMoveType(victim, MOVETYPE_WALK);
    }
}

public OnTakeDamagePostHook(victim, attacker, inflictor, Float:damage, damagetype, weapon, const Float:damageForce[3], const Float:damagePosition[3])
{
    if (ValidPlayer(victim, true) && noclip[client] && GetEntityMoveType(victim) != MOVETYPE_NOCLIP)
    {
        SetEntityMoveType(victim, MOVETYPE_NOCLIP);
        SetEntProp(victim, Prop_Data, "m_takedamage", 2, 1); //Not sure if necessary
   }
}

stock bool:ValidPlayer(client,bool:check_alive=false,bool:alivecheckbyhealth=false) {
    if(client>0 && client<=MaxClients && IsClientConnected(client) && IsClientInGame(client))
    {
        if(check_alive && !IsPlayerAlive(client))
        {
            return false;
        }
        if(alivecheckbyhealth&&GetClientHealth(client)<1) {
            return false;
        }
        return true;
    }
    return false;
}

    //Your code somewhere
    SetEntityMoveType(client, MOVETYPE_NOCLIP);
    noclip[client] = true;
    SetEntProp(client, Prop_Data, "m_takedamage", 2, 1); //Not sure if necessary
thorgot 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 13:24.


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