Share Pastebin
Guest
Public paste!

Cueball

By: a guest | Jun 20th, 2008 | Syntax: C++ | Size: 23.62 KB | Hits: 122 | Expires: Never
Copy text to clipboard
  1. /*******************************************************************************************************
  2.  
  3.     Command Generator by ~Cueball~
  4.        A Guide For The Community
  5.  
  6.    Change The Following Five Defines
  7.  To Configure The Script To Your Needs
  8.    Read readme.html For Information
  9.  
  10. ******************************************************************************************************/
  11.  
  12. #define PrintInConsole                  1 // 1 = Send a '[generator]' message to the console when a command is successfully generated.
  13. #define SaveCommands            1 // 1 = Allow generated commands to be used immediately in the same session.
  14. #define SendAdminMessage                1 // 1 = Send a message to all logged-in RCON admins when a command is successfully generated.
  15. #define SendAnnounceMessage     1 // 1 = Send a message to every connected player with information about how to use the command.
  16. #define SendTeleMessage         1 // 1 = Send a message stating the name of the command and its creator to the player when the command is used.
  17. #define VehicleTele                     1 // 1 = Allow vehicle teleports to be saved to a file, as well as used in saved commands.
  18.  
  19. #define COLOUR_COMMAND          0x33CCFFAA // The colour to send announcement messages in if 'SendAnnounceMessage' is defined as 1.
  20. //******************************************************************************************************
  21.  
  22. #include <a_samp>                // Necessary include which holds all of SA-MP's native functions.
  23. #define FILTERSCRIPT     // This is a filterscript, so we define it as one.
  24. #if defined FILTERSCRIPT // If we have defined 'FILTERSCRIPT', do all the code until the first '#endif'.
  25.  
  26. //******************************************************************************************************
  27.  
  28. new File:GenCmds,   // Create a global file handle variable, so that we don't create alot of local variables which do the same thing.
  29.         CurrentCommand, // Create a global variable (integer), which holds the current command count.
  30.         string[500];    // Create a global variable (string), with a maximum length of 500 characters. Saves memory instead of creating strings after every '/cgen'.
  31.  
  32. //******************************************************************************************************
  33. // ARRAY CREATION - MAIN
  34. //******************************************************************************************************
  35.  
  36. #define MAX_COMMANDS            150 // The maximum amount of commands that can be used at one time. KEEP AROUND THIS VALUE TO SAVE MEMORY.
  37. #define MAX_COMMAND_NAME        15  // The maximum command name length you want your commands to be. '/cgen hello' = Command length of 5 characters.
  38.  
  39. enum COMMAND_MAIN { // Enumerating 'COMMAND_MAIN'.
  40.     NAME[MAX_COMMAND_NAME],   // A string with a maximum length of MAX_COMMAND_NAME characters.
  41.         CREATOR[MAX_PLAYER_NAME], // A string with a maximum length of MAX_PLAYER_NAME (24) characters.
  42.         Float:POS[4],             // 4 floats with a single name: 'POS'.
  43.         INTERIOR                  // An integer.
  44. }
  45.  
  46. new gCommands[MAX_COMMANDS][COMMAND_MAIN]; // Creating a global variable with MAX_COMMANDS ammount of cells, and each set of cells holding our 'COMMAND_MAIN' enumeration.
  47.  
  48. //******************************************************************************************************
  49. // ARRAY CREATION - INVALID NAMES
  50. //******************************************************************************************************
  51.  
  52. #define MAX_INVALID_COMMANDS    21 // The amount of invalid command names you have. Must be an exact value, or else you will recieve errors.
  53. #define MAX_INVALID_NAME        9  // The maximum invalid command name length you have. Remember to add an extra value for the trailing 0. 'cmd' = 3 + 1.
  54.  
  55. new gInvalidCommands[MAX_INVALID_COMMANDS][MAX_INVALID_NAME] = { // Add all your invalid command names here (but remember to change the value of 'MAX_INVALID_COMMANDS' when you are finished.
  56.         "rules", "commands", "cmds", "cmd", "register", "login", "logout", "signup",
  57.         "signin", "signout", "admins", "kick", "ban", "wire", "unwire", "mute", "unmute",
  58.         "explode", "goto", "gethere", "tele"
  59. };
  60.  
  61. //******************************************************************************************************
  62. // CALLBACKS
  63. //******************************************************************************************************
  64.  
  65. public OnFilterScriptInit()
  66. {
  67.         print("\n****************************************"); // Give credit to the creator of the script.
  68.     print("*    Command_Generator by ~Cueball~    *");
  69.     print("****************************************\n");
  70.  
  71.         if(!fexist("Generated_Commands.txt")) // Check if 'Generated_Commands.txt' exists in the 'scriptfiles' folder. If it doesn't, do the following:
  72.         {
  73.                 GenCmds = fopen("Generated_Commands.txt", io_append); // Create the file 'Generated_Commands.txt' with the filemode being 'io_append'. We store the variable returned by the function into our 'GenCmds' global variable, as we will use this as a file handle.
  74.                 fclose(GenCmds); // Close the file handle 'GenCmds'. This will successfully close 'Generated_Commands.txt', which will stop our server from crashing.
  75.         }
  76.  
  77.         return 1; // Return 1 to the server, which will allow information to be processed after this script has been looped through.
  78. }
  79.  
  80. #endif
  81.  
  82. //******************************************************************************************************
  83.  
  84. public OnPlayerConnect(playerid)
  85.         return SendClientMessage(playerid, 0x33CCFFAA, "Running Command_Generator Script by ~Cueball~ || To get started type \'/cgen\' at your wanted location."); // Let the player know that the script is running, and tell them how to save a command.
  86.  
  87. //******************************************************************************************************
  88.  
  89. public OnPlayerCommandText(playerid, cmdtext[])
  90. {
  91.         if(strcmp (cmdtext, "/cgen", true, 5) == 0) // '/cgen'.
  92.     {
  93.         if (strlen(cmdtext) < 7 || cmdtext[6] == '/') // If the player's command name wasn't given, or if they tried to do (FOR EXAMPLE): '/cgen /chiliad', tell them how to use the command correctly.
  94.                         return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /cgen [teleport/command name] (DO NOT INCLUDE THE '/'!)");
  95.  
  96.                 if(strlen(cmdtext) > (MAX_COMMAND_NAME + 6)) // If their command name is too long, tell them that they have made a mistake.
  97.                     return SendClientMessage(playerid, 0xFF9900AA, "ERROR: You're command name is too long!");
  98.  
  99.         format(string, MAX_COMMAND_NAME, "%s", cmdtext[6]); // Formatting 'string' to hold their command name, so that we can successfully compare strings later.
  100.  
  101.                 if(strcmp(string, "help", true, 4) == 0) // '/cgen help'.
  102.                 {
  103.                     SendClientMessage(playerid, 0x33CCFFAA, "Command Generator Help by ~Cueball~"); // Show helpful information about Command Generator
  104.                     SendClientMessage(playerid, 0xFF9900AA, "Go to a location and type \'/cgen [command name]\'. The command will be sent to the server owner.");
  105.                     SendClientMessage(playerid, 0xFF9900AA, "If enabled by the server, you can then type \'/[command name]\',");
  106.                     SendClientMessage(playerid, 0xFF9900AA, "where \'[command name]\' is the name of a previously generated command.");
  107.                     SendClientMessage(playerid, 0x33CCFFAA, "PLEASE NOTE: Do not try to generate any frequently used command names such as \'/help\'.");
  108.                     return SendClientMessage(playerid, 0x33CCFFAA, "Administrators keep constant watch over generated commands, so it is unwise to flood the system.");
  109.                 }
  110.  
  111.                 for(new i = 0; i < MAX_COMMANDS; i++) // A for loop which runs a maximum of MAX_COMMANDS - 1 times.
  112.                     if(gCommands[i][NAME][0] != '\0' && strcmp(string, gCommands[i][NAME], true, strlen(gCommands[i][NAME])) == 0) // If the current cell of 'gCommands[*][NAME][0]' is not empty AND it is the same as the command name the player supplied (if that command name is already in use), tell them that they must use a different command name.
  113.                             return SendClientMessage(playerid, 0xFF9900AA, "ERROR: Somebody has already generated a command with that name! Please use a different one.");
  114.  
  115.                 for(new i = 0; i < MAX_INVALID_COMMANDS; i++) // A for loop which runs a maximum of MAX_INVALID_COMMANDS - 1 times.
  116.                         if(strcmp(string, gInvalidCommands[i], true, strlen(gInvalidCommands[i])) == 0) // If the command name that the player supplied is the same as one in our 'gInvalidCommands' array, tell them that that command name is disabled.
  117.                             return SendClientMessage(playerid, 0xFF9900AA, "ERROR: The server owner has disabled generating a command with that name!");
  118.  
  119.         new Float:x, Float:y, Float:z, Float:Ang, Interior, // Create 4 floats which will hold the players position and facing angle, as well as an integer.
  120.                         PlayerIp[16], PlayerName[MAX_PLAYER_NAME],      // Create 2 strings, with a maximum length of 16 and 24 characters (the value of 'MAX_PLAYER_NAME') respectively.
  121.                         hour, minute, second, year, month, day;         // Create 6 integers which will hold the servers current time and date.
  122.  
  123.                 GetPlayerPos(playerid, x, y, z);                         // Store the players current X, Y and Z co-ordinates into our 'x', 'y' and 'z' variables respectively.
  124.                 GetPlayerFacingAngle(playerid, Ang);                     // Store the players current angle that they are facing into our 'Ang' variable.
  125.                 Interior = GetPlayerInterior(playerid);                  // Store the players current interior into our 'Interior' variable.
  126.                 GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); // Store the players name into our 'PlayerName' variable, with a maximum length of the size of 'PlayerName' (24, or 'MAX_PLAYER_NAME').
  127.                 GetPlayerIp(playerid, PlayerIp, sizeof(PlayerIp));       // Store the players IP address into our 'PlayerIp' variable, with a maximum length of the size of 'PlayerIp' (24).
  128.                 gettime(hour, minute, second);                           // Store the servers current time in our 'hour', 'minute' and 'second' variables.
  129.                 getdate(year, month, day);                               // Store the servers current date in our 'year', 'month' and 'day' variables.
  130.  
  131.                 GenCmds = fopen("Generated_Commands.txt", io_append); // Open the file 'Generated_Commands.txt' with the filemode being 'io_append'. We store the variable returned by the function into our 'GenCmds' global variable, as we will use this as a file handle.
  132.                 format(string, sizeof(string), "if(strcmp(\"/%s\", cmdtext, true, %d) == 0) // Requested by player '%s' (IP: %s) on the %d/%d/%d. Time: %d:%d:%d\r\n{\r\n", cmdtext[6], strlen(cmdtext) - 5, PlayerName, PlayerIp, day, month, year, hour, minute, second); // Formatting 'string' to hold a valid command check.
  133.                 fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  134.  
  135.                 #if VehicleTele == 1 // If 'VehicleTele' is defined as 1, do the following:
  136.                     #if SendAnnounceMessage == 1 // If 'SendAnnounceMessage' is defined as 1, do the following:
  137.                         format(string, sizeof(string), "    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)\r\n    {\r\n        SetPlayerInterior(playerid, %d);\r\n        LinkVehicleToInterior(GetPlayerVehicleID(playerid), %d);\r\n        SetVehiclePos(GetPlayerVehicleID(playerid), %f, %f, %f);\r\n        SetVehicleZAngle(GetPlayerVehicleID(playerid), %f);\r\n    ", Interior, Interior, x, y, z, Ang); // Formatting 'string' to hold a valid set of functions.
  138.                         fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  139.                         format(string, sizeof(string), "    return SendClientMessageToAll(0x%x, \"Player '%s' has teleported to %s. Type '/%s' to teleport there.\");\r\n    }\r\n", COLOUR_COMMAND, PlayerName, cmdtext[6], cmdtext[6]); // Formatting 'string' to hold a valid set of functions.
  140.                         fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  141.                         format(string, sizeof(string), "    else\r\n    {\r\n        SetPlayerInterior(playerid, %d);\r\n        SetPlayerPos(playerid, %f, %f, %f);\r\n        SetPlayerFacingAngle(playerid, %f);\r\n        return SendClientMessageToAll(0x%x, \"Player '%s' has teleported to %s. Type '/%s' to teleport there.\");\r\n    }\r\n}\r\n", Interior, x, y, z, Ang, COLOUR_COMMAND, PlayerName, cmdtext[6], cmdtext[6]); // Formatting 'string' to hold a valid set of functions.
  142.                         fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  143.                         #else // If 'SendAnnounceMessage' was NOT 1, do the following:
  144.                             format(string, sizeof(string), "    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)\r\n    {\r\n        SetPlayerInterior(playerid, %d);\r\n        LinkVehicleToInterior(GetPlayerVehicleID(playerid), %d);\r\n        SetVehiclePos(GetPlayerVehicleID(playerid), %f, %f, %f);\r\n        SetVehicleZAngle(GetPlayerVehicleID(playerid), %f);\r\n    return 1;\r\n    }\r\n", Interior, Interior, x, y, z, Ang); // Formatting 'string' to hold a valid set of functions.
  145.                         fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  146.                         format(string, sizeof(string), "    else\r\n    {\r\n        SetPlayerInterior(playerid, %d);\r\n        SetPlayerPos(playerid, %f, %f, %f);\r\n        SetPlayerFacingAngle(playerid, %f);\r\n    return 1;\r\n    }\r\n}\r\n", Interior, x, y, z, Ang); // Formatting 'string' to hold a valid set of functions.
  147.                         fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  148.                         #endif // End the check for 'SendAnnounceMessage == 1'. This will prevent errors.
  149.         #else // If 'VehicleTele' was NOT 1, do the following:
  150.             #if SendAnnounceMessage == 1 // If 'SendAnnounceMessage' is defined as 1, do the following:
  151.                         format(string, sizeof(string), "    SetPlayerInterior(playerid, %d);\r\n    SetPlayerPos(playerid, %f, %f, %f);\r\n    SetPlayerFacingAngle(playerid, %f);\r\n    return SendClientMessageToAll(0x%x, \"Player '%s' has teleported to %s. Type '%s' to teleport there.\");\r\n}\r\n", Interior, x, y, z, Ang, COLOUR_COMMAND, PlayerName, cmdtext[6], cmdtext[6]); // Formatting 'string' to hold a valid set of functions.
  152.                         fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  153.                         #else // If 'SendAnnounceMessage' was NOT 1, do the following:
  154.                             format(string, sizeof(string), "    SetPlayerInterior(playerid, %d);\r\n    SetPlayerPos(playerid, %f, %f, %f);\r\n    SetPlayerFacingAngle(playerid, %f);\r\n    return 1;\r\n}\r\n", Interior, x, y, z, Ang); // Formatting 'string' to hold a valid set of functions.
  155.                         fwrite(GenCmds, string); // Writing the formatted 'string' to our 'GenCmds' file.
  156.                         #endif // End the check for 'SendAnnounceMessage == 1'. This will prevent errors.
  157.         #endif // End the check for 'VehicleTele == 1'. This will prevent errors.
  158.  
  159.         fwrite(GenCmds, "\r\n// ******************* Command Generator By ~Cueball~ ******************* \\\\\r\n\r\n"); // Write a little command separator comment to the file.
  160.         fclose(GenCmds); // Close the file handle 'GenCmds'. This will successfully close 'Generated_Commands.txt', which will stop our server from crashing.
  161.  
  162.         #if PrintInConsole == 1 // If 'PrintInConsole' is defined as 1, do the following:
  163.                         printf("[generator] Player '%s' (IP: %s) requested '/%s'.", PlayerName, PlayerIp, cmdtext[6]); // Format a string with the necessary info, and then print it to the server console.
  164.                 #endif // End the check for 'PrintInConsole == 1'. This will prevent errors.
  165.  
  166.                 #if SendAdminMessage == 1 // If 'SendAdminMessage' is defined as 1, do the following:
  167.                         format(string, sizeof(string), "Command Generator: Player '%s' (ID: %d) requested '/%s'.", PlayerName, playerid, cmdtext[6]); // Formatting 'string' to hold a set of information about the player who generated the command.
  168.                         for(new i = 0; i <= MAX_PLAYERS; i++) // A for loop which runs a maximum of MAX_PLAYERS (200) times.
  169.                         if(IsPlayerConnected(i)) // If the current iteration is connected:
  170.                         if(IsPlayerAdmin(i)) // If the current iteration is logged in as an RCON admin:
  171.                                 SendClientMessage(i, 0x33CCFFAA, string); // Sending the formatted 'string' to the player.
  172.                 #endif // End the check for 'SendAdminMessage == 1'. This will prevent errors.
  173.  
  174.                 format(string, sizeof(string), "Command Generator: Your command '/%s' has been generated and sent to the server owner.", cmdtext[6]); // Formatting 'string' to hold a message containing the command name.
  175.                 SendClientMessage(playerid, 0x33CCFFAA, string); // Sending the formatted 'string' to the player.
  176.                 SendClientMessage(playerid, 0x33CCFFAA, "Your command statistics are:"); // Sending a message to the player.
  177.                 format(string, sizeof(string), "Command Name: /%s | Interior: %d | Angle Value: %.2f", cmdtext[6], Interior, Ang); // Formatting 'string' to hold a message containing relevant command information.
  178.                 SendClientMessage(playerid, 0x33CCFFAA, string); // Sending the formatted 'string' to the player.
  179.                 format(string, sizeof(string), "X Value: %.2f | Y Value: %.2f | Z Value: %.2f", x, y, z, Ang, Interior); // Formatting 'string' to hold a message containing relevant command information.
  180.                 SendClientMessage(playerid, 0x33CCFFAA, string); // Sending the formatted 'string' to the player.
  181.  
  182.                 #if SaveCommands == 1 // If 'SaveCommands' is defined as 1, do the following:
  183.                     if(CurrentCommand == MAX_COMMANDS) // If 'CurrentCommand' is equal to 'MAX_COMMANDS' (ie: The amount of commands has reached its maximum):
  184.                         CurrentCommand = 0; // Set 'CurrentCommand' to equal 0.
  185.                     format(gCommands[CurrentCommand][NAME], MAX_COMMAND_NAME, "%s", cmdtext[6]);   // Change the current command's 'NAME' cell of our 'gCommands' array to the name of the command.
  186.                     format(gCommands[CurrentCommand][CREATOR], MAX_PLAYER_NAME, "%s", PlayerName); // Change the current command's 'CREATOR' cell of our 'gCommands' array to the name of the command creator.
  187.             gCommands[CurrentCommand][POS][0] = x;   // Store the 'x' co-ordinate of our command in the first cell of our current command's 'POS' cell of our 'gCommands' array.
  188.             gCommands[CurrentCommand][POS][1] = y;   // Store the 'y' co-ordinate of our command in the second cell of our current command's 'POS' cell of our 'gCommands' array.
  189.             gCommands[CurrentCommand][POS][2] = z;   // Store the 'z' co-ordinate of our command in the third cell of our current command's 'POS' cell of our 'gCommands' array.
  190.             gCommands[CurrentCommand][POS][3] = Ang; // Store the 'angle' co-ordinate of our command in the fourth cell of our current command's 'POS' cell of our 'gCommands' array.
  191.             gCommands[CurrentCommand][INTERIOR] = GetPlayerInterior(playerid); // Store the interior of our command in our current command's 'INTERIOR' cell of our 'gCommands' array.
  192.             format(string, sizeof(string), "The server has allowed your command to be used immediately. Type '/%s' to teleport to this current location.", cmdtext[6]); // Formatting 'string' to hold a message containing the command name.
  193.             SendClientMessage(playerid, 0xFF9900AA, string); // Sending the formatted 'string' to the player.
  194.             CurrentCommand++;
  195.                 #endif // End the check for 'SaveCommands == 1'. This will prevent errors.
  196.  
  197.                 return 1; // Return 1 to the server, and stop the 'SERVER: Unknown command.' message being sent to the player.
  198.         }
  199.  
  200.     #if SaveCommands == 1 // If 'SaveCommands' is defined as 1, do the following:
  201.         format(string, MAX_COMMAND_NAME, "%s", cmdtext[1]); // Formatting 'string' to hold their command name, so that we can successfully compare strings later.
  202.  
  203.                 for(new i = 0; i <= MAX_COMMANDS; i++) // A for loop which runs a maximum of MAX_COMMANDS times.
  204.                 {
  205.                 if(gCommands[i][NAME][0] != '\0' && strcmp(string, gCommands[i][NAME], true, strlen(gCommands[i][NAME])) == 0) // If the current cell of 'gCommands[*][NAME][0]' is not empty AND it is the same as the command name the player supplied, do the following:
  206.                 {
  207.                         #if VehicleTele == 1 // If 'VehicleTele' is defined as 1, do the following:
  208.                         if(IsPlayerInAnyVehicle(playerid)) // If the player is in ANY vehicle, do the following:
  209.                         {
  210.                                 SetPlayerInterior(playerid, gCommands[i][INTERIOR]); // Set the player's interior to the correct value for our command.
  211.                                 LinkVehicleToInterior(GetPlayerVehicleID(playerid), gCommands[i][INTERIOR]); // Get the player's vehicle id, and set its interior to the correct value for our command.
  212.                                 SetVehiclePos(GetPlayerVehicleID(playerid), gCommands[i][POS][0], gCommands[i][POS][1], gCommands[i][POS][2]); // Get the player's vehicle id, and set its position to the correct co-ordinate for our command.
  213.                                         SetVehicleZAngle(GetPlayerVehicleID(playerid), gCommands[i][POS][3]); // Get the player's vehicle id, and set it to face the correct angle for our command.
  214.                                         }
  215.                                         else // If the player is NOT in a vehicle, do the following:
  216.                                         {
  217.                                         SetPlayerInterior(playerid, gCommands[i][INTERIOR]); // Set the player's interior to the correct value for our command.
  218.                                                 SetPlayerPos(playerid, gCommands[i][POS][0], gCommands[i][POS][1], gCommands[i][POS][2]); // Set the player's position to the correct co-ordinate for our command.
  219.                                         SetPlayerFacingAngle(playerid, gCommands[i][POS][3]); // Set the player to face the correct angle for our command.
  220.                                         }
  221.                         #else // If 'VehicleTele' was NOT 1, do the following:
  222.                                 SetPlayerInterior(playerid, gCommands[i][INTERIOR]); // Set the player's interior to the correct value for our command.
  223.                                 SetPlayerPos(playerid, gCommands[i][POS][0], gCommands[i][POS][1], gCommands[i][POS][2]); // Set the player's position to the correct co-ordinate for our command.
  224.                                 SetPlayerFacingAngle(playerid, gCommands[i][POS][3]); // Set the player to face the correct angle for our command.
  225.                         #endif // End the check for 'VehicleTele == 1'. This will prevent errors.
  226.  
  227.                         #if SendTeleMessage == 1 // If 'SendTeleMessage' is defined as 1, do the following:
  228.                         format(string, sizeof(string), "Command '/%s' was created by '%s'. You can create your own commands by typing '/cgen' at your wanted location.", gCommands[i][NAME], gCommands[i][CREATOR]); // Formatting 'string' to hold a message containing the command name and the creator of the command's name.
  229.                         SendClientMessage(playerid, 0x33CCFFAA, string); // Sending the formatted 'string' to the player.
  230.                                 #endif // End the check for 'SendTeleMessage == 1'. This will prevent errors.
  231.  
  232.                             #if SendAnnounceMessage == 1 // If 'SendAnnounceMessage' is defined as 1, do the following:
  233.                                 GetPlayerName(playerid, string, MAX_PLAYER_NAME); // Store the players name into our 'string' variable, with a maximum length of 24 ('MAX_PLAYER_NAME').
  234.                         format(string, sizeof(string), "Player '%s' has teleported to %s. Type '%s' to teleport there.", string, gCommands[i][NAME], cmdtext); // Formatting 'string' to hold a message containing the players name and the command name.
  235.                         SendClientMessageToAll(COLOUR_COMMAND, string); // Sending the formatted 'string' to the player in the defined colour.
  236.                                 #endif // End the check for 'SendAnnounceMessage == 1'. This will prevent errors.
  237.  
  238.                         return 1; // Return 1 to the server, and stop the 'SERVER: Unknown command.' message being sent to the player.
  239.                         }
  240.                 }
  241.         #endif // End the check for 'SaveCommands == 1'. This will prevent errors.
  242.  
  243.         return 0; // Send the 'SERVER: Unknown command.' message for any other commands.
  244. }
  245.  
  246. //******************************************************************************************************
  247.  
  248. public OnVehicleSpawn(vehicleid)
  249.         return LinkVehicleToInterior(vehicleid, 0); // Set the vehicle's interior to 0, which will prevent cars from being invisible if they were used in a generated command with an interior other than 0 (inside a building).