Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Need help with my first part of a nation war script!


Sealbreaker
 Share

Recommended Posts

so…. this is what i got... and i need help, cause it does nothing....

```
Sub NationFight(index)
Dim TimeStart
Dim TimeEnd

TimeStart = GetServerTime(12,0,0)
TimeEnd = GetServerTime(12,25,0)

If TimeStart = True Then
Call GlobalMsg("Nation war started!", GREEN)
Call PutVar("war.ini",  "WAR",  "war", 1)
If TimeEnd = True Then
Call GlobalMsg("Nation war ended!", Green)
Call PutVar("war.ini",  "WAR",  "war", 0)
Else
End If
End Sub
```

and:

```
Case "/war"
If GetVar("war.ini", "WAR", "war", 0) Then
Call PlayerMsg(index, "War is not active!, RED)
Else
If GetPlayerGuild(index, guildname) Then
Call Playerwarp(index, #, x, y)
If GetPlayerGuild(index, guildname) Then
Call Playerwarp(index, #, x, y)
End If
Exit Sub
```
Link to comment
Share on other sites

TimedEvent sub:
```
If Hours = 12 And Minutes = 0 Then
Call GlobalMsg("Nation war started!", GREEN)
Call PutVar("war.ini", "WAR", "war", "1")
End If
If Hours = 12 And Minutes = 25 Then
Call GlobalMsg("Nation war ended!", GREEN)
Call PutVar("war.ini",  "WAR",  "war", "0")
End If

```
slash-command:
```
Case "/war"
If GetVar("war.ini", "WAR", "war") = "1" Then
Select Case GetPlayerGuild(index)
Case "guildname"
Call PlayerWarp(Index, MapNumber, X, Y)
Case "guildname2"
Call PlayerWarp(Index, MapNumber, X, Y)
End Select
Else
Call PlayerMsg(index, "War is not active!", RED)
Exit Sub

```
Link to comment
Share on other sites

thank you admiral =)
you are helping every noob, almost every time… you're one of the nicest person on eclipse =)

edit: it doesnt work right.... when war starts it says: nation war started! almost every second and if it ends it says nation war ended! every second...
Link to comment
Share on other sites

' Executes every second, based on the server time.
Sub TimedEvent(Hours, Minutes, Seconds)
If Hours = 12 And Minutes = 0 Then
  Call GlobalMsg("Nation war started!", GREEN)
  Call PutVar("war.ini", "WAR", "war", "1")
End If
If Hours = 12 And Minutes = 25 Then
  Call GlobalMsg("Nation war ended!", GREEN)
  Call PutVar("war.ini",  "WAR",  "war", "0")
End If
End Sub
Link to comment
Share on other sites

Ah. Admiral forgot that it will execute every second.

```
' Executes every second, based on the server time.
Sub TimedEvent(Hours, Minutes, Seconds)
If Hours = 12 And Minutes = 0 And Seconds = 0 Then
  Call GlobalMsg("Nation war started!", GREEN)
  Call PutVar("war.ini", "WAR", "war", "1")
End If
If Hours = 12 And Minutes = 25 And Seconds = 0 Then
  Call GlobalMsg("Nation war ended!", GREEN)
  Call PutVar("war.ini",  "WAR",  "war", "0")
End If
End Sub

```
Link to comment
Share on other sites

first: sorry for doublepost ^^
this is what i got till now ( tell me if it would work pls and maybe can someone complete my /enemy- command) :

```
' Executes every second, based on the server time.
Sub TimedEvent(Hours, Minutes, Seconds)
If Hours = 12 And Minutes = 0 And Seconds = 0 Then
  Call GlobalMsg("Nation war started!", RED)
  Call PutVar("war.ini", "WAR", "war", "1")
End If
If Hours = 12 And Minutes = 25 And Seconds = 0 Then
  Call GlobalMsg("Nation war ended!", RED)
  Call PutVar("war.ini", "WAR", "war", "0")
  Call PutVar("war.ini", "WAR", "a", "0")
  Call PutVar("war.ini", "WAR", "a", "0")
End If
End Sub
```

```
Case "/war"
If GetVar("war.ini", "WAR", "war") = "1" Then
  Select Case GetPlayerGuild(index)
      Case "guildname"
        Call PlayerWarp(Index, MapNumber, X, Y)
        Call PlayerMsg(index, "You joined the natonwar", Green)
        Call PutVar("war.ini", "WAR", "a", Int(a) + 1)
      Case "guildname2"
        Call PlayerWarp(Index, MapNumber, X, Y)
        Call PlayerMsg(index, "You joined the nationwar", GREEN)
        Call PutVar("war.ini", "WAR", "b", Int(b) + 1)
  End Select
Else
  Call PlayerMsg(index, "War is not active!", RED)
End If
Exit Sub
```
and this ( i need help with it…. ) :

```
Case "/war"
If GetVar("war.ini", "WAR", "war") = "1" Then
  Select Case GetPlayerGuild(index)
      Case "guildname"
        Call PlayerWarp(Index, MapNumber, X, Y)
        Call PlayerMsg(index, "You joined the natonwar", Green)
        Call PutVar("war.ini", "WAR", "a", Int(a) + 1)
      Case "guildname2"
        Call PlayerWarp(Index, MapNumber, X, Y)
        Call PlayerMsg(index, "You joined the nationwar", GREEN)
        Call PutVar("war.ini", "WAR", "b", Int(b) + 1)
  End Select
Else
  Call PlayerMsg(index, "War is not active!", RED)
End If
Exit Sub
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...