Skip to content

Commit db1fecf

Browse files
committed
Announcement Functions
1 parent d633573 commit db1fecf

14 files changed

+120
-21
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
local function playerJoinHandler()
2+
if (getGameType() == "Race") then
3+
outputChatBox("Ready... Get set... GO!!", source)
4+
end
5+
end
6+
addEventHandler("onPlayerJoin", root, playerJoinHandler)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
local function checkMap ( thePlayer )
2+
local mapName = getMapName() -- get the maps name
3+
if (mapName and mapName ~= "None") then -- if map name was set and it isn't "None" (default map name)
4+
outputChatBox("You're playing map called \"" .. mapName .. "\"", thePlayer) -- print out the map name
5+
else -- there was no name so tell that to player
6+
outputChatBox("You're playing an unnamed map.", thePlayer) -- print out the message
7+
end
8+
end
9+
addCommandHandler("checkmap", checkMap)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (getRuleValue ( "myScriptRunning" )) then
2+
-- the value is set
3+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
removeRuleValue("myScriptRunning")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
local function setNewGameType(source, commandName, newGameType)
2+
local oldGameType = getGameType() -- check old Game Type
3+
setGameType(newGameType) -- set new Game Type
4+
outputChatBox("Game Type " .. oldGameType .. " changed to " .. newGameType .. ".", getRootElement(), 255, 128, 0)
5+
end
6+
addCommandHandler("setgametype", setNewGameType)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
setMapName("My amazing map!")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
setRuleValue("myScriptRunning", "yes")
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/getGameType
21
server:
32
name: getGameType
4-
description: TODO
5-
incomplete: true
3+
pair: setGameType
4+
description: This function retrieves the current gametype as set by [[setGameType]]. The game type is displayed in the server browser next to the server's name.
5+
returns:
6+
values:
7+
- type: string|nil
8+
name: game type (gamemode)
9+
description: Returns the gametype as a string. If no gametype is set it returns [[nil]].
10+
examples:
11+
- path: examples/getGameType-1.lua
12+
description: This example sends a message to player when he joins, if the current game type is Race.
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/getMapName
21
server:
32
name: getMapName
4-
description: TODO
5-
incomplete: true
3+
pair: setMapName
4+
description: This function retrieves the current mapname as set by [[setMapName]].
5+
returns:
6+
values:
7+
- type: string|nil
8+
name: map name
9+
description: Returns the mapname as a [[string]]. If no mapname is set it returns [[nil]].
10+
examples:
11+
- path: examples/getMapName-1.lua
12+
description: This example adds a <code>checkmap</code> command with which you can check what map you are currently playing.
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/getRuleValue
21
server:
32
name: getRuleValue
4-
description: TODO
5-
incomplete: true
3+
pair: setRuleValue
4+
description: This function gets a rule value. A rule value is a string that can be viewed by server browsers and used for filtering the server list.
5+
returns:
6+
values:
7+
- type: string|nil
8+
name: rule value
9+
description: This example shows how you can check if a rule is set.
10+
11+
examples:
12+
- path: examples/getRuleValue-1.lua
13+
description: This example shows how you can check if a rule is set.

0 commit comments

Comments
 (0)