Raised This Month: $51 Target: $400
 12% 

Giving ALL players godmode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Riri
New Member
Join Date: Oct 2017
Location: England
Old 12-19-2017 , 21:47   Giving ALL players godmode
Reply With Quote #1

I'm trying to make a plugin that will allow ALL players on the server to not take damage for that round, without using sv_cheats.

I was going to do it through console but I have found playercommands (god etc) do not work. Any way I can do this?
Riri is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-19-2017 , 21:51   Re: Giving ALL players godmode
Reply With Quote #2

Is this a scripting question? Or is it a plugin request?
If it's a scripting question please post what you have currently so we can help you
__________________
8guawong is offline
Riri
New Member
Join Date: Oct 2017
Location: England
Old 12-19-2017 , 21:54   Re: Giving ALL players godmode
Reply With Quote #3

It's a scripting question, there isn't a problem within the code just me wanting to know a way of giving godmode through console as player commands don't seem to work.
Riri is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 12-19-2017 , 22:01   Re: Giving ALL players godmode
Reply With Quote #4

Take a look at Deluxe Godmode's source for reference.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 12-20-2017 , 07:09   Re: Giving ALL players godmode
Reply With Quote #5

PHP Code:

for(new i=1;<= MaxClients;i++)
{
    if(!
IsClientInGame(i))
        continue;

    else if(
IsFakeClient(i))
        continue;

    new 
flags GetCommandFlags("god");
    
SetCommandFlags("god"flags & ~FCVAR_CHEAT);
    
FakeClientCommand(i"god 1");
    
SetCommandFlags("god"flags);

May not work, gimme results.

To disable, exact same code but with "god 0" replacing "god 1"

Last edited by eyal282; 12-20-2017 at 07:10.
eyal282 is offline
Riri
New Member
Join Date: Oct 2017
Location: England
Old 12-20-2017 , 12:00   Re: Giving ALL players godmode
Reply With Quote #6

Quote:
Originally Posted by eyal282 View Post
PHP Code:

for(new i=1;<= MaxClients;i++)
{
    if(!
IsClientInGame(i))
        continue;

    else if(
IsFakeClient(i))
        continue;

    new 
flags GetCommandFlags("god");
    
SetCommandFlags("god"flags & ~FCVAR_CHEAT);
    
FakeClientCommand(i"god 1");
    
SetCommandFlags("god"flags);

May not work, gimme results.

To disable, exact same code but with "god 0" replacing "god 1"
I will give this a go when I can, I will edit this post with the results
Riri is offline
neatek
AlliedModders Donor
Join Date: Jul 2010
Location: Russia
Old 12-20-2017 , 13:05   Re: Giving ALL players godmode
Reply With Quote #7

Easiest way
But dont forget for a NewSyntax!
PHP Code:
public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    
damage 0.0;
    return 
Plugin_Changed;

Or:
PHP Code:
bool g_NoDamage[MAXPLAYERS+1];

public 
void NoDamage(int clientbool status) {
    
g_NoDamage[client] = status;
}

public 
OnClientPutInServer(int client// new syntax needed!
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype// new syntax needed!
{
    if(
g_NoDamage[victim]) {
        
damage 0.0;
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;
}

NoDamage(clienttrue);
NoDamage(clientfalse); 

Good luck!
__________________

Last edited by neatek; 12-20-2017 at 13:11.
neatek is offline
Reply



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 14:01.


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