Raised This Month: $ Target: $400
 0% 

l4d2 GetPlayerFromUserID Entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
chchchch
New Member
Join Date: Apr 2023
Old 05-08-2023 , 02:01   l4d2 GetPlayerFromUserID Entities
Reply With Quote #1

vscript

I want to get player Entities value for GetPlayerFromUserID

{
local _player = GetPlayerFromUserID(params.userid);
if(_player != GetListenServerHost())
}

I want to use a player with specific Entities rather than a host

Last edited by chchchch; 05-08-2023 at 02:02.
chchchch is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 05-08-2023 , 16:57   Re: l4d2 GetPlayerFromUserID Entities
Reply With Quote #2

Is the code you wrote not working then ?

Code:
GetListenServerHost 	handle GetListenServerHost() 	Get the host player on a listen server. 
GetPlayerFromUserID 	handle GetPlayerFromUserID(int ID) 	Given a user id, return the entity, or null.
Both functions return a handle native. Hence the code below should work.

PHP Code:
{
    
local _player GetPlayerFromUserID(params.userid);
    if(
_player != GetListenServerHost())

What exactly is the problem? Also what event are you trying to extract the _player from?

This may not be the most efficient way to do it, but you can use the native below and get the Entity index, if that's what you really want.

Code:
GetEntityIndex 	int GetEntityIndex() 	Returns the entity index. This is the same type of index used in most game events.
PHP Code:
{
    
local _player GetPlayerFromUserID(params.userid);
    
local _EnID null;
    if(
_player != GetListenServerHost())
    {
        
_EnID _player.GetEntityIndex();
    }

Note: I did not test or try to compile this code. This is purely for directional purposes as I do not exactly know what you are trying to accomplish here.
__________________
Spirit_12 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 03:12.


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