I have a little problem
#1

Can someone help me, I have some problems at dudb functions.
It's a Driving License System.

pawn Код:
#include <a_samp>
#include <dudb>
#include <Dini>
#include <dutils>

new PlayerName[MAX_PLAYER_NAME];

pawn Код:
public OnPlayerConnect(playerid)
{
    new formatZ[256];
        new pName[MAX_PLAYER_NAME];
    new string[48];

    format(formatZ,sizeof(formatZ),"%s.txt",PlayerName(playerid));
    if(!udb_Exists(formatZ))
    {
        udb_Create(formatZ,"209010");
    }
    License[playerid] = dUserINT(formatZ).("License");
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new formatZ2[256];
    new p[MAX_PLAYER_NAME];
        new string[56];
        format(formatZ2,sizeof(formatZ2),"%s.txt",PlayerName(playerid));
    dUserSetINT(formatZ2).("License",License[playerid]);
    return 1;
}
pawn Код:
C:\Documents and Settings\Eduarth\Desktop\pp.pwn(54) : error 012: invalid function call, not a valid address
C:\Documents and Settings\Eduarth\Desktop\pp.pwn(54) : warning 215: expression has no effect
C:\Documents and Settings\Eduarth\Desktop\pp.pwn(54) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Eduarth\Desktop\pp.pwn(54) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Eduarth\Desktop\pp.pwn(54) : fatal error 107: too many error messages on one line
Reply
#2

pawn Код:
dUserSetINT(formatZ2).("License",License[playerid]);
What does that "." mean?
Reply
#3

Quote:
Originally Posted by GangsTa_
Посмотреть сообщение
pawn Код:
dUserSetINT(formatZ2).("License",License[playerid]);
What does that "." mean?
pawn Код:
#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;
}

pawn Код:
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;
}
This is from dudb file.

That "." is described in the tutorial: https://sampforum.blast.hk/showthread.php?tid=132
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)