Results 1 to 9 of 9

Thread: Determing a player's number

  1. #1
    Senior Member Sasc's Avatar
    Join Date
    Nov 2007
    Posts
    102

    Determing a player's number

    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
    Reply With Quote

  2. #2
    chilango Con's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, BC, Canada
    Posts
    8,397

    Re: Determing a player's number

    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, 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.
    Reply With Quote

  3. #3
    Senior Member Sasc's Avatar
    Join Date
    Nov 2007
    Posts
    102

    Re: Determing a player's number

    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?
    Reply With Quote

  4. #4
    chilango Con's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, BC, Canada
    Posts
    8,397

    Re: Determing a player's number

    I don't think there's anything that can give you that number short of an app.
    Reply With Quote

  5. #5
    HA10 Limited's Avatar
    Join Date
    Sep 2006
    Location
    England
    Posts
    7,800

    Re: Determing a player's number

    Hmm, the issue is the numbers change alot. Scripting, I dunno if theres a function to get the players name and local players name =\.
    Reply With Quote

  6. #6
    Neanderthal Dwood's Avatar
    Join Date
    Sep 2008
    Location
    Wouldn't u like to know?
    Posts
    4,186

    Re: Determing a player's number

    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.
    Reply With Quote

  7. #7
    Chris chrisk123999's Avatar
    Join Date
    May 2009
    Location
    Florida, USA
    Posts
    646

    Re: Determing a player's number

    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.
    Reply With Quote

  8. #8
    Codesaurus Skarma's Avatar
    Join Date
    Apr 2009
    Location
    Columbus, OH
    Posts
    227

    Re: Determing a player's number

    Quote Originally Posted by Con View Post
    I don't think there's anything that can give you that number short of an app.
    This is correct...enough said!
    Reply With Quote

  9. #9
    Senior Member Sasc's Avatar
    Join Date
    Nov 2007
    Posts
    102

    Re: Determing a player's number

    Aw I was really hoping for a solution

    Thanks for all your answers', much appreciated!
    Reply With Quote

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •