Author Topic: ALL except USER (ID)  (Read 1195 times)

0 Members and 1 Guest are viewing this topic.

Offline BRADEN

  • Camper
  • ***
  • Posts: 319
ALL except USER (ID)
« on: March 14, 2008, 01:23:43 pm »
OK so user is represented by ID, and all players by 0. How do you represent 0 except ID?

Death is the solution to all problems. No man; no problem.
-Joseph Stalin

Offline Railor

  • Major(1)
  • Posts: 16
Re: ALL except USER (ID)
« Reply #1 on: March 14, 2008, 03:49:28 pm »
Code: [Select]
var
i: integer;

for i := 1 to ID-1 do begin
// Commands
end

for i := ID+1 to 32 do begin
// Commands
end
The two Command (// Commands) parts have to be the same, or it won't do the same to the players (except ID)!
« Last Edit: March 15, 2008, 09:38:23 am by Railor »

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: ALL except USER (ID)
« Reply #2 on: March 14, 2008, 04:02:41 pm »
or this:
Code: [Select]
var
  i: byte;
begin
  for i := 1 to 32 do if (i <> Id) then //whatever u want
end;
you have to use a loop

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: ALL except USER (ID)
« Reply #3 on: March 14, 2008, 06:37:03 pm »
Code: [Select]
var
i: integer;

for i := 1 to ID-1 do begin
// Commands
end

for i := ID+1 to NumPlayers do begin
// Commands
end
The two Command (// Commands) parts have to be the same, or it won't do the same to the players (except ID)!
That wouldn't work, IDs have nothing to do with NumPlayers,

Ten people join an empty server, IDs are 1, 2, 3 etc up to 10. Some of them leave, have a heartattack or whatever. The ones who leave are ~well, say 1, 2, 3 to keep it easy. So, you run that code (ID being 5 or so). NumPlayers say there's 7 people in the server. That code would perform (whatever it is) on 1, 2, 3, 4, (not 5), 6 and 7, but 1, 2 and 3 aren't there... And 8, 9 and 10 would just be ignored.

Code: [Select]
var i: Integer
begin

  // loop, eh
  for i := 1 to 32 do

    // we only wanna do it on active players
    if GetPlayerStat(i, 'Active') = true then

      // and not on the user
      if i <> ID then

        // ^^
        Command('/kill ' + inttostr(i));
end;

And some shameless selfpromoting, terrible code  but it has lots of stuff. I use arrays for it there, which isn't really practical unless you're making big stuff.

Offline Railor

  • Major(1)
  • Posts: 16
Re: ALL except USER (ID)
« Reply #4 on: March 15, 2008, 09:40:15 am »
Code: [Select]
var
i: integer;

for i := 1 to ID-1 do begin
// Commands
end

for i := ID+1 to NumPlayers do begin
// Commands
end
The two Command (// Commands) parts have to be the same, or it won't do the same to the players (except ID)!
That wouldn't work, IDs have nothing to do with NumPlayers,
Oh yeah, sorry. Modified it.

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: ALL except USER (ID)
« Reply #5 on: March 15, 2008, 10:28:30 am »
I don't even know how you guys understood the original question....

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: ALL except USER (ID)
« Reply #6 on: March 15, 2008, 11:49:56 am »
I don't even know how you guys understood the original question....
Lucky guess :P

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: ALL except USER (ID)
« Reply #7 on: March 17, 2008, 01:09:03 am »
I don't even know how you guys understood the original question....
When you do a command, you can put in 0 to affect all players, he wanted a way to run commands on everyone apart from the person who started the commands, Like if you made a command /kill all, you would want it to kill everyone apart from the person who said it, Understand now?
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs