Advertisement
Guest User

Untitled

a guest
Feb 20th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.02 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <ocmd>
  4.  
  5. // DEFINITIONS
  6. #define FILTERSCRIPT
  7. #define SCM SendClientMessage
  8.  
  9. // COLORS
  10. #define LOCKED 0xAA3333AA
  11. #define UNLOCKED 0x33AA33AA
  12. #define COLOR_LILA 0xCC0099FF
  13.  
  14. #define RED 0xFF0000FF
  15. #define GREEN 0x00FF00FF
  16.  
  17. //Dialoge
  18. #define DIALOG_REGISTER 1
  19. #define DIALOG_LOGIN 2
  20.  
  21. forward clock();
  22.  
  23. main()
  24. {
  25.     print("\n----------------------------------");
  26.     print(" Blank Gamemode by your name here");
  27.     print("----------------------------------\n");
  28. }
  29.  
  30.     public OnGameModeInit()
  31.  
  32.  
  33.  
  34. {
  35.     SetGameModeText("Server");
  36.  
  37.  
  38.     AddPlayerClass(29,1762.0703,-1949.3710,14.1096,319.5443,0,0,0,0,0,0);
  39.  
  40.     //Spawncars
  41.     AddStaticVehicle(462,1775.5690,-1933.6926,12.9846,270.0483,1,3);
  42.     AddStaticVehicle(462,1775.5911,-1932.6686,12.9848,268.6118,1,3);
  43.     AddStaticVehicle(462,1775.4144,-1931.5834,12.9857,267.3433,1,3);
  44.     AddStaticVehicle(462,1775.3889,-1930.3174,12.9768,270.4702,1,3);
  45.     AddStaticVehicle(462,1775.4987,-1928.8206,12.9861,268.3790,1,3);
  46.     AddStaticVehicle(462,1775.5491,-1927.5000,12.9866,268.6213,1,3);
  47.     AddStaticVehicle(462,1775.2678,-1926.0194,12.9843,270.7888,1,3);
  48.     AddStaticVehicle(462,1775.3298,-1925.2104,12.9786,266.7911,1,3);
  49.     AddStaticVehicle(462,1775.5122,-1924.3938,12.9847,262.0159,1,3);
  50.     AddStaticVehicle(462,1775.4674,-1922.9532,12.9837,266.9265,1,3);
  51.  
  52.     return 1;
  53. }
  54.     public OnGameModeExit()
  55. {
  56.     return 1;
  57. }
  58.     public OnPlayerRequestClass(playerid, classid)
  59. {
  60.     SetPlayerPos(playerid,1762.0703,-1949.3710,14.1096 );
  61.     SetPlayerCameraPos(playerid,1762.0703,-1949.3710,14.1096 );
  62.     SetPlayerCameraLookAt(playerid,1762.0703,-1949.3710,14.1096 );
  63.     SetPlayerFacingAngle(playerid,9.0969);
  64.     return 1;
  65. }
  66.     public OnPlayerConnect(playerid)
  67. {
  68.     new Spielerdatei[64];
  69.     new name[MAX_PLAYER_NAME];
  70.     GetPlayerName(playerid,name,sizeof(name));
  71.     format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  72.     if(dini_Exists(Spielerdatei))
  73.     {
  74.         ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Account wurde gefunden. Gib bitte das Passwort ein.","Login","Abbrechen");
  75.     }
  76.     else
  77.     {
  78.         ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrieren","Gib bitte das gewünschte Passwort ein:","Register","Abbrechen");
  79.     }
  80.     return 1;
  81.  
  82. }
  83.     public OnPlayerDisconnect(playerid, reason)
  84. {
  85.     if(GetPVarInt(playerid,"loggedin")==1)
  86.     {
  87.         SpielerSpeichern(playerid);
  88.     }
  89.     return 1;
  90. }
  91.  
  92.     public OnPlayerSpawn(playerid)
  93.  
  94. {
  95.     SetPlayerPos(playerid,1762.0703,-1949.3710,14.1096);
  96.  
  97.  
  98.     clock(); // Lässt die Uhr erscheinen.
  99.  
  100.     return 1;
  101. }
  102.  
  103.     public OnPlayerDeath(playerid, killerid, reason)
  104. {
  105.     return 1;
  106. }
  107.  
  108.     public OnVehicleSpawn(vehicleid)
  109. {
  110.     return 1;
  111. }
  112.  
  113.     public OnVehicleDeath(vehicleid, killerid)
  114. {
  115.     return 1;
  116. }
  117.  
  118.     public OnPlayerText(playerid, text[])
  119. {
  120.     return 1;
  121. }
  122.  
  123.     public OnPlayerCommandText(playerid, cmdtext[])
  124. {
  125.     if (strcmp("/stats", cmdtext, true) == 0)
  126.     {
  127.         new string[128];
  128.         new fraktname[64];
  129.         switch(GetPVarInt(playerid,"Fraktion"))
  130.         {
  131.             case 0:{fraktname="Zivilist";}
  132.             case 1:{fraktname="Fraktname 1";}
  133.             case 2:{fraktname="Fraktname 2";}
  134.             case 3:{fraktname="Fraktname 3";}
  135.             case 4:{fraktname="Fraktname 4";}
  136.         }
  137.         format(string,sizeof(string),"[Name: %s] [Level: %i] [Adminlevel: %i] [Fraktion: %s]",SpielerName(playerid), GetPlayerScore(playerid), GetPVarInt(playerid,"Adminlevel"), fraktname);
  138.         SendClientMessage(playerid,GREEN,string);
  139.        
  140.     }
  141.     if (strcmp("/money", cmdtext, true) == 0)
  142.     {
  143.         if(isPlayerAnAdmin(playerid,5))
  144.         {
  145.             GivePlayerMoney(playerid,10000);
  146.             return 1;
  147.         }
  148.         SendClientMessage(playerid,RED,"Du bist kein Admin oder kein Adminlevel 5!");
  149.         return 1;
  150.     }
  151.     if (strcmp("/heal", cmdtext, true, 10) == 0)
  152.     {
  153.         if(isPlayerAnAdmin(playerid,1))
  154.         {
  155.             SetPlayerHealth(playerid,100);
  156.             return 1;
  157.         }
  158.         SendClientMessage(playerid,RED,"Du bist kein Admin!");
  159.         return 1;
  160.     }
  161.     if (strcmp("/restart", cmdtext, true, 10) == 0)
  162.     {
  163.         if(isPlayerAnAdmin(playerid,5))
  164.         {
  165.             SendRconCommand("gmx");
  166.             return 1;
  167.         }
  168.         SendClientMessage(playerid,RED,"Du bist kein Admin oder kein Adminlevel 5!");
  169.         return 1;
  170.     }
  171.     return 1;
  172. }
  173. //OCMDS
  174. ocmd:ban(playerid,params[])
  175. {
  176.     if(isPlayerAnAdmin(playerid,5))
  177.     {
  178.         new pID, reason[128],string[128];
  179.         if(sscanf(params,"us",pID,reason)) return SendClientMessage(playerid,RED,"Versuch es noch einmal es geht so: /ban Playerid Grund.");
  180.         format(string,sizeof(string),"AdmCmd: %s wurde von %s gebannt. Grund: %s",SpielerName(pID),SpielerName(playerid),reason);
  181.         SendClientMessageToAll(RED,string);
  182.         SetPVarInt(playerid,"Gebannt",1);
  183.         Kick(pID);
  184.     }
  185.     return 1;
  186. }
  187.  
  188. ocmd:kick(playerid,params[])
  189. {
  190.     if(isPlayerAnAdmin(playerid,3))
  191.     {
  192.         new pID, reason[128],string[128];
  193.         if(sscanf(params,"us",pID,reason)) return SendClientMessage(playerid,RED,"Versuch es noch einmal es geht so: /kick Playerid Grund.");
  194.         format(string,sizeof(string),"AdmCmd: %s wurde von %s gekickt. Grund: %s",SpielerName(pID),SpielerName(playerid),reason);
  195.         SendClientMessageToAll(RED,string);
  196.         Kick(pID);
  197.     }
  198.     return 1;
  199. }
  200.  
  201.  
  202.     public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  203. {
  204.     return 1;
  205. }
  206.  
  207.     public OnPlayerExitVehicle(playerid, vehicleid)
  208. {
  209.     return 1;
  210. }
  211.  
  212.     public OnPlayerStateChange(playerid, newstate, oldstate)
  213. {
  214.     return 1;
  215. }
  216.  
  217.     public OnPlayerEnterCheckpoint(playerid)
  218. {
  219.     return 1;
  220. }
  221.  
  222.     public OnPlayerLeaveCheckpoint(playerid)
  223. {
  224.     return 1;
  225. }
  226.  
  227.     public OnPlayerEnterRaceCheckpoint(playerid)
  228. {
  229.     return 1;
  230. }
  231.  
  232.     public OnPlayerLeaveRaceCheckpoint(playerid)
  233. {
  234.     return 1;
  235. }
  236.  
  237.     public OnRconCommand(cmd[])
  238. {
  239.     return 1;
  240. }
  241.  
  242.     public OnPlayerRequestSpawn(playerid)
  243. {
  244.     return 1;
  245. }
  246.  
  247.     public OnObjectMoved(objectid)
  248. {
  249.     return 1;
  250. }
  251.  
  252.     public OnPlayerObjectMoved(playerid, objectid)
  253. {
  254.     return 1;
  255. }
  256.  
  257.     public OnPlayerPickUpPickup(playerid, pickupid)
  258. {
  259.     return 1;
  260. }
  261.  
  262.     public OnVehicleMod(playerid, vehicleid, componentid)
  263. {
  264.     return 1;
  265. }
  266.  
  267.     public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  268. {
  269.     return 1;
  270. }
  271.  
  272.     public OnVehicleRespray(playerid, vehicleid, color1, color2)
  273. {
  274.     return 1;
  275. }
  276.  
  277.     public OnPlayerSelectedMenuRow(playerid, row)
  278. {
  279.     return 1;
  280. }
  281.  
  282.     public OnPlayerExitedMenu(playerid)
  283. {
  284.     return 1;
  285. }
  286.  
  287.     public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  288. {
  289.     return 1;
  290. }
  291.  
  292.     public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  293. {
  294.     return 1;
  295. }
  296.  
  297.     public OnRconLoginAttempt(ip[], password[], success)
  298. {
  299.     return 1;
  300. }
  301.  
  302.     public OnPlayerUpdate(playerid)
  303. {
  304.     return 1;
  305. }
  306.  
  307.     public OnPlayerStreamIn(playerid, forplayerid)
  308. {
  309.     return 1;
  310. }
  311.  
  312.     public OnPlayerStreamOut(playerid, forplayerid)
  313. {
  314.     return 1;
  315. }
  316.  
  317.     public OnVehicleStreamIn(vehicleid, forplayerid)
  318. {
  319.     return 1;
  320. }
  321.  
  322.     public OnVehicleStreamOut(vehicleid, forplayerid)
  323. {
  324.     return 1;
  325. }
  326.  
  327.     public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  328. {
  329.     if(dialogid==DIALOG_LOGIN)
  330.     {
  331.         if(response==0)
  332.         {
  333.             SendClientMessage(playerid,RED,"Du hast den Vorgang abgebrochen.");
  334.             Kick(playerid);
  335.             return 1;
  336.         }
  337.         if(response==1)
  338.         {
  339.             if(!strlen(inputtext))
  340.             {
  341.                 SendClientMessage(playerid,RED,"Das Passwort war nicht lang genug.");
  342.                 ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Account wurde gefunden. Gib bitte das Passwort ein.","Login","Abbrechen");
  343.                 return 1;
  344.             }
  345.             else
  346.             {
  347.                 Login(playerid,inputtext);
  348.                 return 1;
  349.             }
  350.         }
  351.     }
  352.     if(dialogid==DIALOG_REGISTER)
  353.     {
  354.         if(response==0)
  355.         {
  356.             SendClientMessage(playerid,RED,"Du hast den Vorgang abgebrochen.");
  357.             Kick(playerid);
  358.             return 1;
  359.         }
  360.         if(response==1)
  361.         {
  362.             if(!strlen(inputtext))
  363.             {
  364.                 SendClientMessage(playerid,RED,"Das Passwort war nicht lang genug.");
  365.                 ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrieren","Gib bitte das gewünschte Passwort ein:","Register","Abbrechen");
  366.                 return 1;
  367.             }
  368.             else
  369.             {
  370.                 Register(playerid,inputtext);
  371.                 return 1;
  372.             }
  373.         }
  374.     }
  375.     return 1;
  376. }
  377.  
  378.     public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  379. {
  380.     return 1;
  381. }
  382.     public clock(){
  383.     new Text:Clock;
  384.     new hour,minute,second;
  385.     new string[10];
  386.     gettime(hour,minute,second);
  387.     format(string, sizeof string, "%s%d:%s%d:%s%d", (hour < 10) ? ("0") : (""), hour, (minute < 10) ? ("0") : (""), minute, (second < 10) ? ("0") : (""), second);
  388.     TextDrawHideForAll(Clock);
  389.     Clock = TextDrawCreate(542.0, 24.0, string); // Koordinaten, wo die Uhr angezeigt wird
  390.     TextDrawLetterSize(Clock, 0.6, 1.8);
  391.     TextDrawFont(Clock, 3); // Uhrschrift
  392.     TextDrawSetOutline(Clock, 2);
  393.     TextDrawShowForAll(Clock);
  394.     SetTimer("clock",1000,0);
  395.     return 1;
  396. }
  397.  
  398. stock Register(playerid, key[])
  399. {
  400.     new Spielerdatei[64];
  401.     new name[MAX_PLAYER_NAME];
  402.     GetPlayerName(playerid,name,sizeof(name));
  403.     format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  404.     dini_Create(Spielerdatei);
  405.     dini_Set(Spielerdatei,"Passwort",key);
  406.     SendClientMessage(playerid,GREEN,"Erfolgreich registriert!");
  407.     SetPlayerScore(playerid,1);
  408.     SetPVarInt(playerid,"loggedin",1);
  409.     return 1;
  410. }
  411.  
  412. stock Login(playerid, key[])
  413. {
  414.     new Spielerdatei[64];
  415.     new name[MAX_PLAYER_NAME];
  416.     GetPlayerName(playerid,name,sizeof(name));
  417.     format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  418.     if(!strcmp(key,dini_Get(Spielerdatei,"Passwort"),true))
  419.     {
  420.         LoadAccount(playerid);
  421.         SendClientMessage(playerid, GREEN, "Erfolgreich eingeloggt.");
  422.         return 1;
  423.     }
  424.     else
  425.     {
  426.         SendClientMessage(playerid,RED,"Falsches Passwort!");
  427.         ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Loggin","Bitte gib dein Passwort ein.","Einloggen","Abbrechen");
  428.         return 1;
  429.     }
  430. }
  431.  
  432. stock LoadAccount(playerid)
  433. {
  434.     new Spielerdatei[64];
  435.     new name[MAX_PLAYER_NAME];
  436.     GetPlayerName(playerid,name,sizeof(name));
  437.     format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  438.     SetPlayerScore(playerid,dini_Int(Spielerdatei,"Level"));
  439.     GivePlayerMoney(playerid,dini_Int(Spielerdatei,"Geld"));
  440.     SetPVarInt(playerid,"Adminlevel",dini_Int(Spielerdatei,"Adminlevel"));
  441.     SetPVarInt(playerid,"Fraktion",dini_Int(Spielerdatei,"Fraktion"));
  442.     SetPVarInt(playerid,"Gebannt",dini_Int(Spielerdatei,"Gebannt"));
  443.     if(GetPVarInt(playerid,"Gebannt")==1)
  444.     SetPVarInt(playerid,"loggedin",1);
  445.     {
  446.         SendClientMessage(playerid,RED,"Du bist vom Server gebannt!");
  447.         Kick(playerid);
  448.     }
  449.     SetPVarInt(playerid,"loggedin",1);
  450.     return 1;
  451. }
  452.  
  453. stock SpielerSpeichern(playerid)
  454. {
  455.     if(GetPVarInt(playerid,"loggedin")==1)
  456.     {
  457.         new Spielerdatei[64];
  458.         new name[MAX_PLAYER_NAME];
  459.         GetPlayerName(playerid,name,sizeof(name));
  460.         format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
  461.         dini_IntSet(Spielerdatei,"Level",GetPlayerScore(playerid));
  462.         dini_IntSet(Spielerdatei,"Geld",GetPlayerMoney(playerid));
  463.         dini_IntSet(Spielerdatei,"Adminlevel",GetPVarInt(playerid,"Adminlevel"));
  464.         dini_IntSet(Spielerdatei,"Fraktion",GetPVarInt(playerid,"Fraktion"));
  465.         dini_IntSet(Spielerdatei,"Gebannt",GetPVarInt(playerid,"Gebannt"));
  466.     }
  467.     return 1;
  468. }
  469.  
  470. stock isPlayerAnAdmin(playerid,rang)
  471. {
  472.     if(GetPVarInt(playerid,"Adminlevel")>=rang)return 1;
  473.     return 0;
  474. }
  475.  
  476. stock SpielerName(playerid)
  477. {
  478.     new name[MAX_PLAYER_NAME];
  479.     GetPlayerName(playerid,name,sizeof(name));
  480.     return name;
  481. }
  482.  
  483. stock sscanf(sstring[], format[], {Float,_}:...)
  484. {
  485.     #if defined isnull
  486.         if (isnull(sstring))
  487.     #else
  488.         if (sstring[0] == 0 || (sstring[0] == 1 && sstring[1] == 0))
  489.     #endif
  490.         {
  491.             return format[0];
  492.         }
  493.     #pragma tabsize 4
  494.     new
  495.         formatPos = 0,
  496.         sstringPos = 0,
  497.         paramPos = 2,
  498.         paramCount = numargs(),
  499.         delim = ' ';
  500.     while (sstring[sstringPos] && sstring[sstringPos] <= ' ')
  501.     {
  502.         sstringPos++;
  503.     }
  504.     while (paramPos < paramCount && sstring[sstringPos])
  505.     {
  506.         switch (format[formatPos++])
  507.         {
  508.             case '\0':
  509.             {
  510.                 return 0;
  511.             }
  512.             case 'i', 'd':
  513.             {
  514.                 new
  515.                     neg = 1,
  516.                     num = 0,
  517.                     ch = sstring[sstringPos];
  518.                 if (ch == '-')
  519.                 {
  520.                     neg = -1;
  521.                     ch = sstring[++sstringPos];
  522.                 }
  523.                 do
  524.                 {
  525.                     sstringPos++;
  526.                     if ('0' <= ch <= '9')
  527.                     {
  528.                         num = (num * 10) + (ch - '0');
  529.                     }
  530.                     else
  531.                     {
  532.                         return -1;
  533.                     }
  534.                 }
  535.                 while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
  536.                 setarg(paramPos, 0, num * neg);
  537.             }
  538.             case 'h', 'x':
  539.             {
  540.                 new
  541.                     num = 0,
  542.                     ch = sstring[sstringPos];
  543.                 do
  544.                 {
  545.                     sstringPos++;
  546.                     switch (ch)
  547.                     {
  548.                         case 'x', 'X':
  549.                         {
  550.                             num = 0;
  551.                             continue;
  552.                         }
  553.                         case '0' .. '9':
  554.                         {
  555.                             num = (num << 4) | (ch - '0');
  556.                         }
  557.                         case 'a' .. 'f':
  558.                         {
  559.                             num = (num << 4) | (ch - ('a' - 10));
  560.                         }
  561.                         case 'A' .. 'F':
  562.                         {
  563.                             num = (num << 4) | (ch - ('A' - 10));
  564.                         }
  565.                         default:
  566.                         {
  567.                             return -1;
  568.                         }
  569.                     }
  570.                 }
  571.                 while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
  572.                 setarg(paramPos, 0, num);
  573.             }
  574.             case 'c':
  575.             {
  576.                 setarg(paramPos, 0, sstring[sstringPos++]);
  577.             }
  578.             case 'f':
  579.             {
  580.  
  581.                 new changestr[16], changepos = 0, strpos = sstringPos;
  582.                 while(changepos < 16 && sstring[strpos] && sstring[strpos] != delim)
  583.                 {
  584.                     changestr[changepos++] = sstring[strpos++];
  585.                     }
  586.                 changestr[changepos] = '\0';
  587.                 setarg(paramPos,0,_:floatstr(changestr));
  588.             }
  589.             case 'p':
  590.             {
  591.                 delim = format[formatPos++];
  592.                 continue;
  593.             }
  594.             case '\'':
  595.             {
  596.                 new
  597.                     end = formatPos - 1,
  598.                     ch;
  599.                 while ((ch = format[++end]) && ch != '\'') {}
  600.                 if (!ch)
  601.                 {
  602.                     return -1;
  603.                 }
  604.                 format[end] = '\0';
  605.                 if ((ch = strfind(sstring, format[formatPos], false, sstringPos)) == -1)
  606.                 {
  607.                     if (format[end + 1])
  608.                     {
  609.                         return -1;
  610.                     }
  611.                     return 0;
  612.                 }
  613.                 format[end] = '\'';
  614.                 sstringPos = ch + (end - formatPos);
  615.                 formatPos = end + 1;
  616.             }
  617.             case 'u':
  618.             {
  619.                 new
  620.                     end = sstringPos - 1,
  621.                     id = 0,
  622.                     bool:num = true,
  623.                     ch;
  624.                 while ((ch = sstring[++end]) && ch != delim)
  625.                 {
  626.                     if (num)
  627.                     {
  628.                         if ('0' <= ch <= '9')
  629.                         {
  630.                             id = (id * 10) + (ch - '0');
  631.                         }
  632.                         else
  633.                         {
  634.                             num = false;
  635.                         }
  636.                     }
  637.                 }
  638.                 if (num && IsPlayerConnected(id))
  639.                 {
  640.                     setarg(paramPos, 0, id);
  641.                 }
  642.                 else
  643.                 {
  644.                     #if !defined foreach
  645.                         #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  646.                         #define __SSCANF_FOREACH__
  647.                     #endif
  648.                     sstring[end] = '\0';
  649.                     num = false;
  650.                     new
  651.                         name[MAX_PLAYER_NAME];
  652.                     id = end - sstringPos;
  653.                     foreach (Player, playerid)
  654.                     {
  655.                         GetPlayerName(playerid, name, sizeof (name));
  656.                         if (!strcmp(name, sstring[sstringPos], true, id))
  657.                         {
  658.                             setarg(paramPos, 0, playerid);
  659.                             num = true;
  660.                             break;
  661.                         }
  662.                     }
  663.                     if (!num)
  664.                     {
  665.                         setarg(paramPos, 0, INVALID_PLAYER_ID);
  666.                     }
  667.                     sstring[end] = ch;
  668.                     #if defined __SSCANF_FOREACH__
  669.                         #undef foreach
  670.                         #undef __SSCANF_FOREACH__
  671.                     #endif
  672.                 }
  673.                 sstringPos = end;
  674.             }
  675.             case 's', 'z':
  676.             {
  677.                 new
  678.                     i = 0,
  679.                     ch;
  680.                 if (format[formatPos])
  681.                 {
  682.                     while ((ch = sstring[sstringPos++]) && ch != delim)
  683.                     {
  684.                         setarg(paramPos, i++, ch);
  685.                     }
  686.                     if (!i)
  687.                     {
  688.                         return -1;
  689.                     }
  690.                 }
  691.                 else
  692.                 {
  693.                     while ((ch = sstring[sstringPos++]))
  694.                     {
  695.                         setarg(paramPos, i++, ch);
  696.                     }
  697.                 }
  698.                 sstringPos--;
  699.                 setarg(paramPos, i, '\0');
  700.             }
  701.             default:
  702.             {
  703.                 continue;
  704.             }
  705.         }
  706.         while (sstring[sstringPos] && sstring[sstringPos] != delim && sstring[sstringPos] > ' ')
  707.         {
  708.             sstringPos++;
  709.         }
  710.         while (sstring[sstringPos] && (sstring[sstringPos] == delim || sstring[sstringPos] <= ' '))
  711.         {
  712.             sstringPos++;
  713.         }
  714.         paramPos++;
  715.     }
  716.     do
  717.     {
  718.         if ((delim = format[formatPos++]) > ' ')
  719.         {
  720.             if (delim == '\'')
  721.             {
  722.                 while ((delim = format[formatPos++]) && delim != '\'') {}
  723.             }
  724.             else if (delim != 'z')
  725.             {
  726.                 return delim;
  727.             }
  728.         }
  729.     }
  730.     while (delim > ' ');
  731.     return 0;
  732. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement