Dudb.inc Error?
#1

Hello people.

I have a small problem, and that I just edit my SCRIPT.
And if I then click "Compile" do I get the following error messages.
Код:
C: \ Documents and Settings \ lala \ Desktop \ SAMP localhost \ Test Server \ pawno \ include \ dudb.inc (48): error 017: undefined symbol "MAX_STRINGS"
C: \ Documents and Settings \ lala / Desktop \ SAMP localhost \ Test Server \ pawno \ include \ dudb.inc (48): error 009: invalid array size (negative, zero or out of bounds)
C: \ Documents and Settings \ lala \ Desktop \ SAMP localhost \ Test Server \ pawno \ include \ dudb.inc (48): error 036: empty statement
C: \ Documents and Settings \ lala \ Desktop \ SAMP localhost \ Test Server \ pawno \ include \ dudb.inc (48): fatal error 107: too many error messages on one line
My dudb.inc file looks like this:

Код:
/*
 *      DUDB functions
 *    © Copyright 2006-2007 by DracoBlue
 *
 * @version  : 2.4
 * @author  : DracoBlue (http://dracoblue.net)
 * @date   : 8th May 2006
 * @update  : 12th July 2007
 * @require  : DUtils 1.10
 * @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];   << 48
 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));
 new PasswordInFile = dini_Int(fname,"password_hash");
 if ( PasswordInFile == 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;
}

stock udb_RenameUser(nickname[],newnick[]) {
 new oldfname[MAX_STRING];
 new newfname[MAX_STRING];
 format(oldfname,sizeof(oldfname),"%s.dudb.sav",udb_encode(nickname));
 format(newfname,sizeof(newfname),"%s.dudb.sav",udb_encode(newnick));
 return frenametextfile(oldfname,newfname);
}
Where is the mistake?

And can someone give me a better dudb.inc file?
Perhaps that is last updated?
Reply
#2

Search for the Dudb topic in 'Scripting Discussions' And re-download it. If you still have a problem then it may be script side.
Reply
#3

I found only this topic:

http://forum.sa-mp.com/index.php?topic=117511.0

I have exchanged the dudb.inc file and it still does not work.
Reply
#4

Can who help me please?
Reply
#5

Quote:
Originally Posted by style100
Can who help me please?
we can but dont just ignore some usfull messages like an idiot . re-download and re-install dudb.inc , this is the link : DUDB 2.4, You will also need Dini and Dutils .
Reply
#6

Its going.
But i have the next Problem, can u give me now the Link too?
Код:
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(75) : error 021: symbol already defined: "strtok"
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(90) : error 047: array sizes do not match, or destination array is too small
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(134) : error 021: symbol already defined: "isNumeric"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#7

Quote:
Originally Posted by style100
Its going.
But i have the next Problem, can u give me now the Link too?
Код:
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(75) : error 021: symbol already defined: "strtok"
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(90) : error 047: array sizes do not match, or destination array is too small
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(134) : error 021: symbol already defined: "isNumeric"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
i see well redownload the samp sever files and reinstall include\gl_common.inc
Reply
#8

Before you end up in redownloading every single file not getting to any result:

Delete the strtok function once as it`s being defined two times. Same for "IsNumeric".
Reply
#9

It's unbelievable, but in the lines where the error should be unrelated to words?
So are the lines for me:

Код:
    stock strtok(const string[], &index)
    {            << 75
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;    << 90
}

//------------------------------------------------

stock strrest(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}
	new offset = index;
	new result[128];
	while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

//----------------------------------------------------------
// Tokenise by a delimiter
// Return string and index of the end determined by the
// provided delimiter in delim

stock token_by_delim(const string[], return_str[], delim, start_index)
{
	new x=0;
	while(string[start_index] != EOS && string[start_index] != delim) {
	  return_str[x] = string[start_index];
	  x++;
	  start_index++;
	}
	return_str[x] = EOS;
	if(string[start_index] == EOS) start_index = (-1);
	return start_index;
}

//----------------------------------------------------------

stock isNumeric(const string[])
{ << 134
When I delete and then strtok isNumeric crashes Pawno completely.
Reply
#10

Код:
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(75) : error 021: symbol already defined: "strtok"
C:\Dokumente und Einstellungen\lala\Desktop\SAMP Localhost\Test Server\pawno\include\gl_common.inc(134) : error 021: symbol already defined: "isNumeric"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
You have defined two times in your script , thats why its giving u these errors. Just remove it from it 1 time from somewhere.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)