Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <streamer>
- #include <ocmd>
- //DEFINES
- #define SPAWN 1568.4768,-1690.7144,5.8906 //Hier die Koordinaten eingeben, wo der Spieler spawnen soll. (DERZEIT: LSPD)
- //FARBEN
- #define Blau 0x0019FFFF
- #define Grau 0xB4B4B4FF
- new Text:TDEditor_TD[1];
- main()
- {
- print("\n----------------------------------");
- print(" Blank-Script by Impressiv_");
- print("----------------------------------\n");
- }
- stock LoadAllNormalObjects()
- {
- //Alle CreateObj
- }
- stock LoadAllDynamicObjects()
- {
- //Ganghaus
- CreateDynamicObject(2847, 946.97522, -47.89420, 1000.50348, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(2847, 947.05072, -48.73700, 1000.49951, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1516, 943.64996, -41.08196, 1000.11383, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1516, 944.78998, -41.11319, 1000.11383, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1516, 945.95013, -41.12462, 1000.11383, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1516, 947.09094, -41.08952, 1000.11383, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(356, 943.44043, -40.63888, 1000.74298, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(348, 944.53027, -40.65422, 1000.77087, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(353, 945.66034, -40.66950, 1000.74432, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(358, 946.90784, -40.72879, 1000.85181, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 943.66058, -41.37770, 1000.62500, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19893, 944.78510, -41.29601, 1000.63928, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19893, 945.88507, -41.32236, 1000.63928, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 947.09052, -41.35910, 1000.63409, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1550, 943.61310, -61.54331, 1000.96820, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1550, 943.58820, -61.16838, 1000.96820, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1550, 943.50885, -60.77787, 1000.96820, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1550, 943.94440, -60.69658, 1000.96820, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1550, 943.94415, -61.10840, 1000.96820, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1550, 943.92419, -61.48524, 1000.96820, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 955.19379, -58.90397, 1000.42291, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 953.87238, -58.89467, 1000.42291, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 952.55090, -58.88537, 1000.42291, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 951.23083, -58.89224, 1000.42291, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 949.91095, -58.89911, 1001.44305, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 949.91095, -58.89911, 1000.42291, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 951.21613, -58.87814, 1001.44305, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 952.53839, -58.89857, 1001.44305, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 953.86206, -58.89642, 1001.44305, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1771, 955.16583, -58.89277, 1001.44305, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(2573, 955.35474, -53.02866, 1000.10052, 356.85840, 0.00000, -1.57080);
- CreateDynamicObject(1829, 949.58264, -42.71042, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(1829, 950.41351, -42.71128, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(1829, 951.23297, -42.71462, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(1829, 952.03522, -42.71156, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(1829, 952.85602, -42.70201, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(1829, 953.67517, -42.69471, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(1829, 954.49689, -42.67956, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(1829, 955.31824, -42.70424, 1000.55859, 0.00000, 0.00000, 359.59393);
- CreateDynamicObject(3111, 952.12518, -42.06370, 1001.72498, 90.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 961.13165, -57.47996, 1000.93146, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 960.44421, -57.47557, 1000.93146, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1508, 964.98975, -54.81554, 1001.84961, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 947.36761, -47.24274, 1000.51404, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 947.38116, -47.62302, 1000.51404, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 952.59882, -41.91056, 1000.51404, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 947.39417, -48.04330, 1000.51404, 0.00000, 0.00000, 0.00000);
- //Advent
- CreateDynamicObject(19076, 223.28917, -1824.40308, 2.57629, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19076, 221.86356, -1851.64282, 2.57629, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19076, 257.42389, -1849.54431, 2.57629, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 227.41986, -1826.96021, 3.57884, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 227.43547, -1825.02747, 3.57884, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 227.35078, -1823.08057, 3.57884, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 221.01001, -1822.40576, 3.57884, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 220.97661, -1824.22534, 3.57884, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 221.17661, -1826.40747, 3.57884, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 221.76637, -1848.64709, 2.90582, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 221.74638, -1850.05835, 2.90582, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 221.69194, -1851.47864, 2.90582, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 226.39082, -1851.70483, 2.90582, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 226.54633, -1849.67847, 2.90582, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 226.60495, -1847.87573, 2.90582, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 260.09338, -1850.08716, 2.80730, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 260.08215, -1848.61597, 2.80730, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 259.73782, -1847.06604, 2.80730, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 256.63138, -1849.88391, 2.80730, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 256.41461, -1848.26599, 2.80730, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 256.45490, -1846.90271, 2.80730, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 260.64746, -1824.95300, 3.41568, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 260.69281, -1823.06616, 3.41568, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 260.56763, -1821.16772, 3.41568, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 255.81464, -1821.07837, 3.41568, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 255.46877, -1823.05835, 3.41568, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19054, 255.73152, -1824.85120, 3.41568, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19076, 258.09116, -1823.21045, 2.95146, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19129, 242.61790, -1835.51733, 2.72630, 1.05200, 0.00000, 359.43091);
- CreateDynamicObject(18090, 237.26100, -1855.54749, 4.58257, 0.00000, 0.00000, 264.27795);
- CreateDynamicObject(19446, 237.39339, -1857.51733, 3.28600, 0.00000, 0.00000, 86.44100);
- CreateDynamicObject(19363, 232.67952, -1855.04187, 3.30459, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1486, 237.12230, -1853.99951, 3.20560, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1486, 236.07149, -1853.83521, 3.20560, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1486, 234.14748, -1853.73767, 3.20560, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1486, 238.69794, -1854.13623, 3.20560, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1486, 241.02480, -1854.36279, 3.20560, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1486, 237.01973, -1857.07825, 3.81768, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1486, 237.98662, -1856.91858, 3.81768, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19363, 232.66821, -1855.56335, 3.30459, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(19363, 242.10658, -1856.09863, 3.30459, 0.00000, 0.00000, 0.00000);
- //Drogendealer Beatch
- CreateDynamicObject(29, 380.48901, -1879.67712, 2.61162, 90.00000, 0.00000, 0.00000);
- CreateDynamicObject(1516, 380.52124, -1880.82202, 1.78816, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(348, 380.16962, -1879.67786, 2.68000, 0.00000, 90.00000, 9.00000);
- CreateDynamicObject(1575, 380.51065, -1880.83862, 2.31395, 0.00000, 0.00000, 0.00000);
- //Drogendealer Glenpark
- CreateDynamicObject(29, 380.48901, -1879.67712, 2.61162, 90.00000, 0.00000, 0.00000);
- CreateDynamicObject(1516, 380.52124, -1880.82202, 1.78816, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(348, 380.16962, -1879.67786, 2.68000, 0.00000, 90.00000, 9.00000);
- CreateDynamicObject(1575, 380.51065, -1880.83862, 2.31395, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(29, 1965.94702, -1155.05481, 20.97966, 90.00000, 0.00000, 0.00000);
- CreateDynamicObject(1516, 1965.82300, -1155.97974, 20.06935, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(1575, 1965.77966, -1156.08508, 20.59494, 0.00000, 0.00000, 0.00000);
- CreateDynamicObject(348, 1965.74426, -1155.07617, 21.05060, 0.00000, 90.00000, 90.00000);
- }
- public OnGameModeInit()
- {
- TDEditor_TD[0] = TextDrawCreate(2.666627, 433.496643, "Hier_kommt_dein_Text._Viel_Spass!_-_Impressiv_");
- TextDrawLetterSize(TDEditor_TD[0], 0.293999, 1.384296);
- TextDrawAlignment(TDEditor_TD[0], 1);
- TextDrawColor(TDEditor_TD[0], -1);
- TextDrawSetShadow(TDEditor_TD[0], 0);
- TextDrawSetOutline(TDEditor_TD[0], 0);
- TextDrawBackgroundColor(TDEditor_TD[0], 255);
- TextDrawFont(TDEditor_TD[0], 1);
- TextDrawSetProportional(TDEditor_TD[0], 1);
- TextDrawSetShadow(TDEditor_TD[0], 0);
- }
- //NORMALE-OBJEKTE
- LoadAllNormalObjects();
- //DYNAMIC-OBJEKTE
- LoadAllDynamicObjects();
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- //Remove von Ganghaus
- RemoveBuildingForPlayer(playerid, 1491, 944.5625, -52.7031, 1000.1172, 0.25);
- RemoveBuildingForPlayer(playerid, 14817, 949.4844, -50.8359, 1001.8672, 0.25);
- RemoveBuildingForPlayer(playerid, 1491, 944.1016, -49.3203, 1000.1172, 0.25);
- RemoveBuildingForPlayer(playerid, 1491, 951.0547, -52.7031, 1000.1172, 0.25);
- RemoveBuildingForPlayer(playerid, 1491, 951.0078, -49.3203, 1000.1172, 0.25);
- RemoveBuildingForPlayer(playerid, 1725, 951.9844, -46.2813, 1000.1250, 0.25);
- RemoveBuildingForPlayer(playerid, 1803, 952.9609, -57.4375, 1000.0938, 0.25);
- RemoveBuildingForPlayer(playerid, 2576, 955.1953, -55.4531, 1000.1016, 0.25);
- RemoveBuildingForPlayer(playerid, 2573, 955.3281, -43.5547, 1000.1016, 0.25);
- //Remove von Advent
- RemoveBuildingForPlayer(playerid, 3778, 245.5391, -1875.0000, 2.6875, 0.25);
- RemoveBuildingForPlayer(playerid, 3778, 200.4844, -1875.0000, 3.0781, 0.25);
- RemoveBuildingForPlayer(playerid, 3615, 200.4844, -1875.0000, 3.0781, 0.25);
- RemoveBuildingForPlayer(playerid, 3615, 245.5391, -1875.0000, 2.6875, 0.25);
- //Remove von DD an der Beatch
- RemoveBuildingForPlayer(playerid, 18109, 311.0703, -137.4453, 1005.0078, 0.25);
- RemoveBuildingForPlayer(playerid, 1977, 316.8750, -140.3516, 998.5859, 0.25);
- //Remove von DD an dem Glenpark
- RemoveBuildingForPlayer(playerid, 18109, 311.0703, -137.4453, 1005.0078, 0.25);
- RemoveBuildingForPlayer(playerid, 1977, 316.8750, -140.3516, 998.5859, 0.25);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerPos(playerid, SPAWN);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SetPlayerPos(playerid, SPAWN);
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- ocmd:werke(playerid,params[])
- {
- SendClientMessage(playerid,Blau,"Advent Map: /advent");
- SendClientMessage(playerid,Blau,"Airport Map: /airport");
- SendClientMessage(playerid,Blau,"Ganghaus Map: /ganghaus");
- SendClientMessage(playerid,Grau,"Es kommen noch weitere Maps");
- return 1;
- }
- ocmd:advent(playerid,params[])
- {
- SetPlayerPos(playerid, 241.8955,-1838.3055,3.7453);
- SetPlayerInterior(playerid, 0);
- return SendClientMessage(playerid,Grau,"Du hast dich zur Advent Map geportet!");
- }
- ocmd:airport(playerid,params[])
- {
- SetPlayerPos(playerid, 2791.6528,-2561.2771,13.6311);
- SetPlayerInterior(playerid, 0);
- return SendClientMessage(playerid,Grau,"Du hast dich zur Airport Map geportet!");
- }
- ocmd:ganghaus(playerid,params[])
- {
- SetPlayerPos(playerid, 960.5604,-52.6111,1001.1172);
- SetPlayerInterior(playerid, 3);
- return SendClientMessage(playerid,Grau,"Du hast dich zur Ganghaus Map geportet!");
- //SSCANF CODE
- /*----------------------------------------------------------------------------*-
- Function:
- sscanf
- Params:
- string[] - String to extract parameters from.
- format[] - Parameter types to get.
- {Float,_}:... - Data return variables.
- Return:
- 0 - Successful, not 0 - fail.
- Notes:
- A fail is either insufficient variables to store the data or insufficient
- data for the format string - excess data is disgarded.
- A string in the middle of the input data is extracted as a single word, a
- string at the end of the data collects all remaining text.
- The format codes are:
- c - A character.
- d, i - An integer.
- h, x - A hex number (e.g. a colour).
- f - A float.
- s - A string.
- z - An optional string.
- pX - An additional delimiter where X is another character.
- '' - Encloses a litteral string to locate.
- u - User, takes a name, part of a name or an id and returns the id if they're connected.
- Now has IsNumeric integrated into the code.
- Added additional delimiters in the form of all whitespace and an
- optioanlly specified one in the format string.
- -*----------------------------------------------------------------------------*/
- stock sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- while (paramPos < paramCount && string[stringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = string[stringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = string[++stringPos];
- }
- do
- {
- stringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- stringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- new changestr[16], changepos = 0, strpos = stringPos;
- while(changepos < 16 && string[strpos] && string[strpos] != delim)
- {
- changestr[changepos++] = string[strpos++];
- }
- changestr[changepos] = '\0';
- setarg(paramPos,0,_:floatstr(changestr));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = string[stringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- stringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment