Advertisement
Guest User

jameskmonger

a guest
Feb 22nd, 2011
1,691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.94 KB | None | 0 0
  1. //      ## ##     ##  #######  ##     ##  ######  ########
  2. //      ## ##     ## ##     ## ##     ## ##    ## ##
  3. //      ## ##     ## ##     ## ##     ## ##       ##
  4. //      ## ######### ##     ## ##     ##  ######  ######
  5. //##    ## ##     ## ##     ## ##     ##       ## ##
  6. //##    ## ##     ## ##     ## ##     ## ##    ## ##
  7. // ######  ##     ##  #######   #######   ######  ########
  8.  
  9. // by Jameskmonger
  10.  
  11.  
  12.  
  13. // Execute this query: CREATE DATABASE jHouse
  14. // Execute this query too: CREATE TABLE  IF NOT EXISTS `houses` ( `ID` INT(3) NOT NULL, `owner` VARCHAR( 24 ) NOT NULL , `price` INT( 8 ) NOT NULL ,`exteriorX` FLOAT( 11 ) NOT NULL ,`exteriorY` FLOAT( 11 ) NOT NULL ,`exteriorZ` FLOAT( 11 ) NOT NULL ,`interiorX` FLOAT( 11 ) NOT NULL ,`interiorY` FLOAT( 11 ) NOT NULL ,`interiorZ` FLOAT( 11 ) NOT NULL ,`interiorInt` FLOAT( 11 ) NOT NULL ,`locked` INT( 1 ) NOT NULL) ENGINE = INNODB;
  15.  
  16. #include <a_samp>
  17. #include <a_mysql>
  18. #include <zcmd>
  19.  
  20. #define FILTERSCRIPT
  21.  
  22. #define MYSQL_HOST  "localhost"
  23. #define MYSQL_USER  "root"
  24. #define MYSQL_DB "jHouse"
  25. #define MYSQL_PASS  ""
  26.  
  27. #define MAX_HOUSES 20 //Set this no higher than 999.
  28.  
  29. #define HD HouseData
  30. #define HC HouseCreating
  31.  
  32. #define WHITE 0xFFFFFFFF
  33.  
  34. enum jHouseInfo {
  35.     ID,
  36.     owner[24],
  37.     price,
  38.     Float:exteriorX,
  39.     Float:exteriorY,
  40.     Float:exteriorZ,
  41.     Float:interiorX,
  42.     Float:interiorY,
  43.     Float:interiorZ,
  44.     interiorInt,
  45.     locked
  46. }
  47. new HouseData[MAX_HOUSES][jHouseInfo];
  48. new InsideHouse[MAX_PLAYERS];
  49.  
  50. enum creatingHouse {
  51.     Float:exteriorX,
  52.     Float:exteriorY,
  53.     Float:exteriorZ,
  54.     Float:interiorX,
  55.     Float:interiorY,
  56.     Float:interiorZ,
  57.     interiorInt
  58. }
  59. new HouseCreating[MAX_PLAYERS][creatingHouse];
  60.  
  61. forward ConnectMySQL();
  62. forward BuildHouse(hprice, Float:hexteriorX, Float:hexteriorY, Float:hexteriorZ, Float:hinteriorX, Float:hinteriorY, Float:hinteriorZ, hinteriorInt, hlocked);
  63.  
  64. public OnFilterScriptInit()
  65. {
  66.     ConnectMySQL();
  67.     print("\n\n");
  68.     print("      ## ##     ##  #######  ##     ##  ######  ######## ");
  69.     print("      ## ##     ## ##     ## ##     ## ##    ## ##       ");
  70.     print("      ## ##     ## ##     ## ##     ## ##       ##       ");
  71.     print("      ## ######### ##     ## ##     ##  ######  ######   ");
  72.     print("##    ## ##     ## ##     ## ##     ##       ## ##       ");
  73.     print("##    ## ##     ## ##     ## ##     ## ##    ## ##       ");
  74.     print(" ######  ##     ##  #######   #######   ######  ######## ");
  75.     print("\n\n");
  76.     LoadHouses();
  77.     return 1;
  78. }
  79.  
  80. CheckMySQL()
  81. {
  82.     if(mysql_ping() == -1)
  83.         mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
  84. }
  85.  
  86. public OnFilterScriptExit()
  87. {
  88.     return 1;
  89. }
  90.  
  91. command(lockhouse, playerid, params[])
  92. {
  93.     #pragma unused params
  94.     for(new h; h < MAX_HOUSES; h++) {
  95.         if(IsPlayerInRangeOfPoint(playerid, 3.5, HD[h][exteriorX], HD[h][exteriorY], HD[h][exteriorZ])) {
  96.             if(strcmp(HD[h][owner], ReturnName(playerid), true) == 0) {
  97.                 if(HD[h][locked] == 0) {
  98.                     GameTextForPlayer(playerid, "House ~r~locked", 3000, 5);
  99.                     HD[h][locked] = 1;
  100.                 } else {
  101.                     GameTextForPlayer(playerid, "House ~g~unlocked", 3000, 5);
  102.                     HD[h][locked] = 0;
  103.                 }
  104.             }
  105.         }
  106.         if(IsPlayerInRangeOfPoint(playerid, 3.5, HD[h][interiorX], HD[h][interiorY], HD[h][interiorZ]) && GetPlayerInterior(playerid) == HD[h][interiorInt]) {
  107.             if(strcmp(HD[h][owner], ReturnName(playerid), true) == 0) {
  108.                 if(HD[h][locked] == 0) {
  109.                     GameTextForPlayer(playerid, "House ~r~locked", 3000, 5);
  110.                     HD[h][locked] = 1;
  111.                 } else {
  112.                     GameTextForPlayer(playerid, "House ~g~unlocked", 3000, 5);
  113.                     HD[h][locked] = 0;
  114.                 }
  115.             }
  116.         }
  117.     }
  118.     return 1;
  119. }
  120.  
  121. command(setprice, playerid, params[])
  122. {
  123.     new HID, HP, string[128];
  124.     if(IsPlayerAdmin(playerid)) {
  125.         if(sscanf(params, "dd", HID, HP)) {
  126.             SendClientMessage(playerid, WHITE, "SYNTAX: /setprice [HOUSE ID] [HOUSE PRICE]");
  127.         } else {
  128.             HD[HID][price] = HP;
  129.             format(string, sizeof(string), "You set house %d's price to $%d.", HID, HP);
  130.             SendClientMessage(playerid, WHITE, string);
  131.         }
  132.     }
  133.     return 1;
  134. }
  135.  
  136. command(buyhouse, playerid, params[])
  137. {
  138.     #pragma unused params
  139.     for(new h; h < MAX_HOUSES; h++) {
  140.         if(IsPlayerInRangeOfPoint(playerid, 3.5, HD[h][exteriorX], HD[h][exteriorY], HD[h][exteriorZ])) {
  141.             if(HD[h][price] > -1) {
  142.                 if(GetPlayerMoney(playerid) >= HD[h][price]) {
  143.                     format(HD[h][owner], 24, ReturnName(playerid));
  144.                     SendClientMessage(playerid, WHITE, "You have successfully bought the house!");
  145.                 }
  146.             } else {
  147.                 GameTextForPlayer(playerid, "House ~r~unavailable", 3000, 5);
  148.             }
  149.         }
  150.     }
  151.     return 1;
  152. }
  153.  
  154. command(exithouse, playerid, params[])
  155. {
  156.     #pragma unused params
  157.     for(new h; h < MAX_HOUSES; h++) {
  158.         if(IsPlayerInRangeOfPoint(playerid, 3.5, HD[InsideHouse[playerid]][interiorX], HD[InsideHouse[playerid]][interiorY], HD[InsideHouse[playerid]][interiorZ])) {
  159.             if(HD[h][locked] == 0) {
  160.                 SetPlayerVirtualWorld(playerid, 0);
  161.                 SetPlayerInterior(playerid, 0);
  162.                 SetPlayerPos(playerid, HD[InsideHouse[playerid]][exteriorX], HD[InsideHouse[playerid]][exteriorY], HD[InsideHouse[playerid]][exteriorZ]);
  163.             } else {
  164.                 GameTextForPlayer(playerid, "House ~r~locked", 3000, 5);
  165.             }
  166.         }
  167.     }
  168.     return 1;
  169. }
  170.  
  171. command(enterhouse, playerid, params[])
  172. {
  173.     #pragma unused params
  174.     for(new h; h < MAX_HOUSES; h++) {
  175.         if(IsPlayerInRangeOfPoint(playerid, 3.5, HD[h][exteriorX], HD[h][exteriorY], HD[h][exteriorZ])) {
  176.             if(HD[h][locked] == 0) {
  177.                 SetPlayerVirtualWorld(playerid, h);
  178.                 InsideHouse[playerid] = h;
  179.                 SetPlayerInterior(playerid, HD[h][interiorInt]);
  180.                 SetPlayerPos(playerid, HD[h][interiorX], HD[h][interiorY], HD[h][interiorZ]);
  181.             } else {
  182.                 GameTextForPlayer(playerid, "House ~r~locked", 3000, 5);
  183.             }
  184.         }
  185.     }
  186.     return 1;
  187. }
  188.  
  189. public OnPlayerPickUpPickup(playerid, pickupid)
  190. {
  191.     new string[128];
  192.     for(new h; h < MAX_HOUSES; h++) {
  193.         if(IsPlayerInRangeOfPoint(playerid, 3.5, HD[h][exteriorX], HD[h][exteriorY], HD[h][exteriorZ])) {
  194.             if(IsPlayerAdmin(playerid)) {
  195.                 format(string, sizeof(string), "House ID: %d", HD[h][ID]);
  196.                 SendClientMessage(playerid, WHITE, string);
  197.             }
  198.             if(strcmp(HD[h][owner], "", true) == 0) {
  199.                 format(string, sizeof(string), "Unowned House\n~R~/buyhouse~w~ to buy for %d", HD[h][price]);
  200.                 GameTextForPlayer(playerid, string, 5000, 5);
  201.             } else {
  202.                 if(HD[h][locked] == 1) format(string, sizeof(string), "%'s House\n~r~Locked", HD[h][price]);
  203.                 else format(string, sizeof(string), "%'s House\n~g~Unlocked", HD[h][price]);
  204.                 GameTextForPlayer(playerid, string, 5000, 5);
  205.             }
  206.         }
  207.     }
  208.     return 1;
  209. }
  210.  
  211. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  212. {
  213.     return 1;
  214. }
  215.  
  216. public ConnectMySQL()
  217. {
  218.     if(mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS)) {
  219.         print("[MySQL] Connected to the MySQL Database successfully!");
  220.     } else {
  221.         print("[MySQL] Could not connect to the MySQL Database!");
  222.     }
  223. }
  224.  
  225. explode(const sSource[], aExplode[][], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[]) // Created by Westie
  226. {
  227.     new
  228.         iNode,
  229.         iPointer,
  230.         iPrevious = -1,
  231.         iDelimiter = strlen(sDelimiter);
  232.  
  233.     while(iNode < iVertices)
  234.     {
  235.         iPointer = strfind(sSource, sDelimiter, false, iPointer);
  236.  
  237.         if(iPointer == -1)
  238.         {
  239.             strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
  240.             break;
  241.         }
  242.         else
  243.         {
  244.             strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
  245.         }
  246.  
  247.         iPrevious = (iPointer += iDelimiter);
  248.         ++iNode;
  249.     }
  250.     return iPrevious;
  251. }
  252.  
  253. LoadHouses()
  254. {
  255.     new
  256.         extx[11],
  257.         exty[11],
  258.         extz[11],
  259.         intx[11],
  260.         inty[11],
  261.         intz[11];
  262.     print("House loading started...");
  263.     mysql_query("SELECT NULL FROM houses");
  264.     mysql_store_result();
  265.     new rows = mysql_num_rows();
  266.     mysql_free_result();
  267.    
  268.     CheckMySQL();
  269.    
  270.     for(new i; i < rows; i++) {
  271.         new string[128];
  272.         format(string, sizeof(string), "SELECT * FROM houses WHERE ID = '%d'", i);
  273.         mysql_query(string);
  274.         mysql_store_result();
  275.  
  276.         //if(!mysql_num_rows())
  277.         //  return SendClientMessage(playerid, COLOR_RED, "[ACCOUNT] Incorrect password!");
  278.         new row[128]; // The length of 1 'row' total.
  279.         new field[11][24];
  280.         mysql_fetch_row_format(row, "|");
  281.         explode(row, field, "|");
  282.         mysql_free_result();
  283.         mysql_fetch_field_row(HD[i][ID], "ID");
  284.         mysql_fetch_field_row(HD[i][owner], "owner");
  285.         mysql_fetch_field_row(HD[i][price], "price");
  286.         mysql_fetch_field_row(extx, "exteriorX");
  287.         mysql_fetch_field_row(exty, "exteriorY");
  288.         mysql_fetch_field_row(extz, "exteriorZ");
  289.         mysql_fetch_field_row(intx, "interiorX");
  290.         mysql_fetch_field_row(inty, "interiorY");
  291.         mysql_fetch_field_row(intz, "interiorZ");
  292.         HD[i][exteriorX] = floatstr(extx);
  293.         HD[i][exteriorY] = floatstr(exty);
  294.         HD[i][exteriorZ] = floatstr(extz);
  295.         HD[i][interiorX] = floatstr(intx);
  296.         HD[i][interiorY] = floatstr(inty);
  297.         HD[i][interiorZ] = floatstr(intz);
  298.         mysql_fetch_field_row(HD[i][interiorInt], "interiorInt");
  299.         mysql_fetch_field_row(HD[i][locked], "locked");
  300.         if(strlen(HD[i][owner]) > 0) CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
  301.         else CreatePickup(1272, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
  302.         printf("House %d created", i);
  303.     }
  304.     print("House loading finished.");
  305. }
  306.  
  307. public BuildHouse(hprice, Float:hexteriorX, Float:hexteriorY, Float:hexteriorZ, Float:hinteriorX, Float:hinteriorY, Float:hinteriorZ, hinteriorInt, hlocked) {
  308.     mysql_query("SELECT NULL FROM houses");
  309.     mysql_store_result();
  310.     new rows = mysql_num_rows();
  311.     mysql_free_result();
  312.     new houseID = rows++;
  313.     if(houseID < MAX_HOUSES) {
  314.         CheckMySQL();
  315.         new string[128];
  316.         format(string, sizeof(string), "INSERT INTO houses (ID, owner, price, exteriorX, exteriorY, exteriorZ, interiorX, interiorY, interiorZ, interiorInt, locked) VALUES");
  317.         format(string, sizeof(string), "%s VALUES ('%d', '', %d, %f, %f, %f, %f, %f, %f, %d, '1')", string, houseID, hprice, hexteriorX, hexteriorY, hexteriorZ, hinteriorX, hinteriorY, hinteriorZ, hinteriorInt);
  318.         mysql_query(string);
  319.         CreatePickup(1273, 1, hexteriorX, hexteriorY, hexteriorZ, -1);
  320.         printf("House %d created", houseID);
  321.         HD[houseID][ID] = houseID;
  322.         HD[houseID][price] = hprice;
  323.         HD[houseID][exteriorX] = hexteriorX;
  324.         HD[houseID][exteriorY] = hexteriorY;
  325.         HD[houseID][exteriorZ] = hexteriorZ;
  326.         HD[houseID][interiorX] = hinteriorX;
  327.         HD[houseID][interiorY] = hinteriorY;
  328.         HD[houseID][interiorZ] = hinteriorZ;
  329.         HD[houseID][interiorInt] = hinteriorInt;
  330.         HD[houseID][locked] = hlocked;
  331.         format(HD[houseID][owner], 24, "");
  332.     } else {
  333.         print("Too many houses!");
  334.     }
  335. }
  336.  
  337. command(createhouse, playerid, params[])
  338. {
  339.     new type[128];
  340.     if(IsPlayerAdmin(playerid)) {
  341.         if(sscanf(params, "s", type))
  342.         {
  343.             SendClientMessage(playerid, WHITE, "SYNTAX: /createhouse option - options: Help|Interior|Exterior|Finish");
  344.         } else {
  345.             if(strcmp(type, "help", true) == 0) {
  346.                 SendClientMessage(playerid, WHITE, "jHouse by Jameskmonger - Help!");
  347.                 SendClientMessage(playerid, WHITE, "Go to the spot you want the entrance to be and type /createhouse Exterior");
  348.                 SendClientMessage(playerid, WHITE, "Then go to the interior you want them to be teleported to, in the exit position, and do /createhouse Interior");
  349.                 SendClientMessage(playerid, WHITE, "Then do /createhouse Finish. The house will be unavailable to buy at first, but do /sethouseprice [price]");
  350.                 SendClientMessage(playerid, WHITE, "To make it available.");
  351.             }
  352.             if(strcmp("exterior", type, true) == 0) {
  353.                 GetPlayerPos(playerid, HC[playerid][exteriorX], HC[playerid][exteriorY],HC[playerid][exteriorZ]);
  354.             }
  355.             if(strcmp("interior", type, true) == 0) {
  356.                 GetPlayerPos(playerid, HC[playerid][interiorX], HC[playerid][interiorY],HC[playerid][interiorZ]);
  357.                 HC[playerid][interiorInt] = GetPlayerInterior(playerid);
  358.             }
  359.             if(strcmp("finish", type, true) == 0) {
  360.                 BuildHouse(-1, HC[playerid][exteriorX], HC[playerid][exteriorY],HC[playerid][exteriorZ], HC[playerid][interiorX], HC[playerid][interiorY],HC[playerid][interiorZ], HC[playerid][interiorInt], 1);
  361.                 SendClientMessage(playerid, WHITE, "House created!");
  362.             }
  363.         }
  364.     } else {
  365.         SendClientMessage(playerid, WHITE, "You are not authorised to use that command.");
  366.         return 1;
  367.     }
  368.     return 1;
  369. }
  370.  
  371. stock sscanf(string[], format[], {Float,_}:...)
  372. {
  373.     #if defined isnull
  374.         if (isnull(string))
  375.     #else
  376.         if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  377.     #endif
  378.         {
  379.             return format[0];
  380.         }
  381.     #pragma tabsize 4
  382.     new
  383.         formatPos = 0,
  384.         stringPos = 0,
  385.         paramPos = 2,
  386.         paramCount = numargs(),
  387.         delim = ' ';
  388.     while (string[stringPos] && string[stringPos] <= ' ')
  389.     {
  390.         stringPos++;
  391.     }
  392.     while (paramPos < paramCount && string[stringPos])
  393.     {
  394.         switch (format[formatPos++])
  395.         {
  396.             case '\0':
  397.             {
  398.                 return 0;
  399.             }
  400.             case 'i', 'd':
  401.             {
  402.                 new
  403.                     neg = 1,
  404.                     num = 0,
  405.                     ch = string[stringPos];
  406.                 if (ch == '-')
  407.                 {
  408.                     neg = -1;
  409.                     ch = string[++stringPos];
  410.                 }
  411.                 do
  412.                 {
  413.                     stringPos++;
  414.                     if ('0' <= ch <= '9')
  415.                     {
  416.                         num = (num * 10) + (ch - '0');
  417.                     }
  418.                     else
  419.                     {
  420.                         return -1;
  421.                     }
  422.                 }
  423.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  424.                 setarg(paramPos, 0, num * neg);
  425.             }
  426.             case 'h', 'x':
  427.             {
  428.                 new
  429.                     num = 0,
  430.                     ch = string[stringPos];
  431.                 do
  432.                 {
  433.                     stringPos++;
  434.                     switch (ch)
  435.                     {
  436.                         case 'x', 'X':
  437.                         {
  438.                             num = 0;
  439.                             continue;
  440.                         }
  441.                         case '0' .. '9':
  442.                         {
  443.                             num = (num << 4) | (ch - '0');
  444.                         }
  445.                         case 'a' .. 'f':
  446.                         {
  447.                             num = (num << 4) | (ch - ('a' - 10));
  448.                         }
  449.                         case 'A' .. 'F':
  450.                         {
  451.                             num = (num << 4) | (ch - ('A' - 10));
  452.                         }
  453.                         default:
  454.                         {
  455.                             return -1;
  456.                         }
  457.                     }
  458.                 }
  459.                 while ((ch = string[stringPos]) > ' ' && ch != delim);
  460.                 setarg(paramPos, 0, num);
  461.             }
  462.             case 'c':
  463.             {
  464.                 setarg(paramPos, 0, string[stringPos++]);
  465.             }
  466.             case 'f':
  467.             {
  468.                 setarg(paramPos, 0, _:floatstr(string[stringPos]));
  469.             }
  470.             case 'p':
  471.             {
  472.                 delim = format[formatPos++];
  473.                 continue;
  474.             }
  475.             case '\'':
  476.             {
  477.                 new
  478.                     end = formatPos - 1,
  479.                     ch;
  480.                 while ((ch = format[++end]) && ch != '\'') {}
  481.                 if (!ch)
  482.                 {
  483.                     return -1;
  484.                 }
  485.                 format[end] = '\0';
  486.                 if ((ch = strfind(string, format[formatPos], false, stringPos))  == -1)
  487.                 {
  488.                     if (format[end + 1])
  489.                     {
  490.                         return -1;
  491.                     }
  492.                     return 0;
  493.                 }
  494.                 format[end] = '\'';
  495.                 stringPos = ch + (end - formatPos);
  496.                 formatPos = end + 1;
  497.             }
  498.             case 'u':
  499.             {
  500.                 new
  501.                     end = stringPos - 1,
  502.                     id = 0,
  503.                     bool:num = true,
  504.                     ch;
  505.                 while ((ch = string[++end]) && ch != delim)
  506.                 {
  507.                     if (num)
  508.                     {
  509.                         if ('0' <= ch <= '9')
  510.                         {
  511.                             id = (id * 10) + (ch - '0');
  512.                         }
  513.                         else
  514.                         {
  515.                             num = false;
  516.                         }
  517.                     }
  518.                 }
  519.                 if (num && IsPlayerConnected(id))
  520.                 {
  521.                     setarg(paramPos, 0, id);
  522.                 }
  523.                 else
  524.                 {
  525.                     #if !defined foreach
  526.                         #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  527.                         #define __SSCANF_FOREACH__
  528.                     #endif
  529.                     string[end] = '\0';
  530.                     num = false;
  531.                     new
  532.                         name[MAX_PLAYER_NAME];
  533.                     id = end - stringPos;
  534.                     foreach(Player, playerid)
  535.                     {
  536.                         GetPlayerName(playerid, name, sizeof (name));
  537.                         if (!strcmp(name, string[stringPos], true, id))
  538.                         {
  539.                             setarg(paramPos, 0, playerid);
  540.                             num = true;
  541.                             break;
  542.                         }
  543.                     }
  544.                     if (!num)
  545.                     {
  546.                         setarg(paramPos, 0, INVALID_PLAYER_ID);
  547.                     }
  548.                     string[end] = ch;
  549.                     #if defined __SSCANF_FOREACH__
  550.                         #undef foreach
  551.                         #undef __SSCANF_FOREACH__
  552.                     #endif
  553.                 }
  554.                 stringPos = end;
  555.             }
  556.             case 's', 'z':
  557.             {
  558.                 new
  559.                     i = 0,
  560.                     ch;
  561.                 if (format[formatPos])
  562.                 {
  563.                     while ((ch = string[stringPos++]) && ch != delim)
  564.                     {
  565.                         setarg(paramPos, i++, ch);
  566.                     }
  567.                     if (!i)
  568.                     {
  569.                         return -1;
  570.                     }
  571.                 }
  572.                 else
  573.                 {
  574.                     while ((ch = string[stringPos++]))
  575.                     {
  576.                         setarg(paramPos, i++, ch);
  577.                     }
  578.                 }
  579.                 stringPos--;
  580.                 setarg(paramPos, i, '\0');
  581.             }
  582.             default:
  583.             {
  584.                 continue;
  585.             }
  586.         }
  587.         while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  588.         {
  589.             stringPos++;
  590.         }
  591.         while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  592.         {
  593.             stringPos++;
  594.         }
  595.         paramPos++;
  596.     }
  597.     do
  598.     {
  599.         if ((delim = format[formatPos++]) > ' ')
  600.         {
  601.             if (delim == '\'')
  602.             {
  603.                 while ((delim = format[formatPos++]) && delim != '\'') {}
  604.             }
  605.             else if (delim != 'z')
  606.             {
  607.                 return delim;
  608.             }
  609.         }
  610.     }
  611.     while (delim > ' ');
  612.     return 0;
  613. }
  614.  
  615. stock ReturnName(playerid) {
  616.     new name[24];
  617.     GetPlayerName(playerid, name, 24);
  618.     return name;
  619. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement