Identity crisis
INTRO:
Hello there! I've been working on plugin that logs ingame events into a txt file for tf2 competitive purposes. I am new to sourcemod and sourcepawn. CONTEXT: While programming the events I have stumbled across various ways that tf2 returns player ids as default returns in those functions. Examples: event player_death - > short userid //user ID who died teamplay_capture_blocked - > byte blocker //index of the player that blocked the cap player_extinguished - > byte victim //entindex of the player that was extinguished killed_capping_player - > byte victim //index of the victim Question: Why do they differ? How do they differ? How do I convert each of them efficiently to SteamId64? Bonus question: In teamplay_point_captured there is: string cappers //string where each character is a player index of someone that capped It returns SMILEY FACE in server console. WHY? OUTRO: It has been one month with my adventure with sourcepawn. Is it the source that is so inconsistent or just the TF2 it self. I dont know, but its tough. Your help is very appreciated. |
Re: Identity crisis
here start
[TF2] Capture point message ...to convert Steamid64 ? https://sm.alliedmods.net/new-api/cl...ientAuthString https://sm.alliedmods.net/new-api/clients/AuthIdType PHP Code:
Just ask more if you have difficulty. Someone who have time to post here can help you. |
Re: Identity crisis
Quote:
Quote:
I wrote this function for the userid. PHP Code:
|
Re: Identity crisis
ok, good function.
But you need little bit understand more about userid's and client index's. client index or player index are entity index but, server allocate first numbers 1 to MaxClients for clients only. - Those are like server slots. Maximum number is 64 in SRCDS, it depends game and server -maxplayers setting. TF2 game is limited to max. 32 slot. Entity index 0 is "world" or error or server console. Userid's other hand are like "train tickets", helps you keep track of that same person on server. Every time when player connect to server, he get new ticket, ticket count increase by 1 every connection. Same ticket number last as long as player not disconnect or reconnect from server. Userid max number is 65 535, after that it rolls back to 1
status from console
- You get userids mostly from game events and you can use it for targeting specific player more easy. Not need play with player names or steamid for simple task. - You handle client indexs most of time in coding, because it's good use for as array index and SM functions are using as well. And you have 64 possible options or less, to find clients. ------------------------------------------------------------------- About byte you get in TF2 game events, I assume it's easy way to send list of client indexs, in one event message, to all players from server. String message works as array, using hex numbers to separate each client. \x01\x04\x0A If you print on server console, it show as symbols of course. ASCII codes ? What you need to do is convert char byte to integer. PHP Code:
sample TF2 event, byte to int
|
Re: Identity crisis
You are the goat!
Thanks for clarification. Now I understand :) It helped me dig deeper into documentation. Summary of topic: It turned out that in game TF2 events provide 2 types of user reference number. First is short userid and second is user entindex. They are poorly written into documentation and names for them are inconssistant, so one can stumbble across for example: byte user index or byte victim ent index. They are named differently but they are the same user ent index. Answering this question. How do I convert each of them efficiently to SteamId64? I posted function that converts userid 2 post above. Here is function that converts byte ENT INDEX into steamID64 PHP Code:
The true mystery still remains. Why there is smiley face there :) |
Re: Identity crisis
Quote:
Printing the "character" with the value 0x01 to the Windows console will display a smiley face. |
All times are GMT -4. The time now is 10:50. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.