Deaths=5[/quote]
dini_Int(filename[], key[])
Ezzel az integer változókat tudjuk kiolvasni a fájlból.
Példa:
dini_Int(\"Fájlnév\",\"Deaths\");
Ezzel most kilvastam, hogy a Deaths mennyit ér, vagyis mennyi az értéke.
Ezekkel lehet feltételeket csinálni. Például:
dini_Int(\"Fájlnév\",\"Deaths\");
if(\"Deaths\" == 5)
{
print(\"A Deaths egyenlo öttel.\");
}
dini_Unset(filename[], key[])
Ezzel törölni tudunk a fájlból dolgokat(integer, string változókat egyaránt).
Példa:
dini_Unset(\"Fájlnév\",\"Deaths\");
Ezzel kitöröltük azt, hogy a Deaths egyenlo( = ) az öttel ( Deaths=5 megszünt létezni a fájlból ).
Remélem segítettem valakinek és érthetoen magyaráztam, amit csak remélni tudok. :)
Kellemes Karácsonyt és Buldog Új Évet Mindenkinek! :)
Dini.inc
/*
* Dini 1.6
* (c) Copyright 2006-2008 by DracoBlue
*
* @author : DracoBlue (http://dracoblue.com)
* @date : 13th May 2006
* @update : 16th Sep 2008
*
* This file is provided as is (no warranties).
*
* It\'s released under the terms of MIT.
*
* Feel free to use it, a little message in
* about box is honouring thing, isn\'t it?
*
*/
#if defined _dini_included
#endinput
#endif
#define _dini_included
#pragma library dini
#if defined MAX_STRING
#define DINI_MAX_STRING MAX_STRING
#else
#define DINI_MAX_STRING 255
#endif
stock dini_Exists(filename[]) {
return fexist(filename);
}
stock dini_Remove(filename[]) {
return fremove(filename);
}
stock dini_Create(filename[]) {
if (fexist(filename)) return false;
new File:fhnd;
fhnd=fopen(filename,io_write);
if (fhnd) {
fclose(fhnd);
return true;
}
return false;
}
stock dini_Set(filename[],key[],value[]) {
// If we have no key, it can\'t be set
// we also have no chance to set the value, if all together is bigger then the max string
new key_length = strlen(key);
new value_length = strlen(value);
if (key_length==0 || key_length+value_length+2>DINI_MAX_STRING) return false;
new File:fohnd, File:fwhnd;
new tmpres[DINI_MAX_STRING];
new bool:wasset=false;
// Let\'s remove the old *.part file if there was one.
format(tmpres,sizeof(tmpres),\"%s.part\",filename);
fremove(tmpres);
// We\'ll open the source file.
fohnd=fopen(filename,io_read);
if (!fohnd) return false;
fwhnd=fopen(tmpres,io_write);
if (!fwhnd) {
// we can\'t open the second file for writing, so .. let\'s close the open one and exit.
fclose(fohnd);
return false;
}
while (fread(fohnd,tmpres)) {
if (
!wasset
&& tmpres[key_length]==\'=\'
&& !strcmp(tmpres, key, true, key_length)
) {
// We\'ve got what needs to be replaced!
format(tmpres,sizeof(tmpres),\"%s=%s\",key,value);
wasset=true;
} else {
DINI_StripNewLine(tmpres);
}
fwrite(fwhnd,tmpres);
fwrite(fwhnd,\"\\r\\n\");
}
if (!wasset) {
format(tmpres,sizeof(tmpres),\"%s=%s\",key,value);
fwrite(fwhnd,tmpres);
fwrite(fwhnd,\"\\r\\n\");
}
fclose(fohnd);
fclose(fwhnd);
format(tmpres,sizeof(tmpres),\"%s.part\",filename);
if (DINI_fcopytextfile(tmpres,filename)) {
return fremove(tmpres);
}
return false;
}
stock dini_IntSet(filename[],key[],value) {
new valuestring[DINI_MAX_STRING];
format(valuestring,DINI_MAX_STRING,\"%d\",value);
return dini_Set(filename,key,valuestring);
}
stock dini_Int(filename[],key[]) {
return strval(dini_Get(filename,key));
}
stock dini_FloatSet(filename[],key[],Float:value) {
new valuestring[DINI_MAX_STRING];
format(valuestring,DINI_MAX_STRING,\"%f\",value);
return dini_Set(filename,key,valuestring);
}
stock Float:dini_Float(filename[],key[]) {
return floatstr(dini_Get(filename,key));
}
stock dini_Bool(filename[],key[]) {
return strval(dini_Get(filename,key));
}
stock dini_BoolSet(filename[],key[],value) {
if (value) {
return dini_Set(filename,key,\"1\");
}
return dini_Set(filename,key,\"0\");
}
stock dini_Unset(filename[],key[]) {
// If we have no key, it can\'t be set
// we also have no chance to unset the key, if all together is bigger then the max string
new key_length = strlen(key);
if (key_length==0 || key_length+2>DINI_MAX_STRING) return false;
new File:fohnd, File:fwhnd;
new tmpres[DINI_MAX_STRING];
// Let\'s remove the old *.part file if there was one.
format(tmpres,DINI_MAX_STRING,\"%s.part\",filename);
fremove(tmpres);
// We\'ll open the source file.
fohnd=fopen(filename,io_read);
if (!fohnd) return false;
fwhnd=fopen(tmpres,io_write);
if (!fwhnd) {
// we can\'t open the second file for writing, so .. let\'s close the open one and exit.
fclose(fohnd);
return false;
}
while (fread(fohnd,tmpres)) {
if (
tmpres[key_length]==\'=\'
&& !strcmp(tmpres, key, true, key_length)
) {
// We\'ve got what needs to be removed!
} else {
DINI_StripNewLine(tmpres);
fwrite(fwhnd,tmpres);
fwrite(fwhnd,\"\\r\\n\");
}
}
fclose(fohnd);
fclose(fwhnd);
format(tmpres,DINI_MAX_STRING,\"%s.part\",filename);
if (DINI_fcopytextfile(tmpres,filename)) {
return fremove(tmpres);
}
return false;
}
stock dini_Get(filename[],key[]) {
new tmpres[DINI_MAX_STRING];
new key_length = strlen(key);
if (key_length==0 || key_length+2>DINI_MAX_STRING) return tmpres;
new File:fohnd;
fohnd=fopen(filename,io_read);
if (!fohnd) return tmpres;
while (fread(fohnd,tmpres)) {
if (
tmpres[key_length]==\'=\'
&& !strcmp(tmpres, key, true, key_length)
) {
/* We\'ve got what we need */
DINI_StripNewLine(tmpres);
strmid(tmpres, tmpres, key_length + 1, strlen(tmpres), DINI_MAX_STRING);
fclose(fohnd);
return tmpres;
}
}
fclose(fohnd);
return tmpres;
}
stock dini_Isset(filename[],key[]) {
new key_length = strlen(key);
if (key_length==0 || key_length+2>DINI_MAX_STRING) return false;
new File:fohnd;
fohnd=fopen(filename,io_read);
if (!fohnd) return false;
new tmpres[DINI_MAX_STRING];
while (fread(fohnd,tmpres)) {
if (
tmpres[key_length]==\'=\'
&& !strcmp(tmpres, key, true, key_length)
) {
// We\'ve got what we need
fclose(fohnd);
return true;
}
}
fclose(fohnd);
return false;
}
stock DINI_StripNewLine(string[]) {
new len = strlen(string);
if (string[0]==0) return ;
if ((string[len - 1] == \'\\n\') || (string[len - 1] == \'\\r\')) {
string[len - 1] = 0;
if (string[0]==0) return ;
if ((string[len - 2] == \'\\n\') || (string[len - 2] == \'\\r\')) string[len - 2] = 0;
}
}
stock DINI_fcopytextfile(oldname[],newname[]) {
new File:ohnd,File:nhnd;
if (!fexist(oldname)) return false;
ohnd=fopen(oldname,io_read);
if (!ohnd) return false;
nhnd=fopen(newname,io_write);
if (!nhnd) {
fclose(ohnd);
return false;
}
new tmpres[DINI_MAX_STRING];
while (fread(ohnd,tmpres)) {
DINI_StripNewLine(tmpres);
format(tmpres,sizeof(tmpres),\"%s\\r\\n\",tmpres);
fwrite(nhnd,tmpres);
}
fclose(ohnd);
fclose(nhnd);
return true;
}
DUDB
/*
* DUDB functions
* (c) Copyright 2006-2007 by DracoBlue
*
* @version : 2.3
* @author : DracoBlue (http://dracoblue.net)
* @date : 8th May 2006
* @update : 3rd June 2007
* @require : DUtils 1.8
* @require : DINI 1.5
*
* This Unit is provided as is (no warranties).
* Feel free to use it, a little message in
* about box is honouring thing, isn\'t it?
*
*/
#if defined _dudb_included
#endinput
#endif
#define _dudb_included
#pragma library dutils
#include <dutils>
#include <dini>
#define dUser(%1).( udb_User(%1,
#define dUserINT(%1).( udb_UserInt(%1,
#define dUserSet(%1).( udb_UserSet(%1,
#define dUserSetINT(%1).( udb_UserSetInt(%1,
#define dUserSetFLOAT(%1).( udb_UserSetFloat(%1,
#define dUserFLOAT(%1).( udb_UserFloat(%1,
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
stock udb_encode(nickname[]) {
new tmp[MAX_STRING];
set(tmp,nickname);
tmp=strreplace(\"_\",\"_00\",tmp);
tmp=strreplace(\";\",\"_01\",tmp);
tmp=strreplace(\"!\",\"_02\",tmp);
tmp=strreplace(\"/\",\"_03\",tmp);
tmp=strreplace(\"\\\\\",\"_04\",tmp);
tmp=strreplace(\"[\",\"_05\",tmp);
tmp=strreplace(\"]\",\"_06\",tmp);
tmp=strreplace(\"?\",\"_07\",tmp);
tmp=strreplace(\".\",\"_08\",tmp);
tmp=strreplace(\"*\",\"_09\",tmp);
tmp=strreplace(\"<\",\"_10\",tmp);
tmp=strreplace(\">\",\"_11\",tmp);
tmp=strreplace(\"{\",\"_12\",tmp);
tmp=strreplace(\"}\",\"_13\",tmp);
tmp=strreplace(\" \",\"_14\",tmp);
tmp=strreplace(\"\\\"\",\"_15\",tmp);
tmp=strreplace(\":\",\"_16\",tmp);
tmp=strreplace(\"|\",\"_17\",tmp);
tmp=strreplace(\"=\",\"_18\",tmp);
return tmp;
}
stock udb_decode(nickname[]) {
new tmp[MAX_STRING];
set(tmp,nickname);
tmp=strreplace(\"_01\",\";\",tmp);
tmp=strreplace(\"_02\",\"!\",tmp);
tmp=strreplace(\"_03\",\"/\",tmp);
tmp=strreplace(\"_04\",\"\\\\\",tmp);
tmp=strreplace(\"_05\",\"[\",tmp);
tmp=strreplace(\"_06\",\"]\",tmp);
tmp=strreplace(\"_07\",\"?\",tmp);
tmp=strreplace(\"_08\",\".\",tmp);
tmp=strreplace(\"_09\",\"*\",tmp);
tmp=strreplace(\"_10\",\"<\",tmp);
tmp=strreplace(\"_11\",\">\",tmp);
tmp=strreplace(\"_12\",\"{\",tmp);
tmp=strreplace(\"_13\",\"}\",tmp);
tmp=strreplace(\"_14\",\" \",tmp);
tmp=strreplace(\"_15\",\"\\\"\",tmp);
tmp=strreplace(\"_16\",\":\",tmp);
tmp=strreplace(\"_17\",\"|\",tmp);
tmp=strreplace(\"_18\",\"=\",tmp);
tmp=strreplace(\"_00\",\"_\",tmp);
return tmp;
}
stock udb_Exists(nickname[]) {
new tmp[MAX_STRING];
format(tmp,sizeof(tmp),\"%s.dudb.sav\",udb_encode(nickname));
return fexist(tmp);
}
stock udb_Remove(nickname[]) {
new tmp[MAX_STRING];
format(tmp,sizeof(tmp),\"%s.dudb.sav\",udb_encode(nickname));
return dini_Remove(tmp);
}
stock udb_UserSetInt(nickname[],key[],value) {
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
return dini_IntSet(fname,key,value);
}
stock udb_UserSetFloat(nickname[],key[],Float:value) {
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
return dini_FloatSet(fname,key,value);
}
stock udb_UserSet(nickname[],key[],value[]) {
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
return dini_Set(fname,key,value);
}
stock udb_User(nickname[],key[]) {
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
format(fname,sizeof(fname),dini_Get(fname,key));
return fname;
}
stock Float:udb_UserFloat(nickname[],key[]) {
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
return dini_Float(fname,key);
}
stock udb_UserInt(nickname[],key[]) {
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
return dini_Int(fname,key);
}
stock udb_CheckLogin(nickname[],pwd[]) {
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
if (udb_UserInt(nickname,\"password_hash\")==udb_hash(pwd)) return true;
return false;
}
stock udb_Create(nickname[],pwd[]) {
if (udb_Exists(nickname)) return false;
new fname[MAX_STRING];
format(fname,sizeof(fname),\"%s.dudb.sav\",udb_encode(nickname));
dini_Create(fname);
udb_UserSetInt(nickname,\"password_hash\",udb_hash(pwd));
return true;
}
DUtils
/*
* DUtils functions 1.8
* (c) Copyright 2006-2007 by DracoBlue
*
* @author : DracoBlue (http://dracoblue.com)
* @date : 8th April 2006
* @update : 3rd June. 2007
*
* This file is provided as is (no warranties).
*
*/
#if defined _dutils_included
#endinput
#endif
#define _dutils_included
#pragma library dutils
#define MAX_STRING 255
#if !defined floatstr
native Float:floatstr(const string[]);
#endif
#pragma tabsize 0
new PRIVATE_Last_Money[MAX_PLAYERS];
/*
* First version released by mike, this one created by DracoBlue
* Has also a fix to use \"-\" and \"+\" in the beginning of the number.
*/
stock isNumeric(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if (
(string > \'9\' || string < \'0\' && string!=\'-\' && string!=\'+\') // Not a number,\'+\' or \'-\'
|| (string==\'-\' && i!=0) // A \'-\' but not at first.
|| (string==\'+\' && i!=0) // A \'+\' but not at first.
) return false;
}
if (length==1 && (string[0]==\'-\' || string[0]==\'+\')) return false;
return true;
}
#pragma unused isNumeric
/*
* Originally created by mabako, tuned by DracoBlue
*/
stock mktime(hour,minute,second,day,month,year) {
new timestamp2;
timestamp2 = second + (minute * 60) + (hour * 3600);
new days_of_month[12];
if ( ((year % 4 == 0) && (year % 100 != 0))
|| (year % 400 == 0) ) {
days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31}; // Schaltjahr
} else {
days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31}; // keins
}
new days_this_year = 0;
days_this_year = day;
if(month > 1) { // No January Calculation, because its always the 0 past months
for(new i=0; i<month-1;i++) {
days_this_year += days_of_month;
}
}
timestamp2 += days_this_year * 86400;
for(new j=1970;j<year;j++) {
timestamp2 += 31536000;
if ( ((year % 4 == 0) && (year % 100 != 0))
|| (year % 400 == 0) ) timestamp2 += 86400; // Schaltjahr + 1 Tag
}
return timestamp2;
}
#pragma unused mktime
/**
* Return if a Email is valid or not
* @param value
*/
stock ValidEmail(email[]) {
new len=strlen(email);
new cstate=0;
new i;
for(i=0;i<len;i++) {
if ((cstate==0 || cstate==1) && (email>=\'A\' && email<=\'Z\') || (email>=\'a\' && email<=\'z\') || (email==\'.\') || (email==\'-\') || (email==\'_\'))
{
} else {
// Ok no A..Z,a..z,_,.,-
if ((cstate==0) &&(email==\'@\')) {
// its an @ after the name, ok state=1;
cstate=1;
} else {
// Its stuff which is not allowed
return false;
}
}
}
if (cstate<1) return false;
if (len<6) return false;
// A toplevel domain has only 3 to 4 signs :-)
if ((email[len-3]==\'.\') || (email[len-4]==\'.\') || (email[len-5]==\'.\')) return true;
return false;
}
#pragma unused ValidEmail
/**
* Return a timestamp
*/
stock Time() {
new hour,minute,second;
new year, month,day;
gettime(hour, minute, second);
getdate(year, month, day);
return mktime(hour,minute,second,day,month,year);
}
#pragma unused Time
/**
* Return a timestamp
*/
Now() {
new hour,minute,second;
new year, month,day;
gettime(hour, minute, second);
getdate(year, month, day);
return mktime(hour,minute,second,day,month,year);
}
#pragma unused Now
/**
* Return the value of an hex-string
* @param string
*/
HexToInt(string[]) {
if (string[0]==0) return 0;
new i;
new cur=1;
new res=0;
for (i=strlen(string);i>0;i--) {
if (string[i-1]<58) res=res+cur*(string[i-1]-48); else res=res+cur*(string[i-1]-65+10);
cur=cur*16;
}
return res;
}
#pragma unused HexToInt
/**
* Return the string as int
* @param string
*/
StrToInt(string[]) {
return strval(string);
}
#pragma unused StrToInt
/**
* Return the value as string
* @param value
*/
IntToStr(value) {
new tmp[MAX_STRING];
valstr(tmp, num);
return tmp;
}
#pragma unused IntToStr
/**
* Return the truncated value
* @param Float:value
*/
trunc(Float:value) {
return floatround(value,floatround_floor);
}
#pragma unused trunc
/**
* Sets money for player
* @param playerid
* howmuch
*/
SetPlayerMoney(playerid,howmuch) {
PRIVATE_Last_Money[playerid]=howmuch;
GivePlayerMoney(playerid,howmuch-GetPlayerMoney(playerid));
}
#pragma unused SetPlayerMoney
/**
* Copies a file (Source file won\'t be deleted!)
* @param oldname
* newname
* @requires WINDOWS
*/
fcopy(oldname[],newname[]) {
new File:ohnd,File:nhnd;
if (!fexist(oldname)) return false;
ohnd=fopen(oldname,io_read);
nhnd=fopen(newname,io_write);
new buf2[1];
new i;
for (i=flength(ohnd);i>0;i--) {
fputchar(nhnd, fgetchar(ohnd, buf2[0],false),false);
}
fclose(ohnd);
fclose(nhnd);
return true;
}
#pragma unused fcopy
/**
* Copies a textfile (Source file won\'t be deleted!)
* @param oldname
* newname
*/
fcopytextfile(oldname[],newname[]) {
new File:ohnd,File:nhnd;
if (!fexist(oldname)) return false;
ohnd=fopen(oldname,io_read);
nhnd=fopen(newname,io_write);
new tmpres[MAX_STRING];
while (fread(ohnd,tmpres)) {
StripNewLine(tmpres);
format(tmpres,sizeof(tmpres),\"%s\\r\\n\",tmpres);
fwrite(nhnd,tmpres);
}
fclose(ohnd);
fclose(nhnd);
return true;
}
#pragma unused fcopytextfile
/**
* Renames a file (Source file will be deleted!)
* @param oldname
* newname
* @requires WINDOWS (because fcopy does)
*/
frename(oldname[],newname[]) {
if (!fexist(oldname)) return false;
fremove(newname);
if (!fcopy(oldname,newname)) return false;
fremove(oldname);
return true;
}
#pragma unused frename
/**
* Strips Newline from the end of a string.
* Idea: Y_Less, Bugfixing (when length=1) by DracoBlue
* @param string
*/
stock StripNewLine(string[])
{
new len = strlen(string);
if (string[0]==0) return ;
if ((string[len - 1] == \'\\n\') || (string[len - 1] == \'\\r\'))
{
string[len - 1] = 0;
if (string[0]==0) return ;
if ((string[len - 2] == \'\\n\') || (string[len - 2] == \'\\r\')) string[len - 2] = 0;
}
}
#pragma unused StripNewLine
/**
* Copies items from one array/string into return.
* @param source
* index (where to start, 0 is first)
* numbytes (how much)
*/
ret_memcpy(source[],index=0,numbytes) {
new tmp[MAX_STRING];
new i=0;
tmp[0]=0;
if (index>=strlen(source)) return tmp;
if (numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
if (numbytes<=0) return tmp;
for (i=index;i<numbytes+index;i++) {
tmp[i-index]=source;
if (source==0) return tmp;
}
tmp[numbytes]=0;
return tmp;
}
#pragma unused ret_memcpy
/**
* Copies items from one array/string into another.
* @param dest
* source
* count
*/
stock copy(dest[],source[],count) {
dest[0]=0;
if (count<0) return false;
if (count>strlen(source)) count=strlen(source);
new i=0;
for (i=0;i<count;i++) {
dest=source;
if (source==0) return true;
}
dest[count]=0;
return true;
}
#pragma unused copy
/**
* Deletes the first \'count\' items of a array/string
* @param string[]
* count
*/
stock delete(string[],count) {
new tmp[MAX_STRING];
tmp[0]=0;
if (count<=0) {
format(tmp,sizeof(tmp),\"%s\",string);
return tmp;
}
tmp=ret_memcpy(string,count,strlen(string));
return tmp;
}
#pragma unused delete
/**
* Sets a string\'s value to source.
* @param dest
* source
* count
*/
stock set(dest[],source[]) {
new count = strlen(source);
new i=0;
for (i=0;i<count;i++) {
dest=source;
}
dest[count]=0;
}
#pragma unused set
/**
* Checks wether two strings are equal (case insensetive)
* @param str1
* str2
*/
stock equal(str1[],str2[],bool:ignorecase) {
if (strlen(str1)!=strlen(str2)) return false;
if (strcmp(str1,str2,ignorecase)==0) return true;
return false;
}
#pragma unused equal
/**
* Returns an element of a string splitted by \' \', default index is 0.
* @param string
* index
*/
strtok(const string[], &index,seperator=\' \')
{
new length = strlen(string);
new offset = index;
new result[MAX_STRING];
while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
if ((index < length) && (string[index] == seperator))
{
index++;
}
return result;
}
#pragma unused strtok
stock mod(up,down) {
return up-(floatround((up/down),floatround_floor))*down;
}
#pragma unused mod
stock div(up,down) {
return (floatround((up/down),floatround_floor));
}
#pragma unused div
/**
* Returns a hashed value in adler32 as int
* @param buf
*/
stock num_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
#pragma unused num_hash
/**
* Returns a hashed value in adler32 as string
* @param buf
*/
stock hash(str2[])
{
new tmpdasdsa[MAX_STRING];
tmpdasdsa[0]=0;
valstr(tmpdasdsa,num_hash(str2));
return tmpdasdsa;
}
#pragma unused hash
/**
* Returns a string which has \'newstr\' where \'trg\' was before
* @param trg
* newstr
* src
*/
strreplace(trg[],newstr[],src[]) {
new f=0;
new s1[MAX_STRING];
new tmp[MAX_STRING];
format(s1,sizeof(s1),\"%s\",src);
f = strfind(s1,trg);
tmp[0]=0;
while (f>=0)
{
strcat(tmp,ret_memcpy(s1, 0, f));
strcat(tmp,newstr);
format(s1,sizeof(s1),\"%s\",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
f = strfind(s1,trg);
}
strcat(tmp,s1);
return tmp;
}
#pragma unused strreplace
/**
* Returns the string with lowercase
* @param txt
*/
strlower(txt[]) {
new tmp[MAX_STRING];
tmp[0]=0;
if (txt[0]==0) return tmp;
new i=0;
for (i=0;i<strlen(txt);i++) {
tmp=tolower(txt);
}
tmp[strlen(txt)]=0;
return tmp;
}
#pragma unused strlower
/**
* Returns the string with uppercase
* @param txt
*/
strupper(txt[]) {
new tmp[MAX_STRING];
tmp[0]=0;
if (txt[0]==0) return tmp;
new i=0;
for (i=0;i<strlen(txt);i++) {
tmp=toupper(txt);
}
tmp[strlen(txt)]=0;
return tmp;
}
#pragma unused strupper