AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Saving a killers auth-id to use later (https://forums.alliedmods.net/showthread.php?t=140240)

GXLZPGX 10-10-2010 00:11

Saving a killers auth-id to use later
 
If I want to save a killers auth-id for use later, would I use

PHP Code:

new KillerID[33

then in the death event

PHP Code:

new AuthID[35];
get_user_authidiAttackerAuthIDcharsmax(authid) )
KillerID[iVictim] = AuthID 


fysiks 10-10-2010 00:23

Re: Saving a killers auth-id to use later
 
No. Just use their id. The only time you would ever need their SteamID in a variable is if they leave the server and you still need their info.

Or, if you really want them then get the SteamID of everybody an client_authorized().

PHP Code:

new g_szSteamID[33][32]
// ...
get_user_authid(idg_szAuthID[id], charsmax(g_szAuthID[])) 

And, only save the id of the person so you can use the SteamID string as g_szSteamID[id_of_saved_user].

nikhilgupta345 10-10-2010 00:30

Re: Saving a killers auth-id to use later
 
Along with what fysiks said, what you showed would not work, because steamid(authid) is saved in string "Authid" and you cannot save that string inside of the cell of an array. Use what fysiks said.

Exolent[jNr] 10-10-2010 02:18

Re: Saving a killers auth-id to use later
 
Quote:

Originally Posted by nikhilgupta345 (Post 1320813)
Along with what fysiks said, what you showed would not work, because steamid(authid) is saved in string "Authid" and you cannot save that string inside of the cell of an array. Use what fysiks said.

His code would basically copy AuthID's string into KillerID.
However, it's bad code to do that.

nikhilgupta345 10-10-2010 02:21

Re: Saving a killers auth-id to use later
 
Oh yea :(

Got a question, what would happen to whatever part of the string is left out? Would it just not appear in the cells? Or does it loop around and go back to KillerID[0]?

Exolent[jNr] 10-10-2010 02:23

Re: Saving a killers auth-id to use later
 
Since the array sizes do not match, it would result in either:
  • error saying the buffer sizes do not match
  • maybe a memory leak?
  • it would assign the values and fill up the smaller array but not even allow the null ^0 character because it treats them as arrays.

fysiks 10-10-2010 16:51

Re: Saving a killers auth-id to use later
 
You shouldn't be able to compile it. Assigning an array to a cell gives compiler error:

error 006: must be assigned to an array


All times are GMT -4. The time now is 10:25.

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