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

Tile that says something and plays a sound only once?


endrien
 Share

Recommended Posts

i think it should be on the "OnNewChar" section, put
Call PlaySound (Index, ".") i'll test this out myself and see if it works
*edit*
ok, that works, but it plays the sound when the Msgbox after u press create pops up, try it on the "JoinGame" sub
*edit2*
ok, if u put it in the JoinGame sub, it plays a sound, but will cause some lag with the map appearing

ok, here is the code for it
```
' Executes when a player logs into the game.
Sub JoinGame(Index)
If GetPlayerAccess(Index) = 0 Then
Call GlobalMsg(GetPlayerName(Index) & " has joined " & GameName & "!", GREY)
Else
Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has joined " & GameName & "!", YELLOW)
End If

Call PlayerMsg(Index, "Welcome to " & GameName & "!", WHITE)

If LenB(MOTD) <> 0 Then
Call PlayerMsg(Index, "MOTD: " & MOTD, BRIGHTCYAN)
End If

Call SendWhosOnline(Index)

Call PlaySound(Index, "key.wav")
End Sub
```
Link to comment
Share on other sites

@Admiral:

> Would be a script.
> Question:
> Do you want it to happen exactly when you make a new character, or do you want it to happen when that new character logs into the game for the first time?

as said in my post, when u use it when u make a new char, it only plays for u at the char select screen, and i don't know any way to make it work when u log in for the FIRST TIME ONLY, so i just used it on the JoinGame sub
Link to comment
Share on other sites

@dtdsora:

> as said in my post, when u use it when u make a new char, it only plays for u at the char select screen, and i don't know any way to make it work when u log in for the FIRST TIME ONLY, so i just used it on the JoinGame sub

Yea, I think he wants the message that gets displayed, and the sound that plays, to be when he logs in the first time with his character.  It's very easy to only have it happen once too.

Anyway, here's dtd's modified JoinGame sub, where it will only happen once per character:
```
' Executes when a player logs into the game.
Sub JoinGame(Index)
  If GetPlayerAccess(Index) = 0 Then
      Call GlobalMsg(GetPlayerName(Index) & " has joined " & GameName & "!", GREY)
  Else
      Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has joined " & GameName & "!", YELLOW)
  End If

  Call PlayerMsg(Index, "Welcome to " & GameName & "!", WHITE)

  If LenB(MOTD) <> 0 Then
      Call PlayerMsg(Index, "MOTD: " & MOTD, BRIGHTCYAN)
  End If

  Call SendWhosOnline(Index)
  If GetVar("PlayersBegin.ini", GetPlayerLogin(Index) & "", GetPlayerName(Index) & "") = "" Then
      Call PlaySound(Index, "key.wav")
      Call PlayerMsg(Index, "This is the msg that will be displayed", RED)
      Call PutVar("PlayersBegin.ini", GetPlayerLogin(Index) & "", GetPlayerName(Index) & "", "1")
  End If
End 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...