Advertisement
Guest User

HUNPeti

a guest
Oct 27th, 2008
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 14.10 KB | None | 0 0
  1. #include <a_samp>
  2. #include <float>
  3. #include <core>
  4.  
  5. enum PlayerInfEnum {
  6.     Float:X, Float:Y, Float:Z,
  7.     Weapons[7], Ammos[7]
  8. };
  9.  
  10. new PlayerInf[MAX_PLAYERS][PlayerInfEnum];
  11. new InGokart[MAX_PLAYERS], EndGokart[MAX_PLAYERS];
  12.  
  13. public OnFilterScriptInit() {
  14.     print("+----------------------------------+");
  15.     print("|        Gokart Track in SF        |");
  16.     print("|                by                |");
  17.     print("|            [HUN]Peti             |");
  18.     print("+----------------------------------+");
  19.     for(new e=0; e<GetMaxPlayers(); e++) {
  20.         InGokart[e] = false;
  21.         EndGokart[e] = false;
  22.     }
  23.     CreateObject(978,-2091.372,-111.997,35.161,0.0,0.0,-179.623);
  24.     CreateObject(978,-2082.217,-111.995,35.136,0.0,0.0,-179.623);
  25.     CreateObject(978,-2072.840,-111.930,35.168,0.0,0.0,-179.623);
  26.     CreateObject(978,-2063.583,-111.877,35.169,0.0,0.0,-179.623);
  27.     CreateObject(978,-2055.661,-115.274,35.164,0.0,0.0,-226.892);
  28.     CreateObject(978,-2037.446,-124.700,35.048,0.0,0.0,-281.036);
  29.     CreateObject(978,-2052.354,-123.254,35.131,0.0,0.0,-267.285);
  30.     CreateObject(978,-2055.398,-129.997,35.141,0.0,0.0,-320.570);
  31.     CreateObject(978,-2041.377,-132.767,35.129,0.0,1.719,-310.257);
  32.     CreateObject(978,-2048.537,-138.810,35.160,0.0,0.0,30.940);
  33.     CreateObject(978,-2056.749,-142.105,35.168,0.0,0.0,12.892);
  34.     CreateObject(978,-2065.794,-142.453,35.161,0.0,0.0,-10.313);
  35.     CreateObject(978,-2063.587,-132.650,35.161,0.0,0.0,-364.401);
  36.     CreateObject(978,-2072.439,-139.888,35.161,0.0,0.0,-33.518);
  37.     CreateObject(978,-2076.562,-135.390,35.161,0.0,0.0,-61.879);
  38.     CreateObject(978,-2078.187,-130.430,35.161,0.0,0.0,-85.944);
  39.     CreateObject(978,-2075.871,-125.681,35.161,0.0,0.0,-143.526);
  40.     CreateObject(978,-2071.988,-124.123,35.170,0.0,0.0,-179.623);
  41.     CreateObject(978,-2071.745,-123.083,35.170,0.0,0.0,-191.655);
  42.     CreateObject(978,-2079.101,-125.794,35.161,0.0,0.0,-123.759);
  43.     CreateObject(978,-2081.563,-134.060,35.168,0.0,0.0,-90.241);
  44.     CreateObject(1633,-2083.366,-142.824,35.371,0.0,0.0,182.201);
  45.     CreateObject(1633,-2087.475,-142.980,35.371,0.0,0.0,182.201);
  46.     CreateObject(1633,-2091.587,-143.217,35.396,0.0,0.0,182.201);
  47.     CreateObject(978,-2094.894,-134.028,35.161,0.0,0.0,-76.490);
  48.     CreateObject(3627,-2086.467,-166.469,32.710,0.0,0.0,1.719);
  49.     CreateObject(976,-2078.362,-145.941,34.395,0.0,0.0,-88.522);
  50.     CreateObject(976,-2078.141,-154.749,34.418,0.0,0.0,-88.522);
  51.     CreateObject(976,-2077.910,-163.573,34.426,0.0,0.0,-88.522);
  52.     CreateObject(976,-2077.621,-172.331,34.426,0.0,0.0,-88.522);
  53.     CreateObject(976,-2077.534,-177.932,34.372,0.0,0.0,-88.522);
  54.     CreateObject(1633,-2093.403,-190.122,35.346,0.0,0.0,0.963);
  55.     CreateObject(1633,-2089.245,-190.078,35.346,0.0,0.0,0.963);
  56.     CreateObject(1633,-2085.115,-189.998,35.346,0.0,0.0,0.963);
  57.     CreateObject(976,-2081.616,-138.935,34.591,0.859,-14.610,-85.944);
  58.     CreateObject(1633,-2080.971,-189.908,35.346,0.0,0.0,0.963);
  59.     CreateObject(976,-2079.258,-186.751,36.636,0.859,18.048,-86.803);
  60.     CreateObject(974,-2078.258,-183.654,38.498,0.0,0.0,72.193);
  61.     CreateObject(978,-2078.708,-199.041,35.161,0.0,0.0,-270.723);
  62.     CreateObject(978,-2094.329,-204.401,35.161,0.0,-0.859,-248.377);
  63.     CreateObject(978,-2090.660,-209.721,35.161,0.0,-0.859,-219.156);
  64.     CreateObject(978,-2083.501,-213.047,35.161,0.0,-0.859,-190.795);
  65.     CreateObject(978,-2075.700,-200.305,35.161,0.0,-0.859,-133.212);
  66.     CreateObject(978,-2075.575,-213.037,35.161,0.0,-0.859,-162.433);
  67.     CreateObject(978,-2070.021,-209.227,34.936,0.0,-0.859,-134.931);
  68.     CreateObject(978,-2070.137,-196.629,35.161,0.0,-0.859,-162.433);
  69.     CreateObject(978,-2069.391,-210.065,35.161,0.0,-0.859,-305.099);
  70.     CreateObject(978,-2063.047,-196.639,35.161,0.0,0.0,-205.405);
  71.     CreateObject(978,-2057.245,-202.088,35.161,0.0,0.0,-242.361);
  72.     CreateObject(978,-2055.740,-209.088,35.168,0.0,0.0,-281.035);
  73.     CreateObject(978,-2058.790,-216.935,35.161,0.0,0.0,-302.521);
  74.     CreateObject(978,-2064.429,-224.267,35.161,0.0,0.0,-312.834);
  75.     CreateObject(978,-2074.453,-217.683,35.161,0.0,0.0,-302.521);
  76.     CreateObject(974,-2071.483,-227.855,36.198,54.144,-91.100,-37.033);
  77.     CreateObject(974,-2075.830,-224.491,36.123,54.144,-91.100,-37.033);
  78.     CreateObject(974,-2075.138,-232.627,38.198,89.381,-90.241,-36.956);
  79.     CreateObject(974,-2079.523,-229.220,38.148,89.381,-90.241,-36.956);
  80.     CreateObject(974,-2078.819,-237.338,36.248,54.144,-91.100,143.449);
  81.     CreateObject(974,-2083.174,-233.980,36.254,54.144,-91.100,143.449);
  82.     CreateObject(978,-2077.376,-222.183,36.548,0.0,36.096,-307.678);
  83.     CreateObject(978,-2081.980,-228.215,39.007,0.0,0.0,-306.818);
  84.     CreateObject(978,-2085.435,-232.835,37.014,0.0,-31.799,-307.678);
  85.     CreateObject(978,-2069.711,-229.794,37.326,0.0,34.377,-314.553);
  86.     CreateObject(978,-2073.465,-234.348,39.045,0.0,0.0,-306.818);
  87.     CreateObject(978,-2077.399,-239.084,36.803,0.0,-31.799,-307.678);
  88.     CreateObject(978,-2077.417,-245.815,35.061,0.0,0.0,-234.626);
  89.     CreateObject(978,-2088.527,-240.406,35.161,0.0,0.0,-276.738);
  90.     CreateObject(978,-2087.927,-248.156,35.161,0.0,0.0,-255.253);
  91.     CreateObject(978,-2085.056,-254.106,35.161,0.0,0.0,-233.767);
  92.     CreateObject(978,-2080.540,-258.663,35.161,0.0,0.0,-214.859);
  93.     CreateObject(978,-2073.681,-260.496,35.161,0.0,0.0,-173.606);
  94.     CreateObject(978,-2067.781,-257.781,35.161,0.0,0.0,-131.493);
  95.     CreateObject(978,-2065.214,-252.724,35.161,0.0,0.0,-100.553);
  96.     CreateObject(978,-2075.187,-245.057,35.161,0.0,0.0,-263.847);
  97.     CreateObject(978,-2063.605,-243.862,35.161,0.0,0.0,-100.553);
  98.     CreateObject(978,-2064.527,-236.635,35.168,0.0,0.0,-57.582);
  99.     CreateObject(978,-2070.123,-230.282,35.168,0.0,0.0,-40.393);
  100.     CreateObject(978,-2079.047,-237.517,35.161,0.0,0.0,-220.875);
  101.     CreateObject(978,-2074.497,-226.263,35.161,0.0,0.0,-29.220);
  102.     CreateObject(978,-2084.471,-232.096,35.036,0.0,0.0,-52.425);
  103.     CreateObject(978,-2077.972,-219.371,35.161,0.0,0.0,-96.256);
  104.     CreateObject(974,-2083.966,-217.729,35.998,60.161,-91.100,-197.748);
  105.     CreateObject(978,-2086.853,-224.002,35.161,0.0,0.0,-94.537);
  106.     CreateObject(974,-2081.916,-211.891,37.608,89.381,-90.241,-18.908);
  107.     CreateObject(974,-2077.565,-213.293,37.536,89.381,-90.241,-18.908);
  108.     CreateObject(974,-2079.742,-205.665,37.526,89.381,-90.241,-18.908);
  109.     CreateObject(974,-2075.475,-207.089,37.516,89.381,-90.241,-18.908);
  110.     CreateObject(974,-2077.552,-199.349,37.433,89.381,-90.241,-18.908);
  111.     CreateObject(974,-2073.296,-200.790,37.445,89.381,-90.241,-18.908);
  112.     CreateObject(974,-2079.618,-219.202,35.923,60.161,-91.100,-197.748);
  113.     CreateObject(974,-2079.541,-149.013,38.238,0.0,0.0,118.602);
  114.     CreateObject(974,-2071.281,-194.956,35.776,60.161,-91.100,-18.126);
  115.     CreateObject(974,-2075.760,-193.382,35.748,60.161,-91.100,-18.126);
  116.     CreateObject(978,-2085.861,-217.109,36.611,0.0,28.361,-103.991);
  117.     CreateObject(978,-2083.554,-209.499,38.413,0.0,-0.859,-110.007);
  118.     CreateObject(978,-2080.524,-201.098,38.277,0.0,-0.859,-110.007);
  119.     CreateObject(978,-2077.457,-220.200,36.598,0.0,28.361,-106.569);
  120.     CreateObject(978,-2074.922,-212.141,38.362,0.0,-0.859,-108.288);
  121.     CreateObject(978,-2072.033,-203.492,38.286,0.0,-0.859,-108.288);
  122.     CreateObject(978,-2077.543,-193.228,36.411,0.0,28.361,69.615);
  123.     CreateObject(978,-2068.975,-195.363,36.194,0.0,28.361,69.615);
  124.     CreateObject(978,-2067.306,-187.367,35.011,0.0,-0.859,-96.256);
  125.     CreateObject(978,-2066.593,-178.843,35.161,0.0,-0.859,-93.678);
  126.     CreateObject(978,-2066.083,-170.518,35.161,0.0,-0.859,-93.678);
  127.     CreateObject(978,-2061.079,-166.170,35.161,0.0,-0.859,-184.779);
  128.     CreateObject(978,-2074.817,-157.992,35.161,0.0,-0.859,-132.353);
  129.     CreateObject(978,-2068.927,-153.638,35.161,0.0,-0.859,-154.698);
  130.     CreateObject(978,-2061.981,-151.532,35.161,0.0,-0.859,-171.887);
  131.     CreateObject(978,-2056.564,-171.326,35.161,0.0,-0.859,-270.722);
  132.     CreateObject(978,-2053.289,-152.010,35.161,0.0,-0.859,-194.233);
  133.     CreateObject(978,-2047.068,-156.528,35.161,0.0,-0.859,-233.767);
  134.     CreateObject(978,-2044.138,-163.394,35.161,0.0,-0.859,-261.269);
  135.     CreateObject(978,-2043.669,-172.607,35.161,0.0,-0.859,-272.441);
  136.     CreateObject(978,-2055.255,-180.122,35.161,0.0,-0.859,-251.815);
  137.     CreateObject(978,-2051.451,-185.816,35.161,0.0,-0.859,-216.578);
  138.     CreateObject(978,-2044.670,-188.072,35.161,0.0,-0.859,-181.341);
  139.     CreateObject(978,-2038.011,-186.221,35.161,0.0,-0.859,-147.823);
  140.     CreateObject(978,-2033.755,-179.347,35.161,0.0,-0.859,-92.818);
  141.     CreateObject(978,-2033.337,-170.025,35.161,0.0,-0.859,-92.818);
  142.     CreateObject(978,-2044.320,-156.188,35.161,0.0,-0.859,-92.818);
  143.     CreateObject(978,-2041.955,-148.744,35.161,0.0,-0.859,-126.337);
  144.     CreateObject(978,-2036.050,-144.768,35.161,0.0,-0.859,-164.152);
  145.     CreateObject(978,-2028.224,-145.293,35.161,0.0,-0.859,-201.968);
  146.     CreateObject(978,-2022.551,-150.093,35.161,0.0,-0.859,-238.064);
  147.     CreateObject(978,-2019.954,-158.725,35.168,0.0,-0.859,-269.003);
  148.     CreateObject(978,-2020.266,-168.259,35.161,0.0,-0.859,-274.160);
  149.     CreateObject(978,-2020.991,-177.684,35.161,0.0,-0.859,-274.160);
  150.     CreateObject(978,-2033.026,-164.382,35.161,0.0,-0.859,-92.818);
  151.     CreateObject(978,-2022.240,-186.791,35.079,0.0,0.0,-281.035);
  152.     CreateObject(978,-2025.286,-193.115,35.161,0.0,0.0,-308.537);
  153.     CreateObject(978,-2030.959,-197.241,35.161,0.0,0.0,-342.914);
  154.     CreateObject(978,-2037.759,-198.529,35.161,0.0,0.0,-355.806);
  155.     CreateObject(978,-2044.315,-189.215,34.993,0.0,0.859,-348.930);
  156.     CreateObject(978,-2050.774,-191.514,35.168,0.0,1.719,-322.288);
  157.     CreateObject(978,-2053.469,-197.689,35.168,0.0,1.719,-264.706);
  158.     CreateObject(978,-2050.594,-205.163,35.093,0.0,0.0,-235.486);
  159.     CreateObject(978,-2045.048,-208.315,35.161,0.0,-0.859,-181.341);
  160.     CreateObject(978,-2038.510,-208.516,35.161,0.0,0.859,-181.341);
  161.     CreateObject(978,-2037.673,-198.835,35.136,0.0,-0.859,-178.763);
  162.     CreateObject(978,-2028.630,-200.160,35.111,0.0,0.0,-192.514);
  163.     CreateObject(978,-2024.028,-202.867,35.161,0.0,-0.859,-232.907);
  164.     CreateObject(978,-2021.818,-209.497,35.161,0.0,0.0,82.506);
  165.     CreateObject(978,-2024.967,-215.065,35.161,0.0,0.0,35.237);
  166.     CreateObject(978,-2033.473,-217.882,35.161,0.0,0.0,0.0);
  167.     CreateObject(978,-2038.328,-217.878,35.161,0.0,0.0,0.0);
  168.     CreateObject(978,-2048.894,-209.544,35.161,0.0,0.0,13.751);
  169.     CreateObject(978,-2053.016,-213.126,35.161,0.0,0.0,59.301);
  170.     CreateObject(978,-2054.771,-220.285,35.168,0.0,0.0,87.662);
  171.     CreateObject(978,-2043.036,-222.447,35.168,0.0,0.0,87.662);
  172.     CreateObject(978,-2055.148,-229.586,35.161,0.0,0.0,87.662);
  173.     CreateObject(978,-2055.498,-238.775,35.168,0.0,0.0,87.662);
  174.     CreateObject(978,-2055.872,-247.992,35.168,0.0,0.0,87.662);
  175.     CreateObject(978,-2043.406,-231.673,35.161,0.0,0.0,87.662);
  176.     CreateObject(978,-2043.801,-240.982,35.161,0.0,0.0,87.662);
  177.     CreateObject(978,-2044.217,-250.297,35.161,0.0,0.0,87.662);
  178.     CreateObject(978,-2044.607,-259.602,35.161,0.0,0.0,87.662);
  179.     CreateObject(978,-2056.266,-257.148,35.168,0.0,0.0,87.662);
  180.     CreateObject(971,-2040.431,-264.217,37.790,0.0,0.0,0.0);
  181.     CreateObject(971,-2036.125,-268.626,37.815,0.0,0.0,-91.100);
  182.     CreateObject(971,-2056.632,-265.963,37.751,0.0,0.0,89.381);
  183.     CreateObject(971,-2056.790,-274.788,37.672,0.0,0.0,89.381);
  184.     CreateObject(971,-2036.140,-276.715,37.726,0.0,0.0,-91.100);
  185.     CreateObject(1262,-2046.423,-122.048,39.093,0.0,0.0,0.0);
  186.     CreateObject(1262,-2045.439,-122.036,39.091,0.0,0.0,0.0);
  187.     CreateObject(1262,-2044.523,-122.011,39.074,0.0,0.0,0.0);
  188.     return 1;
  189. }
  190.  
  191. public OnFilterScriptExit() {
  192.     for(new e=0; e<GetMaxPlayers(); e++) {
  193.         InGokart[e] = false;
  194.         EndGokart[e] = false;
  195.         DisablePlayerRaceCheckpoint(e);
  196.     }
  197.    
  198. }
  199.  
  200. public OnPlayerCommandText(playerid, cmdtext[]) {
  201.     new idx, cmd[256];
  202.     cmd = strtok(cmdtext, idx);
  203.    
  204.     if(!strcmp(cmd, "/gokart", true)) {
  205.         if(InGokart[playerid]) {
  206.             SendClientMessage(playerid, 0xFF0000AA, "You are already in the Gokart Track.");
  207.             return 1;
  208.         }
  209.         GetPlayerPos(playerid, PlayerInf[playerid][X], PlayerInf[playerid][Y], PlayerInf[playerid][Z]);
  210.         for(new i=0; i<7; i++) {
  211.             GetPlayerWeaponData(playerid, i, PlayerInf[playerid][Weapons][i], PlayerInf[playerid][Ammos][i]);
  212.         }
  213.         ResetPlayerWeapons(playerid);
  214.         SetPlayerPos(playerid, -2078.9170,-107.5986,35.3203);
  215.         SetPlayerFacingAngle(playerid, 271.5153);
  216.         InGokart[playerid] = true;
  217.         SendClientMessage(playerid, 0xFFFF00AA, "Welcome to Gokart Track!");
  218.         SetPlayerRaceCheckpoint(playerid, 2, -2050.4336, -273.2747, 35.3203, 0, 0, 0, 10);
  219.         return 1;
  220.     }
  221.    
  222.     if(!strcmp(cmd, "/exitkart", true)) {
  223.         if(!InGokart[playerid]) {
  224.             SendClientMessage(playerid, 0xFF0000AA, "You aren't in the Gokart Track.");
  225.             return 1;
  226.         }
  227.         SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  228.         SetPlayerPos(playerid, PlayerInf[playerid][X], PlayerInf[playerid][Y], PlayerInf[playerid][Z]);
  229.         for(new i=0; i<7; i++) {
  230.             GivePlayerWeapon(playerid, PlayerInf[playerid][Weapons][i], PlayerInf[playerid][Ammos][i]);
  231.         }
  232.         DisablePlayerRaceCheckpoint(playerid);
  233.         SendClientMessage(playerid, 0x11FF00AA, "Bye, bye!");
  234.         InGokart[playerid] = false;
  235.         EndGokart[playerid] = false;
  236.         return 1;
  237.     }
  238.     return 0;
  239. }
  240.  
  241. public OnPlayerEnterRaceCheckpoint(playerid) {
  242.     if(InGokart[playerid]) {
  243.         if (!EndGokart[playerid]) {
  244.             GivePlayerMoney(playerid, 5000);
  245.             EndGokart[playerid] = true;
  246.             SendClientMessage(playerid, 0xFFFF00AA, "The end of the gokart track! Congratulation! Type /exitkart to go back to game, /again to repeat it.");
  247.             DisablePlayerRaceCheckpoint(playerid);
  248.         }
  249.     }
  250. }
  251.  
  252. public OnPlayerDeath(playerid) {
  253.     if(InGokart[playerid]) {
  254.         InGokart[playerid] = false;
  255.         EndGokart[playerid] = false;
  256.         PlayerInf[playerid][X] = 0;
  257.         PlayerInf[playerid][Y] = 0;
  258.         PlayerInf[playerid][Z] = 0;
  259.         for(new i=0; i<7; i++) {
  260.             PlayerInf[playerid][Weapons][i] = 0;
  261.             PlayerInf[playerid][Ammos][i] = 0;
  262.         }
  263.         if (IsPlayerInAnyVehicle(playerid)) {
  264.             SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  265.         }
  266.     }
  267.     return 1;
  268. }
  269.  
  270. //-------------------------------------------------
  271.  
  272. strtok(const string[], &index)
  273. {
  274.     new length = strlen(string);
  275.     while ((index < length) && (string[index] <= ' '))
  276.     {
  277.         index++;
  278.     }
  279.  
  280.     new offset = index;
  281.     new result[20];
  282.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  283.     {
  284.         result[index - offset] = string[index];
  285.         index++;
  286.     }
  287.     result[index - offset] = EOS;
  288.     return result;
  289. }
  290. //-------------------------------------------------
  291.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement