Script Variables and Events
Variables
| Name | Action |
| $playervar# | a variable that stored per player and don’t get erased from relogs or deaths. there are 64 of these these can have a value from −32768 to 32767 |
| $playertimevar# | 8 of these vars that can hold much larger numbers |
| $gservervar# | a variable that are stored on the server and can be used in scripts for any players. there are 128 of these. |
| $gplayerkudos | players kudos |
| $gplayerteam | team # of the player using the script |
| $gplayerfamily | family # of the player using the script |
| $gplayercash | players cash on hand |
| $gplayerfuel | players fuel (0–63) |
| $gplayerhealth | players health |
| $gplayerlevel | players level |
| $gservertime | the time of the server, it seems to count by secs but no clue why the number is so large |
| $gPlayerKills | number of kills the player has |
| $gPlayerDeaths | number of deaths the player has |
| $gPlayerVehicle | what vehicle the player is in |
| $gPlayerItemCount | number of items the player has in inventory |
| $gNearestBuilding | the building record number of the closest building to the player. type *buildetails to find the building record number, its not the bdat number |
| $gNumPlayersOnline | number of players currently on the world |
| $gPlayerVehicle | what vehicle the player is in |
| $gPlayerVehicle | what vehicle the player is in |
| $(anything) | a variable with any other name. These variables are only created and stored per event and erased when the event stops running |
Variable Functions
these are used as $variable = function
| Name | Action |
| NumPlayersOnTeam(#) | returns the number of players on the specified team |
| IsInSpawnZone(#) | returns a 1 if the player is in the specified spawn zone |
| IsPlayerIDOnline(billing id) | returns a 1 if the specified player is online |
| IsInTown(“name”) | returns a 1 if the player is in the boundries of the named town |
IF Clauses
| Name | Action |
| playerskilllevel (“skill”) = #) | see if the player has the specified level of the specified skill |
| Playerinventory (“item”) = #) | see if the player has the specified amount of the specified item |
Names
| Name (add another % after the name) | Action |
| %player | This will reference the name of the player that the script is running for |
| %killer | in a player death script, this will reference the name of the player that killed them |
| %buildingowner | player that owns the building |
| | |
Events (there is a max of 512 events in your script)
| Name | Action |
| (“&Command”, “text”) | runs when a player types the specified &command |
| (“buildingTriggered”, “#”) | runs when a player activates the trigger for the specified building. the number represents the building in the buildings file |
| (“buildingdestroyed”, “#” ) | runs when a player destroys the specified building. the number represents the building in the buildings file |
| (“buildingpurchase”, “#” ) | runs when a player buys the specified building. the number represents the building in the buildings file |
| (“newbuilding”, “#”) | runs when a player builds the specified building. the number represents the building in the buildings file |
| (“playerdeath”, 0) | runs when a player gets killed |
| (“playerlogin”, 0) | runs when a player logs in |
| (“playerlogout”, 0) | runs when a player logs off |
| (“Useitem”, “name”) | runs when a player uses the specified item |
| (“Enter Region”, “#”) | unknown |
| ( “OSDSelect”, “osdname:buttonname” ) | tells the script to run when the player hits the button with ‘buttonname’ in the osd named ‘osdname’ |
| (“Custom”,”name”) | indicates that the script is called to run from a different script |
| | |
Script Commands
| Name | Action |
| canceltransaction() | used to have a usable item not removed from inventory when the script is run |
| sleep(#) | tells the script to halt for the specified time in tenths of a second |
| rand(#) | picks a random number between 1 and the specified number. add a +# to make the starting number higher |
| PlayerVars(NAME) | tells the script to run for the player specified or represented by the script name |
| #include “external script” | include lines go above all the script events. these allow external ‘sub’ scripts to easily be plugged into the main script file. |
| CustomEvent( “external script” ) | this tells a script event to run the specified external script. the specified script must also be listed with a #include. |
| osdcreate(OSDLIST,”osdname”,”text”) | creates a pop up box with the title of ‘text’. ‘osdname’ is used to indicate what event scripts the osd can activate. |
| osdadditem(OSDBUTTON, “buttonname”, “text”) | creates a button with ‘text’ on it. ‘buttonname’ is used to indicate what event script the button activates. |
| osdadditem(OSDTEXT, “”, “text”) | used to create a line of ‘text’ in the box. text lines can be up to 1024 characters long |
| osdactivate() | tells the osd to run |