December 05, 2023, 04:42:25 pm

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: [1]

Author Topic: I'm bad at stuff  (Read 988 times)

BatCow

  • Junior Member
  • **
  • Karma: 5
  • Offline Offline
  • Posts: 83
  • Absolue Garbage
I'm bad at stuff
« on: October 01, 2017, 03:23:02 pm »

I've been fiddling with plugins and scripts, and I was wondering how to target players that are not yourself.
global.myself.object and ?????????
Logged
A demake of a clone of a remake of a sequel made using assets from a demake of a sequel to a sequel

[FR]YB

  • 2013 Haxxy Award Winner
  • *
  • Karma: 28
  • Offline Offline
  • Posts: 642
  • There are 11 people playing holy sh
Re: I'm bad at stuff
« Reply #1 on: October 01, 2017, 04:19:12 pm »

That's probably not the best way to name your topic, but to answer your question


There's a list named global.players, which you can access with ds_list_ functions.
ds_list_find_value(global.players, 0) will return the Player of the server host (the server host is always the first, which is why index is 0)
So if you know the position of a player in that list, you can retrieve the Player instance with ds_list_find_value(global.players, <index>)

You can also use with(Player) { <code> } to do something with all player instances. Or you can loop through all items in global.players, too.


If you want to find a Player by name, you may want to do something like

with(Player) {
    if (name == "something") {
         <do something with it>
    }
}

But remember that some players may have the same name, so that code may execute for two players or more at once.


For more info you may want to check out either some other plugins, or the code guides in the mods section.

BatCow

  • Junior Member
  • **
  • Karma: 5
  • Offline Offline
  • Posts: 83
  • Absolue Garbage
Re: I'm bad at stuff
« Reply #2 on: October 19, 2017, 04:26:40 pm »

I'm also bad at naming topics.
Thank you, now I can give anybody on my server immorality
Logged
A demake of a clone of a remake of a sequel made using assets from a demake of a sequel to a sequel

PrOF

  • Heroic Member
  • ****
  • Karma: 43
  • Offline Offline
  • Posts: 600
  • Sometimes a dev. Only sometimes
Re: I'm bad at stuff
« Reply #3 on: October 19, 2017, 04:59:18 pm »

I'm also bad at naming topics.
Thank you, now I can give anybody on my server immorality

That's just perfect
Logged

Fuzion

  • Lucky Member
  • *******
  • Karma: 22
  • Offline Offline
  • Posts: 924
  • Blind asian.
Re: I'm bad at stuff
« Reply #4 on: October 19, 2017, 08:33:19 pm »

I'm also bad at naming topics.
Thank you, now I can give anybody on my server immorality

That's just perfect
xD
Logged

BatCow

  • Junior Member
  • **
  • Karma: 5
  • Offline Offline
  • Posts: 83
  • Absolue Garbage
Re: I'm bad at stuff
« Reply #5 on: October 20, 2017, 04:30:49 am »

 :z7:
Logged
A demake of a clone of a remake of a sequel made using assets from a demake of a sequel to a sequel
Pages: [1]
 

Page created in 0.029 seconds with 36 queries.