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

hooking game start or messages


Post New Thread Reply   
 
Thread Tools Display Modes
killerZM
Senior Member
Join Date: Sep 2016
Old 09-15-2017 , 17:49   Re: hooking game start or messages
Reply With Quote #21

up

Last edited by killerZM; 09-15-2017 at 17:49.
killerZM is offline
Beqa Gurgenidze
BANNED
Join Date: Nov 2016
Old 09-16-2017 , 03:31   Re: hooking game start or messages
Reply With Quote #22

Quote:
Originally Posted by killerZM View Post
thank you

how to hook player entity in write byte ?
Theres only one message at time, if you create global variable of edict pointer and store there player from MessageBegin function, you will be able to use it in any WRITE_* functions.

Last edited by Beqa Gurgenidze; 09-16-2017 at 03:32.
Beqa Gurgenidze is offline
killerZM
Senior Member
Join Date: Sep 2016
Old 09-17-2017 , 10:11   Re: hooking game start or messages
Reply With Quote #23

ok thanks
i need to do something like that
when player die give the attacker 3000$
but i tried to do get the first byte in deathmsg then use MESSAGE_BEGIN to write player money it give error
"Another message has been sent before msg "23" had been sent"
killerZM is offline
Beqa Gurgenidze
BANNED
Join Date: Nov 2016
Old 09-18-2017 , 12:10   Re: hooking game start or messages
Reply With Quote #24

Quote:
Originally Posted by killerZM View Post
ok thanks
i need to do something like that
when player die give the attacker 3000$
but i tried to do get the first byte in deathmsg then use MESSAGE_BEGIN to write player money it give error
"Another message has been sent before msg "23" had been sent"
you used message begin when message was not ended (deathmsg) that is an error of course.
you need to write your own BYTE & use RETURN_META(MRES_SUPERCEDE); in WRITE_BYTE hooked function.
or block whole message & get its own values & after end of message, call your own.

Last edited by Beqa Gurgenidze; 09-18-2017 at 12:13.
Beqa Gurgenidze is offline
killerZM
Senior Member
Join Date: Sep 2016
Old 09-18-2017 , 13:26   Re: hooking game start or messages
Reply With Quote #25

can you show me example ?
killerZM is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 09-18-2017 , 14:39   Re: hooking game start or messages
Reply With Quote #26

Use this as a base.

You should BLOCK the target message, read/store values on each WriteXXX and then (after MessageEnd) issue your custom message.

PHP Code:
#include "sdk/amxxmodule.h"

#define BLOCK_NOT 0
#define BLOCK_ONCE 1
#define BLOCK_SET 2

int inblock;
int msgBlocks[256] = {BLOCK_NOT};
int msgType;

extern int gmsgMOTD;

void SetMsgBlock(int msgidint block)
{
        if(
msgid && msgid 256)
                
msgBlocks[msgid] = block;
}

void MessageBegin(int msg_destint msg_type, const float *pOriginedict_t *ed)
{
        
msgType msg_type;
        if(
msgBlocks[msg_type])
        {
                
inblock 1;
                
RETURN_META(MRES_SUPERCEDE);
        }
        else
        {
                
inblock 0;
        }

        
RETURN_META(MRES_IGNORED);
}

void WriteByte(int iValue)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void WriteChar(int iValue)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void WriteShort(int iValue)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void WriteLong(int iValue)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void WriteAngle(float flValue)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void WriteCoord(float flValue)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void WriteString(const char *sz)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void WriteEntity(int iValue)
{
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED);
}

void MessageEnd(void)
{
        if(
msgBlocks[msgType] == BLOCK_ONCE)
                
msgBlocks[msgType] = BLOCK_NOT;

        if(
inblock)
        {
                
inblock 0;
                
RETURN_META(MRES_SUPERCEDE);
        }
        
inblock 0;

        
RETURN_META(MRES_IGNORED);

__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 09-18-2017 at 14:44.
joropito is offline
Send a message via MSN to joropito
killerZM
Senior Member
Join Date: Sep 2016
Old 09-18-2017 , 14:46   Re: hooking game start or messages
Reply With Quote #27

if i understand well
i do what you do in WRITE_XXX then maybe do variable to store bytes or what ?
PHP Code:
 void WriteByte(int iValue

        
my_variable_that_store[msgtype] = Ivalue 
        
RETURN_META(inblock MRES_SUPERCEDE MRES_IGNORED); 

and make a variable for every WRITE_and store them
killerZM is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 09-18-2017 , 15:04   Re: hooking game start or messages
Reply With Quote #28

you don't need to store every argument, only the one you need. If you want to then send the message as it was, you would need every value.

The main thing... you have to block the whole message if you want to send something before it.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
killerZM
Senior Member
Join Date: Sep 2016
Old 09-18-2017 , 15:13   Re: hooking game start or messages
Reply With Quote #29

i think u didn't understand me or i understand wrong
i need a code or a way to when a user is killed give the attacker 1000$
or maybe another thing when the user weapon is knife replace knife word with zombie or something
so it will be like that killer killed joropito with zombie
does ur way do that ?

Last edited by killerZM; 09-18-2017 at 15:15.
killerZM 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 05:01.


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