stock help
#1

stock :
Quote:

stock dini_Set(filename[],key[],value[]) {
new File:fohnd, File:fwhnd;
new bool:wasset=false;
new tmpres[MAX_STRING];
if (key[0]==0) return false; /* If we have no sign in key, it can't be set*/
format(tmpres,sizeof(tmpres),"%s.part",filename);
fohnd=fopen(filename,io_read);
if (!fohnd) return false;
fremove(tmpres);
fwhnd=fopen(tmpres,io_write);
// if (!fwhnd) return false;
while (fread(fohnd,tmpres)) {
StripNewLine(tmpres);
if ((!wasset)&&(equal(dini_PRIVATE_ExtractKey(tmpres) ,key,true))) {
/* We've got what needs to be replaced! */
format(tmpres,sizeof(tmpres),"%s=%s",key,value);
wasset=true;
}
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 (fcopytextfile(tmpres,filename)) {
return fremove(tmpres);
}
return false;
}

error : error 047: array sizes do not match, or destination array is too small
line : stock dini_Set(filename[],key[],value[]) {
Reply
#2

It's called a function, a FUNCTION!

https://sampforum.blast.hk/showthread.php?tid=50
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)