Author Topic: AutoSpec Script v1.0  (Read 1415 times)

0 Members and 1 Guest are viewing this topic.

Offline StayAlive

  • Major(1)
  • Posts: 8
AutoSpec Script v1.0
« on: June 08, 2012, 08:26:23 am »
Script Name: AutoSpec Script
Script Description: Make players join spectator first.
Original Author(s): StayAlive
Core Version: 2.7.3
Code:
Code: [Select]
procedure OnJoinGame(ID, Team: byte);
begin
if(ENABLED and(Team<5)) then begin
WriteConsole(ID,'Please join spectator first.',COLOR);
Command('/setteam5 '+inttostr(ID));
end;
end;


So, I've made it because I think there is no script like that on this forum. Am I right?
Also I have problem to open http://soldatcentral.com site -> it redirects me on http://ww35.soldatcentral.com/ :O
There is a readme file in zip file and some comments in code so I hope all is clear.
And yes, I know it is very simple script, but I'm just a begginer :D
« Last Edit: June 09, 2012, 04:09:57 am by StayAlive »

Offline TheOne

  • Soldier
  • **
  • Posts: 208
Re: AutoSpec Script v1.0
« Reply #1 on: June 08, 2012, 03:49:47 pm »
As suggestion: you can simplify that if-clause. Following should do the same:
Code: [Select]
if (ENABLED and ((Team = 1) or (Team = 2) or (Team = 3) or (Team = 4)))
Code: [Select]
if (ENABLED and (Team <> 5))
If you need a combination, like only forbidding to join alpha and bravo team, you can use:
Code: [Select]
(Team < 3)

Offline StayAlive

  • Major(1)
  • Posts: 8
Re: AutoSpec Script v1.0
« Reply #2 on: June 09, 2012, 03:56:54 am »
Yay! Very nice, thanks. I just don't know what '<>' means but it's still good solution with '<' :D

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: AutoSpec Script v1.0
« Reply #3 on: June 09, 2012, 06:33:04 am »
<> is same as != in many other languages which means not equal to
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.