Guest User

Calvins TDM Script

a guest
Sep 4th, 2011
864
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 38.92 KB | None | 0 0
  1.     // This script was made by Calvin Jones a.k.a Malcom Jones and has mapping's from Calvin
  2.     //Credits to Kush for his SII register system tutorial
  3.     //Credits to Amel_PAtomAXx for the tutorial on how to make chats
  4.     //Credits also goes out to Toni for the ZCMD command tutorial
  5.     // and last credits goes to who ever i didnt mention its either because i forgot your name     
  6.     //The script has the following features
  7.     //1:<SII> register/login system 2:<ZCMD> Commands 3:New chat OOC 4:Auto Announcements 5: Gang turfs 6:Speedo meeter
  8.     //7:Anti Spawn Kill
  9.      
  10.     //======[includes]==================
  11.     #include <a_samp>
  12.     #include <SII>
  13.     #include <sscanf2>
  14.     #include <zcmd>
  15.     //============[Defines]===============
  16.     #define DIALOG_REGISTER 2000
  17.     #define DIALOG_LOGIN 2001
  18.     #define TEAM_BALLAS ( 0 ) // Defines TEAM_BALLAS as team ID 0
  19.     #define TEAM_GROVE ( 1 ) // Defines TEAM_CJ as team ID 1
  20.     #define TEAM_VAGOS (2)
  21.     #define TEAM_VLA (3)
  22.     #define TAKEOVER_TIME 120 // how many seconds needed to take over the zone
  23.     #define MIN_MEMBERS_TO_START_WAR 3 // how many team members needed in a zone to start a war
  24.     #define TAKEOVER_TIME 120 // how many seconds needed to take over the zone
  25.     #define MIN_DEATHS_TO_START_WAR 3 // how many team members must be killed in a zone to start a war
  26.     //==============[colors]=================
  27.     #define COLOR_GREY 0xAFAFAFAA
  28.     #define COLOR_LIGHTBLUE 0x33CCFFAA
  29.     #define WHITE "{FFFFFF}"
  30.     #define RED "{F81414}"
  31.     #define GREEN "{00FF22}"
  32.     #define LIGHTBLUE "{00CED1}"
  33.     #define ORANGE "{FFAF00}"
  34.     #define BLUE "{0025E1}"
  35.     #define PURPLE "{FF00FF}"
  36.     //chat colors
  37.     #define COLOR_FADE1 0xFFFFFFFF
  38.     #define COLOR_FADE2 0xC8C8C8C8
  39.     #define COLOR_FADE3 0xAAAAAAAA
  40.     #define COLOR_FADE4 0x8C8C8C8C
  41.     #define COLOR_FADE5 0x6E6E6E6E
  42.     #define COLOR_WHITE  0xFFFFFFFF
  43.     //=====================[forwards]============
  44.     forward SendRandomMsgToAll();
  45.     forward speedometer(playerid); // This Forwards The Timer To Our Function
  46.     forward AntiSpawnKill(playerid);
  47.     //====================[new]===============
  48.     new gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
  49.     new Grove;//gang turf
  50.     new Ballas;//gang turfs
  51.     new Vagos;//gang turfs
  52.     new VLA;//gang turfs
  53.     new Float:svx[MAX_PLAYERS]; // Holds Velocity X
  54.     new Float:svy[MAX_PLAYERS]; // Holds Velocity Y
  55.     new Float:svz[MAX_PLAYERS]; // Holds Velocity Z
  56.     new Float:s1[MAX_PLAYERS]; // This Is What Our Forumula Outputs
  57.     new s2[MAX_PLAYERS]; // This Is The Output When The Forumula's Ouput Is Round
  58.     new s3[MAX_PLAYERS][256]; // This Is The Text That Is Displayed To The User
  59.     new Text:sdisplay[MAX_PLAYERS]; // This Holds The Textdraw's ID
  60.     new stimer[MAX_PLAYERS]; // This Holds The Timer's ID (Used To Refresh Speed)
  61.     //=================[enum]===============
  62.     enum pInfo
  63.     {
  64.         pPass,
  65.         pScore,
  66.         pCash,
  67.         pAdmin
  68.     }
  69.     new PlayerInfo[MAX_PLAYERS][pInfo];
  70.     //=====================[stock]=================
  71.     stock getINI(playerid)
  72.     {
  73.       new account[64];
  74.       format(account,30,"Users/%s.ini",gPlayerName[playerid]);
  75.       return account;
  76.     }
  77.     stock strreplace(string[], find, replace)
  78.     {
  79.         for(new i=0; string[i]; i++)
  80.         {
  81.             if(string[i] == find)
  82.             {
  83.                 string[i] = replace;
  84.             }
  85.         }
  86.     }
  87.     //======================[Prox]======================
  88.     ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  89.     {
  90.         if(IsPlayerConnected(playerid))
  91.         {
  92.             new Float:posx, Float:posy, Float:posz;
  93.             new Float:oldposx, Float:oldposy, Float:oldposz;
  94.             new Float:tempposx, Float:tempposy, Float:tempposz;
  95.             GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  96.             for(new i = 0; i < MAX_PLAYERS; i++)
  97.             {
  98.                 if(IsPlayerConnected(i))
  99.                 {
  100.                     GetPlayerPos(i, posx, posy, posz);
  101.                     tempposx = (oldposx -posx);
  102.                     tempposy = (oldposy -posy);
  103.                     tempposz = (oldposz -posz);
  104.                     if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  105.                     {
  106.                         if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  107.                         {
  108.                             SendClientMessage(i, col1, string);
  109.                         }
  110.                         else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  111.                         {
  112.                             SendClientMessage(i, col2, string);
  113.                         }
  114.                         else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  115.                         {
  116.                             SendClientMessage(i, col3, string);
  117.                         }
  118.                         else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  119.                         {
  120.                             SendClientMessage(i, col4, string);
  121.                         }
  122.                         else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  123.                         {
  124.                             SendClientMessage(i, col5, string);
  125.                         }
  126.                     }
  127.                 }
  128.             }
  129.         }
  130.         return 1;
  131.     }
  132.     //==========[End of prox]========================================================================
  133.     main()
  134.     {
  135.             print("\n----------------------------------");
  136.             print(" Calvins Gamemode                                   ");
  137.             print("----------------------------------\n");
  138.     }
  139.     public OnGameModeInit()
  140.     {
  141.             SetGameModeText("Calvins Gamemode");
  142.             SetTimer("SendRandomMsgToAll", 60 * 1000, 1);
  143.             //Ballas-weapons start  behind float a                   //FLOAT A  /wep 1  /wep 2   /wep 3
  144.             AddPlayerClass(102, 2002.281616, -1123.249633, 26.577611, 269.1425, 5, 150, 28, 150, 24, 150);
  145.             AddPlayerClass(103, 2002.281616, -1123.249633, 26.577611, 269.1425, 27, 150, 29, 150, 31, 150);
  146.             AddPlayerClass(104, 2002.281616, -1123.249633, 26.577611, 269.1425, 24, 150, 32, 150, 27, 150);
  147.             //Grove
  148.         AddPlayerClass(105, 2478.777832, -1661.156738, 13.343750, 269.1425, 24, 150, 29, 150, 27, 150);
  149.         AddPlayerClass(106, 2478.777832, -1661.156738, 13.343750, 269.1425, 22, 150, 28, 150, 30, 150);
  150.         AddPlayerClass(107, 2478.777832, -1661.156738, 13.343750, 269.1425, 24, 150, 28, 150, 31, 150);
  151.         AddPlayerClass(270, 2478.777832, -1661.156738, 13.343750, 269.1425, 24, 150, 32, 150, 33, 150);
  152.         AddPlayerClass(271, 2478.777832, -1661.156738, 13.343750, 269.1425, 24, 150, 28, 150, 34, 150);
  153.         AddPlayerClass(269, 2478.777832, -1661.156738, 13.343750, 269.1425, 24, 150, 32, 150, 26, 150);
  154.         //vagos
  155.         AddPlayerClass(108, 1882.914916, -2040.028686, 13.390607, 269.1425, 22, 150, 28, 150, 30, 150);
  156.         AddPlayerClass(109, 1882.914916, -2040.028686, 13.390607, 269.1425, 23, 150, 29, 150, 31, 150);
  157.         AddPlayerClass(110, 1882.914916, -2040.028686, 13.390607, 269.1425, 24, 150, 32, 150, 27, 150);
  158.         //CJ
  159.             //AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  160.         //Los Aztecas
  161.         AddPlayerClass(114, 2785.370361, -1994.306518, 13.382812, 269.1425, 22, 150, 28, 150, 30, 150);
  162.         AddPlayerClass(115, 2785.370361, -1994.306518, 13.382812, 269.1425, 23, 150, 29, 150, 31, 150);
  163.         AddPlayerClass(116, 2785.370361, -1994.306518, 13.382812, 269.1425, 24, 150, 32, 150, 27, 150);
  164.         //Vehicles
  165.             AddStaticVehicleEx(566,2007.69995117,-1131.00000000,25.00000000,87.99499512,85,1,15); //Tahoma
  166.             AddStaticVehicleEx(566,1994.80004883,-1131.19995117,25.39999962,89.99401855,85,1,15); //Tahoma
  167.             AddStaticVehicleEx(522,1998.00000000,-1116.00000000,26.39999962,0.00000000,85,1,15); //NRG-500
  168.             AddStaticVehicleEx(522,1993.69995117,-1115.90002441,26.39999962,0.00000000,85,1,15); //NRG-500
  169.             AddStaticVehicleEx(522,1995.69995117,-1116.00000000,26.39999962,0.00000000,85,1,15); //NRG-500
  170.             AddStaticVehicleEx(567,2004.40002441,-1120.59997559,26.60000038,179.99963379,85,1,15); //Savanna
  171.             AddStaticVehicleEx(492,2508.69995117,-1669.00000000,13.30000019,0.00000000,16,1,15); //Greenwood
  172.             AddStaticVehicleEx(522,2507.89990234,-1687.09997559,13.19999981,0.00000000,16,1,15); //NRG-500
  173.             AddStaticVehicleEx(522,2506.00000000,-1686.90002441,13.19999981,0.00000000,16,1,15); //NRG-500
  174.             AddStaticVehicleEx(522,2503.89990234,-1687.00000000,13.19999981,0.00000000,16,1,15); //NRG-500
  175.             AddStaticVehicleEx(600,2473.60009766,-1690.40002441,13.39999962,0.00000000,16,1,15); //Picador
  176.             AddStaticVehicleEx(550,2502.80004883,-1657.80004883,13.30000019,54.00000000,16,1,15); //Sunrise
  177.             AddStaticVehicleEx(550,2492.00000000,-1682.80004883,13.30000019,89.99780273,16,1,15); //Sunrise
  178.             AddStaticVehicleEx(550,2483.39990234,-1682.40002441,13.30000019,83.99450684,16,1,15); //Sunrise
  179.             AddStaticVehicleEx(550,2484.60009766,-1655.19995117,13.19999981,89.99450684,16,1,15); //Sunrise
  180.             AddStaticVehicleEx(509,2763.19995117,-2006.59997559,13.19999981,0.00000000,100,1,15); //Bike
  181.             AddStaticVehicleEx(522,2767.50000000,-2006.69995117,13.19999981,0.00000000,2,1,15); //NRG-500
  182.             AddStaticVehicleEx(522,2769.10009766,-2006.59997559,13.19999981,0.00000000,2,1,15); //NRG-500
  183.             AddStaticVehicleEx(522,2770.50000000,-2006.40002441,13.19999981,0.00000000,2,1,15); //NRG-500
  184.             AddStaticVehicleEx(522,2771.80004883,-2006.30004883,13.19999981,0.00000000,2,1,15); //NRG-500
  185.             AddStaticVehicleEx(475,2764.60009766,-1983.00000000,13.30000019,0.00000000,2,1,15); //Sabre
  186.             AddStaticVehicleEx(475,2764.30004883,-1975.69995117,13.39999962,0.00000000,2,1,15); //Sabre
  187.             AddStaticVehicleEx(509,2763.39990234,-2011.69995117,13.19999981,0.00000000,100,1,15); //Bike
  188.             AddStaticVehicleEx(567,2774.69995117,-1967.50000000,13.50000000,0.00000000,2,1,15); //Savanna
  189.             AddStaticVehicleEx(575,2764.30004883,-1968.40002441,13.30000019,0.00000000,2,2,15); //Broadway
  190.             AddStaticVehicleEx(575,2774.80004883,-1974.50000000,13.30000019,0.00000000,2,2,15); //Broadway
  191.             AddStaticVehicleEx(567,2774.69995117,-1958.50000000,13.50000000,0.00000000,2,1,15); //Savanna
  192.             AddStaticVehicleEx(536,2764.19995117,-1960.59997559,13.39999962,0.00000000,2,1,15); //Blade
  193.             AddStaticVehicleEx(576,1878.09997559,-2021.90002441,13.10000038,182.00000000,6,1,15); //Tornado
  194.             AddStaticVehicleEx(482,1878.09997559,-2028.69995117,13.60000038,177.99963379,6,1,15); //Burrito
  195.             AddStaticVehicleEx(522,1886.40002441,-2014.69995117,13.19999981,181.99963379,6,1,15); //NRG-500
  196.             AddStaticVehicleEx(522,1884.80004883,-2014.90002441,13.19999981,181.99951172,6,1,15); //NRG-500
  197.             AddStaticVehicleEx(522,1883.09997559,-2015.00000000,13.19999981,181.99951172,6,1,15); //NRG-500
  198.             AddStaticVehicleEx(522,1881.00000000,-2015.19995117,13.19999981,181.99951172,6,1,15); //NRG-500
  199.             AddStaticVehicleEx(576,1888.09997559,-2021.30004883,13.30000019,181.99951172,6,1,15); //Tornado
  200.             AddStaticVehicleEx(482,1888.00000000,-2027.90002441,13.60000038,177.99499512,6,1,15); //Burrito
  201.             AddStaticVehicleEx(467,1878.00000000,-2035.50000000,13.39999962,179.99963379,6,1,15); //Oceanic
  202.             AddStaticVehicleEx(467,1887.69995117,-2034.59997559,13.30000019,179.99450684,6,1,15); //Oceanic
  203.             //Objects start here
  204.             CreateObject(1432,2785.80004883,-1995.09997559,12.39999962,0.00000000,0.00000000,0.00000000); //object(dyn_table_2) (1)
  205.             CreateObject(1766,2782.30004883,-1991.59997559,12.39999962,0.00000000,0.00000000,0.00000000); //object(med_couch_1) (1)
  206.             CreateObject(2370,2782.69995117,-1994.40002441,12.39999962,0.00000000,0.00000000,0.00000000); //object(shop_set_1_table) (1)
  207.             CreateObject(1487,2782.60009766,-1993.59997559,13.39999962,0.00000000,0.00000000,0.00000000); //object(dyn_wine_1) (1)
  208.             CreateObject(1487,2782.89990234,-1994.19995117,13.39999962,0.00000000,0.00000000,0.00000000); //object(dyn_wine_1) (2)
  209.             CreateObject(1487,2785.60009766,-1995.00000000,13.19999981,0.00000000,0.00000000,0.00000000); //object(dyn_wine_1) (3)
  210.             CreateObject(1665,2783.39990234,-1993.69995117,13.30000019,0.00000000,0.00000000,0.00000000); //object(propashtray1) (1)
  211.             CreateObject(3044,2783.39990234,-1993.59997559,13.39999962,0.00000000,0.00000000,0.00000000); //object(cigar) (1)
  212.             CreateObject(1766,2780.50000000,-1993.80004883,12.39999962,0.00000000,0.00000000,90.00000000); //object(med_couch_1) (2)
  213.             //gang turfs
  214.             Grove = GangZoneCreate(2417.757, -1729.235, 2619.307, -1614.75);
  215.             Ballas = GangZoneCreate(1858.74, -1259.454, 2064.094, -1125.23);
  216.             Vagos = GangZoneCreate(1820.712, -2179.277, 1969.022, -1977.943);
  217.             VLA = GangZoneCreate(2699.167, -2056.897, 2786.632, -1898.988);
  218.             return 1;
  219.     }
  220.     public OnGameModeExit()
  221.     {
  222.             return 1;
  223.     }
  224.     public SendRandomMsgToAll()
  225.     {
  226.         switch(random(4))// "switch - case" is a sort of "if - else if - else" statement (operator?)
  227.         {
  228.             case 0: SendClientMessageToAll(0x00ff00ff, "Hi welcome to the server");  //Case means "if ( The function from switch() ) equals '0' (In this case)."
  229.             case 1: SendClientMessageToAll(0x00ff00ff, "Did you know Calvin created the server when he was learning to script?");
  230.             case 2: SendClientMessageToAll(0x00ff00ff, "If you get caught Hacking you will get banned.");
  231.             case 3: SendClientMessageToAll(0x00ff00ff, "This is a TDM/DM script.");
  232.             case 4: SendClientMessageToAll(0x00ff00ff, "If you spot a rule breaker /report.");
  233.         }
  234.      
  235.     }
  236.     public OnPlayerRequestClass(playerid, classid)
  237.     {
  238.             SetPlayerPos(playerid, 2201.6306,1217.2319,10.8128);
  239.             SetPlayerFacingAngle(playerid,178.6062);
  240.             SetPlayerCameraPos(playerid, 2202.2537,1210.6444,10.8128);
  241.             SetPlayerCameraLookAt(playerid, 2201.6306,1217.2319,10.8128);
  242.             switch ( classid ) // This is like a if/elseif statement.
  243.         {
  244.             case 0: // If the classid is 0
  245.             { // Then
  246.                 GameTextForPlayer( playerid, "~p~Glen Park Ballas", 300, 3 );
  247.                 // Sends a gametext for player
  248.                 // ~r~ is a red color in gametext.
  249.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  250.                 // Wiki for more info
  251.                 SetPlayerTeam( playerid, TEAM_BALLAS ); // Sets the player's team to TEAM_BALLAS
  252.             }
  253.                     case 1: // If the classid is 1
  254.             { // Then
  255.                 GameTextForPlayer( playerid, "~p~Glen Park Ballas", 300, 3 );
  256.                 // Sends a gametext for player
  257.                 // ~g~ is a green color in gametext.
  258.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  259.                 // Wiki for more info
  260.                 SetPlayerTeam( playerid, TEAM_BALLAS ); // Sets the player's team to TEAM_Grove
  261.             }
  262.                     case 2: // If the classid is 1
  263.             { // Then
  264.                 GameTextForPlayer( playerid, "~p~Glen Park Ballas", 300, 3 );
  265.                 // Sends a gametext for player
  266.                 // ~g~ is a green color in gametext.
  267.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  268.                 // Wiki for more info
  269.                 SetPlayerTeam( playerid, TEAM_BALLAS); // Sets the player's team to TEAM_Grove
  270.             }
  271.             case 3: // If the classid is 1
  272.             { // Then
  273.                 GameTextForPlayer( playerid, "~g~Grove Street", 300, 3 );
  274.                 // Sends a gametext for player
  275.                 // ~g~ is a green color in gametext.
  276.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  277.                 // Wiki for more info
  278.                 SetPlayerTeam( playerid, TEAM_GROVE ); // Sets the player's team to TEAM_Grove
  279.             }
  280.                     case 4: // If the classid is 1
  281.             { // Then
  282.                 GameTextForPlayer( playerid, "~g~Grove Street", 300, 3 );
  283.                 // Sends a gametext for player
  284.                 // ~g~ is a green color in gametext.
  285.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  286.                 // Wiki for more info
  287.                 SetPlayerTeam( playerid, TEAM_GROVE ); // Sets the player's team to TEAM_Grove
  288.             }
  289.                     case 5: // If the classid is 1
  290.             { // Then
  291.                 GameTextForPlayer( playerid, "~g~Grove Street", 300, 3 );
  292.                 // Sends a gametext for player
  293.                 // ~g~ is a green color in gametext.
  294.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  295.                 // Wiki for more info
  296.                 SetPlayerTeam( playerid, TEAM_GROVE ); // Sets the player's team to TEAM_Grove
  297.             }
  298.                     case 6: // If the classid is 1
  299.             { // Then
  300.                 GameTextForPlayer( playerid, "~g~Grove Street", 300, 3 );
  301.                 // Sends a gametext for player
  302.                 // ~g~ is a green color in gametext.
  303.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  304.                 // Wiki for more info
  305.                 SetPlayerTeam( playerid, TEAM_GROVE ); // Sets the player's team to TEAM_Grove
  306.             }
  307.                     case 7: // If the classid is 1
  308.             { // Then
  309.                 GameTextForPlayer( playerid, "~g~Grove Street", 300, 3 );
  310.                 // Sends a gametext for player
  311.                 // ~g~ is a green color in gametext.
  312.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  313.                 // Wiki for more info
  314.                 SetPlayerTeam( playerid, TEAM_GROVE ); // Sets the player's team to TEAM_Grove
  315.             }
  316.                     case 8: // If the classid is 1
  317.             { // Then
  318.                 GameTextForPlayer( playerid, "~g~Grove Street", 300, 3 );
  319.                 // Sends a gametext for player
  320.                 // ~g~ is a green color in gametext.
  321.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  322.                 // Wiki for more info
  323.                 SetPlayerTeam( playerid, TEAM_GROVE ); // Sets the player's team to TEAM_Grove
  324.             }
  325.                     case 9: // If the classid is 1
  326.             { // Then
  327.                 GameTextForPlayer( playerid, "~y~LS Vagos", 300, 3 );
  328.                 // Sends a gametext for player
  329.                 // ~g~ is a green color in gametext.
  330.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  331.                 // Wiki for more info
  332.                 SetPlayerTeam( playerid, TEAM_VAGOS ); // Sets the player's team to TEAM_Grove
  333.             }
  334.             case 10: // If the classid is 2
  335.             { // Then
  336.                 GameTextForPlayer( playerid, "~y~LS Vagos", 300, 3 );
  337.                 // Sends a gametext for player
  338.                 // ~g~ is a green color in gametext.
  339.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  340.                 // Wiki for more info
  341.                 SetPlayerTeam( playerid, TEAM_VAGOS ); // Sets the player's team to TEAM_Vagos
  342.             }
  343.             case 11: // If the classid is 2
  344.             { // Then
  345.                 GameTextForPlayer( playerid, "~y~LS Vagos", 300, 3 );
  346.                 // Sends a gametext for player
  347.                 // ~g~ is a green color in gametext.
  348.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  349.                 // Wiki for more info
  350.                 SetPlayerTeam( playerid, TEAM_VAGOS ); // Sets the player's team to TEAM_Vagos
  351.                     }
  352.                     case 12: // If the classid is 2
  353.             { // Then
  354.                 GameTextForPlayer( playerid, "~b~Los Aztecas", 300, 3 );
  355.                 // Sends a gametext for player
  356.                 // ~g~ is a green color in gametext.
  357.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  358.                 // Wiki for more info
  359.                 SetPlayerTeam( playerid, TEAM_VLA ); // Sets the player's team to TEAM_Vagos
  360.             }
  361.                     case 13: // If the classid is 2
  362.                     {
  363.                 GameTextForPlayer( playerid, "~b~Los Aztecas", 300, 3 );
  364.                 // Sends a gametext for player
  365.                 // ~g~ is a green color in gametext.
  366.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  367.                 // Wiki for more info
  368.                 SetPlayerTeam( playerid, TEAM_VLA ); // Sets the player's team to TEAM_Vagos
  369.                     }
  370.                     case 14: // If the classid is 2
  371.             { // Then
  372.                 GameTextForPlayer( playerid, "~b~Los Aztecas", 300, 3 );
  373.                 // Sends a gametext for player
  374.                 // ~g~ is a green color in gametext.
  375.                 // Arguments : Player ID, const string[ ], time ( milliseconds ), style
  376.                 // Wiki for more info
  377.                 SetPlayerTeam( playerid, TEAM_VLA ); // Sets the player's team to TEAM_Vagos
  378.             }
  379.         }
  380.         return 1; // This means the callback is executed succesfully AFAIK.
  381.     }
  382.     public speedometer(playerid) {
  383.         GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); // This Saves Our Velocitys To Our Varibles
  384.         s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100; // This Is Our Forumula ( I Don't Know How It Works )
  385.         s2[playerid] = floatround(s1[playerid],floatround_round); // This Rounds Our Output To The Nearest Whole Number
  386.         format(s3[playerid],256,"%i MPH", s2[playerid]); // This Format Our Text Into What We See
  387.         TextDrawSetString(sdisplay[playerid], s3[playerid]); // This Changes The Value Of Our Textdraw To What We Formatted
  388.         return 1;
  389.     }
  390.     public OnPlayerConnect(playerid)
  391.     {
  392.             sdisplay[playerid] = TextDrawCreate(10.0,200.0," "); // This Creates Our Textdraw And Stores The Id In The Varible In Front
  393.         TextDrawSetShadow(sdisplay[playerid],0); // This Removes Our Textdraw's Shadow ( Makes Easier To Read )
  394.         TextDrawSetOutline(sdisplay[playerid],1); // This Adds A Black Outline To Our Textdraw ( Makes Easier To Read )
  395.         TextDrawFont(sdisplay[playerid], 2); // This Changes Our Textdraw's Font ( I Think This Ones Makes It Easier To Read )
  396.         TextDrawShowForPlayer(playerid,sdisplay[playerid]); // This Shows The User The Textdraw
  397.             GameTextForPlayer(playerid,"~w~SA-MP: ~r~Calvins TDM Script",5000,5);
  398.         GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
  399.         if (fexist(getINI(playerid)))
  400.         {
  401.             ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
  402.         }
  403.         else
  404.         {
  405.             ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""WHITE"Registering...",""WHITE"Type your password below to register a new account.","Register","Quit");
  406.         }
  407.         return 1;
  408.     }
  409.     public OnPlayerDisconnect(playerid, reason)
  410.     {
  411.         return 1;
  412.     }
  413.     public AntiSpawnKill(playerid)
  414.     {
  415.         SetPlayerHealth(playerid,100.0);
  416.         SendClientMessage(playerid,COLOR_GREY,"AntiSpawnKill is now off you have 100 life now!");
  417.         return 1;
  418.     }
  419.     public OnPlayerSpawn(playerid)
  420.     {
  421.             SetPlayerHealth(playerid,99999);
  422.             SetTimerEx("AntiSpawnKill",6000,0,"i",playerid);
  423.             GangZoneShowForPlayer(playerid, Grove, 0x0080005F);
  424.             GangZoneShowForPlayer(playerid, Ballas, 0x40008096);
  425.             GangZoneShowForPlayer(playerid, Vagos, 0xFFFF0096);
  426.             GangZoneShowForPlayer(playerid, VLA, 0x00FFFF96);
  427.             return 1;
  428.     }
  429.     public OnPlayerDeath( playerid, killerid, reason ) // This is called when a player deaths.
  430.     {
  431.         if ( killerid != INVALID_PLAYER_ID ) // If the killerid are NOT an invalid player
  432.         { // Then
  433.             if ( GetPlayerTeam( killerid ) == GetPlayerTeam( playerid ) ) // If killerid's team == playerid's team ( who has been killed )
  434.             { // Then
  435.                 SetPlayerHealth( killerid, -1 ); // Kills the killer ( Setting the health to -1 ).
  436.      
  437.                 SendClientMessage( killerid, -1, "No teamkilling." ); // Sends a message to the killer with a white colour ( -1 ), with the message " No teamkilling. ".
  438.      
  439.                 GivePlayerMoney( killerid, - 5000 ); // Take $5000 from the killerid, because teamkilling,
  440.             }
  441.      
  442.             else // Another team killed the player
  443.             {
  444.                 SendClientMessage( killerid, -1, "Nice shot!" ); // Sends a message to the killer with a white colour ( -1 ) with the message "Nice Shot! ".
  445.      
  446.                 GivePlayerMoney( killerid, 5000 ); // Gives the killerid $5000.
  447.             }
  448.         }
  449.      
  450.         SendDeathMessage(  killerid, playerid, reason ); // Sends a death message about the killerid is killing the player, with the reason ( At the middle right of your game, can be toggled by pressing F9 ).
  451.         return 1; // This means the callback is executed succesfully AFAIK.
  452.     }
  453.      
  454.     public OnVehicleSpawn(vehicleid)
  455.     {
  456.             return 1;
  457.     }
  458.      
  459.     public OnVehicleDeath(vehicleid, killerid)
  460.     {
  461.             return 1;
  462.     }
  463.      
  464.     public OnPlayerText(playerid, text[])
  465.     {
  466.         new pname[MAX_PLAYER_NAME], str[128];//reduce it if you want
  467.         GetPlayerName(playerid, pname, sizeof(pname));
  468.         strreplace(pname, '_', ' ');
  469.         format(str, sizeof(str), "%s says: %s", pname, text);//Appearance of the text submitted by a nearby player.
  470.         /*
  471.          * The first parameter states the radius of the area where the text will be submitted and if a player is inside the radius, the person will receive it.
  472.          * The second parameter is the player that is submitting the text.
  473.          * The third parameter will specify what exactly the text is, in this case %speaker says: %text.
  474.          * The rest of the parameters are the fading colors, where how far the receiver is far from the talker.
  475.         */
  476.         ProxDetector(30.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
  477.         return 0;//So that the text is not submitted regularly.
  478.     }
  479.     COMMAND:ooc(playerid, params[])
  480.     {
  481.         new sendername[MAX_PLAYER_NAME], string[128];
  482.         GetPlayerName(playerid, sendername, sizeof(sendername));
  483.         strreplace(sendername, '_', ' ');
  484.         format(string, sizeof(string), "(( %s: %s ))", sendername, params);
  485.         SendClientMessageToAll(COLOR_WHITE, string);
  486.         return 1;
  487.     }
  488.     COMMAND:info(playerid, params)
  489.     {
  490.             SendClientMessage(playerid, COLOR_GREY,"/Report /adminhelp /pmhelp /Weaponhelp /kill");
  491.             SendClientMessage(playerid, COLOR_GREY,"This is the beginning commands");
  492.             return 1;
  493.     }
  494.     COMMAND:weaponhelp(playerid, params)
  495.     {
  496.                     SendClientMessage(playerid, COLOR_GREY,"To buy weapons go to any ammunation in Los Santos.");
  497.                     return 1;
  498.     }
  499.     COMMAND:kill(playerid, params)
  500.     {
  501.       SetPlayerHealth(playerid, 0);
  502.       return 1;
  503.     }
  504.     COMMAND:pmhelp(playerid, params)
  505.     {
  506.                     SendClientMessage(playerid, COLOR_GREY,"To PM(private message) a player use /pm");
  507.                     return 1;
  508.     }
  509.     COMMAND:adminhelp(playerid, params)
  510.     {
  511.             SendClientMessage(playerid, COLOR_GREY,"Level 1 Admin /kick /godmodeon /godmodeoff /teleport /goto /kick");
  512.             SendClientMessage(playerid, COLOR_GREY,"Next admin level coming soon!");
  513.             return 1;
  514.     }
  515.     COMMAND:godmodeon(playerid, params[])
  516.     {
  517.             if(PlayerInfo[playerid][pAdmin] >= 1)
  518.             {
  519.                     SetPlayerHealth(playerid, 10000000);
  520.                     SetPlayerArmour(playerid, 10000000);
  521.             }
  522.             else
  523.             {
  524.                 SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  525.             }
  526.             return 1;
  527.     }
  528.     COMMAND:pm(playerid, params[])
  529.     {
  530.         new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
  531.         if(sscanf(params, "us", id, str2))
  532.         {
  533.             SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm <id> <message>");
  534.             return 1;
  535.         }
  536.         if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
  537.         if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
  538.         {
  539.             GetPlayerName(playerid, Name1, sizeof(Name1));
  540.             GetPlayerName(id, Name2, sizeof(Name2));
  541.             format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
  542.             SendClientMessage(playerid, 0xFF0000FF, str);
  543.             format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
  544.             SendClientMessage(id, 0xFF0000FF, str);
  545.         }
  546.         return 1;
  547.     }
  548.     COMMAND:godmodeoff(playerid, params[])
  549.     {
  550.             if(PlayerInfo[playerid][pAdmin] >= 1)
  551.             {
  552.                     SetPlayerHealth(playerid, 100);
  553.                     SetPlayerArmour(playerid, 100);
  554.             }
  555.             else
  556.             {
  557.                 SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  558.             }
  559.             return 1;
  560.     }
  561.      
  562.     COMMAND:teleport(playerid, params[])
  563.     {
  564.             if(PlayerInfo[playerid][pAdmin] >= 1)
  565.             {
  566.             new ID;
  567.             if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /tele [playerid]");
  568.             else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  569.             else
  570.             {
  571.                     new Float:x, Float:y, Float:z;
  572.                     GetPlayerPos(playerid, x, y, z);
  573.                     SetPlayerPos(ID, x+1, y+1, z);
  574.                     }
  575.             }
  576.             else
  577.             {
  578.                 SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  579.             }
  580.             return 1;
  581.     }
  582.      
  583.     COMMAND:goto(playerid, params[])
  584.     {
  585.             if(PlayerInfo[playerid][pAdmin] >= 1)
  586.             {
  587.             new ID;
  588.             if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
  589.             else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  590.             else
  591.             {
  592.                     new Float:x, Float:y, Float:z;
  593.                     GetPlayerPos(ID, x, y, z);
  594.                     SetPlayerPos(playerid, x+1, y+1, z);
  595.                     }
  596.             }
  597.             else
  598.             {
  599.                 SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  600.             }
  601.             return 1;
  602.     }
  603.     COMMAND:kick(playerid, params[])
  604.     {
  605.         if(PlayerInfo[playerid][pAdmin] >= 1)
  606.         {
  607.             new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
  608.             if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid]");
  609.             if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
  610.      
  611.                     new Str[128];
  612.                     GetPlayerName(PID, pName, sizeof(pName));
  613.             GetPlayerName(playerid, Sender, sizeof(Sender));
  614.             format(Str, sizeof(Str), "You kicked %s!", pName);
  615.             SendClientMessage(playerid, COLOR_LIGHTBLUE, Str);
  616.             Kick(PID);
  617.      
  618.             }
  619.             else
  620.             {
  621.                 SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  622.             }
  623.             return 1;
  624.     }
  625.     COMMAND:makemeadmin(playerid, params[])
  626.     {
  627.             if(IsPlayerAdmin(playerid))
  628.             {
  629.                     PlayerInfo[playerid][pAdmin] = 1;
  630.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have made yourself an Admin!");
  631.             }
  632.             else
  633.             {
  634.                 SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  635.             }
  636.             return 1;
  637.     }
  638.     public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  639.     {
  640.             return 1;
  641.     }
  642.      
  643.     public OnPlayerExitVehicle(playerid, vehicleid)
  644.     {
  645.             return 1;
  646.     }
  647.     public OnPlayerStateChange(playerid, newstate, oldstate) { // This Is The Callback That Is Called When A Person Changes State ( ex States In_Vehicle, Dead, Passenger, Speculating... )
  648.         KillTimer(stimer[playerid]); // This Stops Our Timer For When You Get Out Of Your Vehicle Your Speed Doesn't Keep Going
  649.         TextDrawSetString(sdisplay[playerid], " "); // This Sets Our Textdraw To Blank And Freezes Because We Stop The Timer ^
  650.         if(newstate == 2) stimer[playerid] = SetTimerEx("speedometer", 255, true, "i", playerid); // This Starts The Timer When The Player Changes His/Her State To Being The Driver
  651.         else if(newstate == 3) stimer[playerid] = SetTimerEx("speedometer", 250, true, "i", playerid); // This Start The Timer When The Player Changes His/Her Start To Being The Passenger
  652.         return 1;
  653.     }
  654.     public OnPlayerEnterCheckpoint(playerid)
  655.     {
  656.             return 1;
  657.     }
  658.      
  659.     public OnPlayerLeaveCheckpoint(playerid)
  660.     {
  661.             return 1;
  662.     }
  663.      
  664.     public OnPlayerEnterRaceCheckpoint(playerid)
  665.     {
  666.             return 1;
  667.     }
  668.      
  669.     public OnPlayerLeaveRaceCheckpoint(playerid)
  670.     {
  671.             return 1;
  672.     }
  673.      
  674.     public OnRconCommand(cmd[])
  675.     {
  676.             return 1;
  677.     }
  678.      
  679.     public OnPlayerRequestSpawn(playerid)
  680.     {
  681.             return 1;
  682.     }
  683.      
  684.     public OnObjectMoved(objectid)
  685.     {
  686.             return 1;
  687.     }
  688.      
  689.     public OnPlayerObjectMoved(playerid, objectid)
  690.     {
  691.             return 1;
  692.     }
  693.      
  694.     public OnPlayerPickUpPickup(playerid, pickupid)
  695.     {
  696.             return 1;
  697.     }
  698.      
  699.     public OnVehicleMod(playerid, vehicleid, componentid)
  700.     {
  701.             return 1;
  702.     }
  703.      
  704.     public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  705.     {
  706.             return 1;
  707.     }
  708.      
  709.     public OnVehicleRespray(playerid, vehicleid, color1, color2)
  710.     {
  711.             return 1;
  712.     }
  713.      
  714.     public OnPlayerSelectedMenuRow(playerid, row)
  715.     {
  716.             return 1;
  717.     }
  718.      
  719.     public OnPlayerExitedMenu(playerid)
  720.     {
  721.             return 1;
  722.     }
  723.      
  724.     public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  725.     {
  726.             return 1;
  727.     }
  728.      
  729.     public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  730.     {
  731.             return 1;
  732.     }
  733.      
  734.     public OnRconLoginAttempt(ip[], password[], success)
  735.     {
  736.             return 1;
  737.     }
  738.      
  739.     public OnPlayerUpdate(playerid)
  740.     {
  741.             return 1;
  742.     }
  743.      
  744.     public OnPlayerStreamIn(playerid, forplayerid)
  745.     {
  746.             return 1;
  747.     }
  748.      
  749.     public OnPlayerStreamOut(playerid, forplayerid)
  750.     {
  751.             return 1;
  752.     }
  753.      
  754.     public OnVehicleStreamIn(vehicleid, forplayerid)
  755.     {
  756.             return 1;
  757.     }
  758.      
  759.     public OnVehicleStreamOut(vehicleid, forplayerid)
  760.     {
  761.             return 1;
  762.     }
  763.      
  764.     public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  765.     {
  766.         switch( dialogid )
  767.         {
  768.             case DIALOG_REGISTER:
  769.             {
  770.                 if (!response) return Kick(playerid);
  771.                 if (response)
  772.                 {
  773.                     if(!strlen(inputtext)) {
  774.                     ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Registering...",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
  775.                     }
  776.      
  777.                     if(INI_Open(getINI(playerid))) {
  778.                     INI_WriteString("Password",inputtext);
  779.                     INI_WriteInt("Score",1);
  780.                     INI_WriteInt("Cash",5000);
  781.                     INI_WriteInt("Admin",0);
  782.                     INI_Save();
  783.                     INI_Close();
  784.      
  785.                     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
  786.                 }
  787.             }
  788.         }
  789.             case DIALOG_LOGIN:
  790.             {
  791.                 if ( !response ) return Kick ( playerid );
  792.                 if( response )
  793.                 {
  794.                     if(!strlen(inputtext)) {
  795.                     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an invalid password.\n"WHITE"Type your password below to login.","Login","Quit");
  796.                     }
  797.      
  798.                     if(INI_Open(getINI(playerid))) {
  799.                     INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
  800.      
  801.                     if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) {
  802.                     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an incorrect password.\n"WHITE"Type your password below to login.","Login","Quit");
  803.                     }
  804.      
  805.                     SetPlayerScore( playerid, INI_ReadInt("Score" ) );
  806.                     ResetPlayerMoney( playerid );
  807.                     GivePlayerMoney( playerid, INI_ReadInt( "Cash" ) );
  808.                     PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
  809.                     INI_Close();
  810.                     }
  811.                 }
  812.             }
  813.         }
  814.         return 1;
  815.     }
  816.     public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  817.     {
  818.             return 1;
  819.     }
Advertisement
Add Comment
Please, Sign In to add comment