Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**** EASY-TO-HANDLE ADMINSYSTEM ****/
- /**** created & written by Logan Adams aka. McBastard112 2012 ****/
- /**** Version 1.2 ****/
- /**** For SAMP 0.3 ****/
- /*********************** *************/
- /**** CHANGELOG *********/
- /**** Version 1.2 ****/
- /**** added new functions. Now you can Give The Player per dialog a weapon and per dialog the ammo, the same for Giving the player money.
- of Course you can resett the weapons of the player, too.
- ****/
- /**** At Restarting and Shutting the server down Dialogs you'll have to enter only integers. Text will be recognized .. Same at new functions in this version. ****/
- /**** ****************/
- /**** Version 1.1 ****/
- /**** Dialog Bugs fixed ****/
- /**** Spectate Bugs fixed ****/
- /**** added new functions at /controlpanel. Now you can insert at Restart/Exit Server the interval until the server will be restarted/shutten down ****/
- /**** ****************/
- /**** Includes ****/
- #include <a_samp>
- #include <ocmd>
- /**** ************/
- /**** Farben/colors ****/
- #define ROT 0xF50000FF
- #define BLAU 0x1400FFFF
- #define GELB 0xFFFF00FF
- #define GRÜN 0x19FF00FF
- #define TÜRKIS 0x00FFFFFF
- #define SCHWARZ 0x000000FF
- #define WEISS 0xFEFEFEFF
- #define GOLD 0xFFC800FF
- #define PINK 0xFF0055FF
- #define LILA 0xC800FFFF
- #define GRAU 0xAAAAAAFF
- /********** *******/
- /**** Variablen ****/
- new targetid[MAX_PLAYERS];
- new weaponid[MAX_PLAYERS];
- /**** ***************/
- /**** Timer Forwards **************/
- forward Restarttimer();
- forward Shuttimer();
- /**** ***************************/
- /**** Dialog ID's ****/
- #define fs_CONTROL 100
- #define fs_PLAYER 101
- #define fs_CONTROL_HOST 102
- #define fs_CONTROL_MODE 103
- #define fs_CONTROL_MAP 104
- #define fs_PLAYER_KICK 105
- #define fs_PLAYER_BAN 106
- #define fs_CONTROL_RESTART 107
- #define fs_CONTROL_EXIT 108
- #define fs_PLAYER_GUN 109
- #define fs_PLAYER_AMMO 110
- #define fs_PLAYER_MONEY 111
- /**** *****************/
- public OnFilterScriptInit()
- {
- print("\n-------------------------------------------------");
- print(" |EASY-TO-HANDLE-ADMINSYSTEM successfully loaded.|");
- print(" |Version 1.2|");
- print(" |by Logan Adams aka. McBastard112|");
- print(" |For SAMP 0.3|");
- print("---------------------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n-------------------------------------------------");
- print(" |EASY-TO-HANDLE-ADMINSYSTEM successfully unloaded.|");
- print(" |Version 1.2|");
- print(" |by Logan Adams aka. McBastard112|");
- print(" |For SAMP 0.3|");
- print("---------------------------------------------------\n");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case fs_CONTROL:
- {
- switch(listitem)
- {
- case 0:
- {
- ShowPlayerDialog(playerid,fs_CONTROL_HOST,DIALOG_STYLE_INPUT,"Change Hostname","Insert new Hostname below ...","OK","Quit");
- return 1;
- }
- case 1:
- {
- ShowPlayerDialog(playerid,fs_CONTROL_MODE,DIALOG_STYLE_INPUT,"Change Mode","Insert new Mode below ...","OK","Quit");
- return 1;
- }
- case 2:
- {
- ShowPlayerDialog(playerid,fs_CONTROL_MAP,DIALOG_STYLE_INPUT,"Change Mapname","Insert new Mapname below ...","OK","Quit");
- return 1;
- }
- case 3:
- {
- ShowPlayerDialog(playerid,fs_CONTROL_RESTART,DIALOG_STYLE_INPUT,"Insert interval","Insert interval ( in seconds ) of time below ...","OK","");
- return 1;
- }
- case 4:
- {
- ShowPlayerDialog(playerid,fs_CONTROL_EXIT,DIALOG_STYLE_INPUT,"Insert interval","Insert interval ( in seconds ) of time below ...","OK","");
- return 1;
- }
- }
- }
- case fs_CONTROL_HOST:
- {
- new str[128],str2[128];
- format(str,sizeof str,"hostname %s",inputtext);
- format(str2,sizeof str2,"Admin %s has changed the hostname to %s",PlayerName(playerid),inputtext);
- SendRconCommand(str);
- SendClientMessageToAll(GRÜN,str2);
- return 1;
- }
- case fs_CONTROL_MODE:
- {
- new str[128];
- format(str,sizeof str,"Admin %s has changed the GameModeMode to %s",PlayerName(playerid),inputtext);
- SetGameModeText(inputtext);
- SendClientMessageToAll(GRÜN,str);
- return 1;
- }
- case fs_CONTROL_MAP:
- {
- new str[128],str2[128];
- format(str,sizeof str,"mapname %s",inputtext);
- format(str2,sizeof str2,"Admin %s has changed the Mapname to %s",PlayerName(playerid),inputtext);
- SendRconCommand(str);
- SendClientMessageToAll(GRÜN,str2);
- return 1;
- }
- case fs_CONTROL_RESTART:
- {
- new z;
- if(sscanf(inputtext,"i",z))
- {
- SendClientMessage(playerid,ROT,"Only Integers! Not text!");
- ShowPlayerDialog(playerid,fs_CONTROL_RESTART,DIALOG_STYLE_INPUT,"Insert interval","Insert interval ( in seconds ) of time below ...","OK","");
- return 0;
- }
- new str[128];
- format(str,sizeof str,"The Server will be restarted in %i seconds!",strval(inputtext));
- SendClientMessageToAll(ROT,str);
- GameTextForAll(str,strval(inputtext)*1000,4);
- SetTimer("Restarttimer",strval(inputtext)*1000,false);
- }
- case fs_CONTROL_EXIT:
- {
- new z1;
- if(sscanf(inputtext,"i",z1))
- {
- SendClientMessage(playerid,ROT,"Only Integers! Not text!");
- ShowPlayerDialog(playerid,fs_CONTROL_EXIT,DIALOG_STYLE_INPUT,"Insert interval","Insert interval ( in seconds ) of time below ...","OK","");
- return 0;
- }
- new str[128];
- format(str,sizeof str,"The Server will be shutten down in %i seconds!",strval(inputtext));
- SendClientMessageToAll(ROT,str);
- GameTextForAll(str,strval(inputtext)*1000,4);
- SetTimer("Shuttimer",strval(inputtext)*1000,false);
- }
- case fs_PLAYER_KICK:
- {
- new str[128];
- format(str,sizeof str,"[AdmCmd] %s has been kicked by %s. Reason: %s",PlayerName(targetid[playerid]),PlayerName(playerid),inputtext);
- SendClientMessageToAll(ROT,str);
- Kick(targetid[playerid]);
- }
- case fs_PLAYER_BAN:
- {
- new str[128];
- format(str,sizeof str,"[AdmCmd] %s has been ip-banned by Admin %s. Reason: %s",PlayerName(targetid[playerid]),PlayerName(playerid),inputtext);
- SendClientMessageToAll(ROT,str);
- Ban(targetid[playerid]);
- }
- case fs_PLAYER:
- {
- switch(listitem)
- {
- case 0:
- {
- new string1[128],string2[128];
- SetPlayerArmour(targetid[playerid], 100);
- format(string1, sizeof(string1), "[AdmCmd] Admin %s has given you a protective vest", PlayerName(playerid));
- format(string2, sizeof(string2), "[AdmCmd] You have given %s a protective vest",PlayerName(targetid[playerid]));
- SendClientMessage(playerid, GRÜN, string2);
- SendClientMessage(targetid[playerid], GRÜN, string1);
- }
- case 1:
- {
- new string1[128],string2[128];
- SetPlayerArmour(targetid[playerid], 0);
- format(string1, sizeof(string1), "[AdmCmd] Admin %s has deleted your protective vest", PlayerName(playerid));
- format(string2, sizeof(string2), "[AdmCmd] You have deleted %s's protective vest",PlayerName(targetid[playerid]));
- SendClientMessage(playerid, GRÜN, string2);
- SendClientMessage(targetid[playerid], GRÜN, string1);
- }
- case 2:
- {
- new string1[128],string2[128];
- SetPlayerHealth(targetid[playerid], 100);
- format(string1, sizeof(string1), "[AdmCmd] Admin %s has given you Full HP", PlayerName(playerid));
- format(string2, sizeof(string2), "[AdmCmd] You have given %s Full HP",PlayerName(targetid[playerid]));
- SendClientMessage(playerid, GRÜN, string2);
- SendClientMessage(targetid[playerid], GRÜN, string1);
- }
- case 3:
- {
- new string1[128],string2[128];
- SetPlayerHealth(targetid[playerid], 0);
- format(string1, sizeof(string1), "[AdmCmd] Admin %s has killed you", PlayerName(playerid));
- format(string2, sizeof(string2), "[AdmCmd] You have killed %s",PlayerName(targetid[playerid]));
- SendClientMessage(playerid, GRÜN, string2);
- SendClientMessage(targetid[playerid], GRÜN, string1);
- }
- case 4:
- {
- new str[128];
- format(str,sizeof str,"[AdmCmd] You are now spectating %s",PlayerName(targetid[playerid]));
- SendClientMessage(playerid,GRÜN,str);
- if(IsPlayerInAnyVehicle(targetid[playerid]))
- {
- TogglePlayerSpectating(playerid,1);
- PlayerSpectateVehicle(playerid,GetPlayerVehicleID(targetid[playerid]));
- SetPlayerInterior(playerid,GetPlayerInterior(targetid[playerid]));
- }
- else
- {
- TogglePlayerSpectating(playerid,1);
- PlayerSpectatePlayer(playerid,targetid[playerid]);
- SetPlayerInterior(playerid,GetPlayerInterior(targetid[playerid]));
- }
- }
- case 5:
- {
- TogglePlayerSpectating(playerid, 0);
- SetPlayerInterior(playerid, 0);
- SetCameraBehindPlayer(playerid);
- SendClientMessage(playerid,GRÜN,"Spectating stopped");
- }
- case 6:
- {
- new str[128],str2[128];
- format(str,sizeof str,"[AdmCmd] You have ported yourself to %s",PlayerName(targetid[playerid]));
- format(str2,sizeof str2,"[AdmCmd] Admin %s has ported himself to you",PlayerName(playerid));
- SendClientMessage(playerid,GRÜN,str);
- SendClientMessage(targetid[playerid],GRÜN,str2);
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(targetid[playerid],X,Y,Z);
- SetPlayerPos(playerid,X,Y+2,Z);
- SetPlayerInterior(playerid,GetPlayerInterior(targetid[playerid]));
- }
- case 7:
- {
- new str[128],str2[128];
- format(str,sizeof str,"[AdmCmd] You have ported %s to yourself",PlayerName(targetid[playerid]));
- format(str2,sizeof str2,"[AdmCmd] Admin %s has ported you to himself",PlayerName(playerid));
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid,X,Y,Z);
- SetPlayerPos(targetid[playerid],X,Y+2,Z);
- SetPlayerInterior(targetid[playerid],GetPlayerInterior(playerid));
- SendClientMessage(playerid,GRÜN,str);
- SendClientMessage(playerid,GRÜN,str2);
- }
- case 8:
- {
- new str[128],str2[128];
- format(str,sizeof str,"[AdmCmd] You have slapped %s",PlayerName(targetid[playerid]));
- format(str2,sizeof str2,"[AdmCmd] Admin %s has slapped you",PlayerName(playerid));
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(targetid[playerid],X,Y,Z);
- SetPlayerPos(targetid[playerid],X,Y,Z+10);
- SendClientMessage(playerid,GRÜN,str);
- SendClientMessage(playerid,GRÜN,str2);
- }
- case 9:
- {
- ShowPlayerDialog(playerid,fs_PLAYER_KICK,DIALOG_STYLE_INPUT,"Kick Player","Insert the reason for kicking the Player below ...","OK","");
- }
- case 10:
- {
- ShowPlayerDialog(playerid,fs_PLAYER_BAN,DIALOG_STYLE_INPUT,"Ban Player","Insert the reason for banning the Player below ...","OK","");
- }
- case 11:
- {
- new str[90];
- format(str,sizeof str,"Nightstick\nKnife\nBat\nSilenced\nDeagle\nShotgun\nMP5\nM4\nSniper\nAK47\nMinigun");
- ShowPlayerDialog(playerid,fs_PLAYER_GUN,DIALOG_STYLE_LIST,"Choose kind of gun",str,"OK","Quit");
- }
- case 12:
- {
- new str[128],str2[128];
- format(str,sizeof str,"[AdmCmd] You have resetted %s's weapons",PlayerName(targetid[playerid]));
- format(str2,sizeof str2,"[AdmCmd] Admin %s has resetted your weapons",PlayerName(playerid));
- ResetPlayerWeapons(targetid[playerid]);
- SendClientMessage(playerid,GRÜN,str);
- SendClientMessage(targetid[playerid],GRÜN,str2);
- }
- case 13:
- {
- ShowPlayerDialog(playerid,fs_PLAYER_MONEY,DIALOG_STYLE_INPUT,"Insert amount of money","Insert the amount of the money below ...","OK","Quit");
- }
- }
- }
- case fs_PLAYER_GUN:
- {
- switch(listitem)
- {
- case 0:
- {
- weaponid[playerid] = 3;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 1:
- {
- weaponid[playerid] = 4;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 2:
- {
- weaponid[playerid] = 5;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 3:
- {
- weaponid[playerid] = 23;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 4:
- {
- weaponid[playerid] = 24;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 5:
- {
- weaponid[playerid] = 25;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 6:
- {
- weaponid[playerid] = 29;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 7:
- {
- weaponid[playerid] = 31;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 8:
- {
- weaponid[playerid] = 34;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 9:
- {
- weaponid[playerid] = 30;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- case 10:
- {
- weaponid[playerid] = 38;
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- }
- }
- case fs_PLAYER_AMMO:
- {
- new integer;
- if(sscanf(inputtext,"i",integer))
- {
- SendClientMessage(playerid,ROT,"Only Integers! Not text!");
- ShowPlayerDialog(playerid,fs_PLAYER_AMMO,DIALOG_STYLE_INPUT,"Insert ammo","Insert Ammo of the gun below ...","OK","");
- }
- else
- {
- new str[128];
- new str2[128];
- GivePlayerWeapon(playerid,weaponid[playerid],strval(inputtext));
- format(str,sizeof str,"[AdmCmd]You have given %s a gun ( weaponid %i ) with %i ammo",PlayerName(targetid[playerid]),weaponid[playerid],strval(inputtext));
- format(str2,sizeof str2,"[AdmCmd] Admin %s has given you a gun ( weaponid %i ) with %i ammo",PlayerName(playerid),weaponid[playerid],strval(inputtext));
- SendClientMessage(playerid,GRÜN,str);
- SendClientMessage(targetid[playerid],GRÜN,str2);
- }
- }
- case fs_PLAYER_MONEY:
- {
- new str[128],str2[128],z3;
- if(sscanf(inputtext,"i",z3))
- {
- ShowPlayerDialog(playerid,fs_PLAYER_MONEY,DIALOG_STYLE_INPUT,"Insert amount","Insert the amount of money below ...","OK","Quit");
- SendClientMessage(playerid,ROT,"Only integers! Not text!");
- return 0;
- }
- format(str,sizeof str,"[AdmCmd] You have given %s %i$",PlayerName(targetid[playerid]),strval(inputtext));
- format(str2,sizeof str2,"[AdmCmd] Admin %s has given you %i$",PlayerName(playerid),strval(inputtext));
- SendClientMessage(playerid,GRÜN,str);
- SendClientMessage(targetid[playerid],GRÜN,str2);
- GivePlayerMoney(targetid[playerid],GetPlayerMoney(targetid[playerid])+strval(inputtext));
- }
- }
- return 0;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- new str[128],str2[500];
- if(IsPlayerAdmin(playerid))
- {
- targetid[playerid] = clickedplayerid;
- format(str,sizeof str,"What do U wanna do with %s ?",PlayerName(clickedplayerid));
- format(str2,sizeof str2,"Give Armour\nDelete Armour\nHeal\nKill\nSpectate\nSpec off\nGoto\nGethere\nSlap\nKick\nBan\nGive Gun\nReset Weapons\nGive Money");
- ShowPlayerDialog(playerid,fs_PLAYER,DIALOG_STYLE_LIST,str,str2,"OK","");
- }
- else
- {
- SendClientMessage(playerid,ROT,"You have to be logged in as RCON-Admin, to manage this player!");
- }
- return 1;
- }
- /**** OCMD Commands ****/
- ocmd:controlpanel(playerid,params[])
- {
- #pragma unused params
- if(IsPlayerAdmin(playerid))
- ShowPlayerDialog(playerid,fs_CONTROL,DIALOG_STYLE_LIST,"Server Control Panel","Change Hostname\nChange Gamemodemode\nChange Mapname\nRestart Server\nShut Server down","OK","Quit");
- return 1;
- }
- /**** ******************/
- /**** Stock to get one's Player Name ****/
- stock PlayerName(playerid)
- {
- new GetName[MAX_PLAYER_NAME];
- GetPlayerName(playerid,GetName,sizeof(GetName));
- return GetName;
- }
- /**** ************************************/
- /**** Timer Publics ****/
- public Restarttimer()
- {
- SendRconCommand("gmx");
- return 1;
- }
- public Shuttimer()
- {
- SendRconCommand("exit");
- }
- /**** *********************/
- /**** IsNumeric Stock ****/
- stock IsNumeric(const string[])
- {
- new length=strlen(string);
- if(length==0)
- {
- return 0;
- }
- for (new i=0; i<length; i++)
- {
- if (!((string[i] <= '9' && string[i] >= '0') || (i==0 && (string[i]=='-' || string[i]=='+'))))
- {
- return false;
- }
- }
- return 0;
- }
- /**** ************************************************/
- /**** sscanf Code ****/
- 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
Advertisement