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

[SOLVED] read_data doesn't return value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 01-23-2016 , 17:00   [SOLVED] read_data doesn't return value
Reply With Quote #1

I Hook Event:
PHP Code:
register_event("DeathMsg""Event_PlayerDeath""a"
My CallBack:
PHP Code:
public Event_PlayerDeath()
{
    
server_print("%d | %d | %d"read_data(0), read_data(1), read_data(2))

But every killing my console output:
Code:
0 | 0 | 0
P.S. This problem begun after when i update Amx Mod X in 1 8.3

Last edited by Vit_amin; 01-23-2016 at 21:32.
Vit_amin is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-23-2016 , 17:16   Re: read_data doesn't return value
Reply With Quote #2

Works fine for me on my current 1.8.3 build
Code:
0 | 1 | 4
But you should be using 1,2,3 and not 0,1,2

DeathMsg
Structure:
1 = byte KillerID
2 = byte VictimID
3 = byte IsHeadshot
4 = string TruncatedWeaponName
__________________

Last edited by Bugsy; 01-23-2016 at 17:18.
Bugsy is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 01-23-2016 , 17:22   Re: read_data doesn't return value
Reply With Quote #3

Fixed mistake, however output console too
Vit_amin is offline
Old 01-23-2016, 17:37
Vit_amin
This message has been deleted by Vit_amin.
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-23-2016 , 17:42   Re: read_data doesn't return value
Reply With Quote #4

Is there a reason you aren't doing the RoundEndCondition checks in the PlayerDeath forward? Why the 0.1 task?
__________________
Bugsy is offline
Old 01-23-2016, 17:45
Vit_amin
This message has been deleted by Vit_amin.
Old 01-23-2016, 17:47
Vit_amin
This message has been deleted by Vit_amin.
Old 01-23-2016, 17:49
Vit_amin
This message has been deleted by Vit_amin.
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 01-23-2016 , 18:31   Re: read_data doesn't return value
Reply With Quote #5

HOW it's possible ....
Where is my mistake ??????
PHP Code:
public Event_PlayerDeath()
{
    new 
szArgs[2]
    new 
attacker read_data(1)
    new 
client read_data(2)
    
server_print("%d | %d"clientattacker)
    
num_to_str(attackerszArgs1)
    
num_to_str(clientszArgs2)
    
server_print("DEBUG ------------------ %s | Client: %s"szArgs[0], szArgs[1])
    
set_task(0.1"Timer_RoundEndCondition"1024szArgs2)
}

public 
Timer_RoundEndCondition(args[])
{
    
server_print("Attacker: %d | Client: %d"str_to_num(args[0]), str_to_num(args[1]))

Output:
Code:
24 | 3
DEBUG ------------------ 24 | Client: 4
L 01/24/2016 - 01:29:19: "Chet<3><BOT><CT>" killed "[Zombie] Tony<24><BOT><TERRORIST>" with "m4a1"
Attacker: 24 | Client: 4
Vit_amin is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-23-2016 , 19:12   Re: read_data doesn't return value
Reply With Quote #6

First of all, you need to learn how to use the edit button. It's there for a reason. Explain what you're trying to accomplish.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 01-23-2016 , 19:18   Re: read_data doesn't return value
Reply With Quote #7

Please read the output to the console
Code:
Debug #1 Client ID (iVictim) 24 | Attacker ID (iKiller) 3
DEBUG ------------------ Client ID (iVictim) 24 | Attacker ID (iKiller) Client: 4
Console Log Output L 01/24/2016 - 01:29:19: "Chet<3><BOT><CT>" killed "[Zombie] Tony<24><BOT><TERRORIST>" with "m4a1"
Attacker: 24 | Client: 4

Last edited by Vit_amin; 01-23-2016 at 19:19.
Vit_amin is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-23-2016 , 20:19   Re: read_data doesn't return value
Reply With Quote #8

You are overwriting attacker with client:
num_to_str(attacker, szArgs, 1)
num_to_str(client, szArgs, 2)

You are telling it to write attacker into szArgs as a string and the max chars that can fit is 1.
You are then telling it to write client into szArgs as a string and the max chars that can fit is 2.
They are both getting written to szArgs so only the client string is there in the end.

Also, you should not be storing this data as a string, use integers
PHP Code:
new iArgs];
iArgs] = attacker;
iArgs] = client;
//Again, why are you using set_task()?
set_task(0.1"Timer_RoundEndCondition"1024iArgs sizeofiArgs) ) 
__________________

Last edited by Bugsy; 01-23-2016 at 20:28.
Bugsy is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 01-23-2016 , 20:19   Re: read_data doesn't return value
Reply With Quote #9

Guys help me Please, i don't know what is it ...
Why Client Index different's
Vit_amin is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 01-23-2016 , 20:22   Re: read_data doesn't return value
Reply With Quote #10

I have this piece of code a long time not touched, but I think I've had problems there that did not end the round
Vit_amin 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 00:57.


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