PDA

View Full Version : Determing a player's number



Sasc
December 18th, 2009, 01:45 AM
Is there any way of finding out what a player's ID is in a server by using scripts?

Let's say if I went into a server, can I find out my player number by using a script?

I've tried searching for a solution to this but with no luck :(

Con
December 18th, 2009, 02:25 AM
I know if you go sv_players, then count from the bottom of the list starting at 0 to the player you want, then that's the players list number you can use with unit_ commands (http://con.modacity.net/skytest/16screenshot00.jpg), etc. If you're in a server by yourself, the number will be 0. If you use a number that's higher than the number of players minus 1, then you will exception because there is no such player.

Sasc
December 18th, 2009, 04:04 AM
Well for what I'd like to do, the sv_players wouldn't be ideal because I don't want to know the values myself, I just want the script to know (if you get what I mean).

I'm trying to get an effect to work on every player except for mine, and I could achieve that by getting my own player's number and disabling the effect. I'm using effect_new_on_object_marker btw, I would use the biped's functions but it's not adequate for what I'm trying to do.

Also, lol wtf at your unit_ commands image?

Con
December 18th, 2009, 04:21 AM
I don't think there's anything that can give you that number short of an app.

Limited
December 18th, 2009, 10:34 AM
Hmm, the issue is the numbers change alot. Scripting, I dunno if theres a function to get the players name and local players name =\.

Dwood
December 18th, 2009, 11:21 AM
Scripts only work over mp if they are dependant on values that are server dependant. ie player position. unless someone makes an app that syncs it, no scripts that depend on sv-lists work properly.

chrisk123999
December 18th, 2009, 10:16 PM
The only way to control players with scripts is (unit (list_get (players) # ) ) where # is between 0 and 15. Using a script on a non-existent player won't exception you. The only problem is that when a player joins, leaves, or dies the list changes. So you can't keep track of a specific player.

Skarma
December 18th, 2009, 11:32 PM
I don't think there's anything that can give you that number short of an app.This is correct...enough said! :downs:

Sasc
December 19th, 2009, 01:05 AM
Aw I was really hoping for a solution :(

Thanks for all your answers', much appreciated!