[Include] [DUDB] Userdatabase Management (Version 2.4, 4th July) // 0.2#Ready
#21

Код:
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2010) : error 021: symbol already defined: "strtok"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2025) : error 047: array sizes do not match, or destination array is too small
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "fcopy"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "frename"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "strlower"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "strupper"
Pawn compiler 3.0.3367			Copyright © 1997-2005, ITB CompuPhase


2 Errors.
I have istalled dutils and i get this error and after installing dudb i get this error too. what do i wrong?
Sorry for my english i hope you understand me
Reply
#22

Quote:
Originally Posted by Jaanis
I got a problem when I tried to add a few more lines to save and read spawn coords. I changed the code in the Load script to

Код:
 new Float:pos[512];
 pos = strtok(tmpres,i,';');

 pwd_hash=strval(pos[0]);
 acc_state=strval(pos[1]);
 set(clantag,pos[2]);

 set(spawnCoords[PlayerId(nickname)][0],pos[3]);
 set(spawnCoords[PlayerId(nickname)][1],pos[4]);
 set(spawnCoords[PlayerId(nickname)][2],pos[5]);
Код:
 new Float:pos[512];
 pos = strtok(tmpres,i,';');

 pwd_hash=strval(pos); pos = strtok(tmpres,i,';');
 acc_state=strval(pos);  pos = strtok(tmpres,i,';');
 set(clantag,pos);  pos = strtok(tmpres,i,';');

 spawnCoords[PlayerId(nickname)][0]=floatstr(pos);  pos = strtok(tmpres,i,';');
 spawnCoords[PlayerId(nickname)][1]=floatstr(pos);  pos = strtok(tmpres,i,';');
 spawnCoords[PlayerId(nickname)][2]=floatstr(pos);
This should work.



Quote:
Originally Posted by Wirrkopf
Код:
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2010) : error 021: symbol already defined: "strtok"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2025) : error 047: array sizes do not match, or destination array is too small
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "fcopy"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "frename"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "strlower"
C:\Dokumente und Einstellungen\Wirrkopf\Desktop\samp01b-server\gamemodes\src\lvdmod.pwn(2041) : warning 203: symbol is never used: "strupper"
Pawn compiler 3.0.3367			Copyright © 1997-2005, ITB CompuPhase


2 Errors.
I have istalled dutils and i get this error and after installing dudb i get this error too. what do i wrong?
Sorry for my english i hope you understand me
delete the strtok from the lvdmod.pwn.
Reply
#23

Updated to version 1.2.

Now all usernames should work without problems.
Reply
#24

Quote:
Originally Posted by FeaR
Hei Draco, i dont want to make another subject about this, so i hope u dont mind if i pm'd u my question..

The dudb is working like a charm, but the coordinates are not, im making this when a player is logged in and disconnects is saves his coordinates, and loads them on login:

***Disconnect part***
new Float;
new Float:y;
new Float:z;

udb_SetPosition(udb_encode(playername),GetPlayerPo s(playerid, x, y, z));

***login part***
SetPlayerPos(playerid, udb_getPosition(udb_encode(playername)));

***errors***
H:\SASERV~1\MOSTWA~1\mw.pwn(2852) : warning 202: number of arguments does not match definition
H:\SASERV~1\MOSTWA~1\mw.pwn(2852) : warning 202: number of arguments does not match definition

As u can see the login has only the coordinate x.
Am i saving wrong, or loading wrong?
U mind giving me a hand on this?

Thanks in advance, greetings FeaR.
Hello FeaR!

This is what should be in OnPlayerDisconnect(playerid):
pawn Код:
new Float:x;
new Float:y;
new Float:z;
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
GetPlayerPos(playerid, x, y, z);
udb_SetPosition(playername,x,y,z);
Because if you call GetPlayerPos the value is stored into the paramters NOT returned.


On the login part you should use this:
pawn Код:
new Float:x;
new Float:y;
new Float:z;
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
udb_getPosition(playername,x,y,z);
SetPlayerPos(playerid, x,y,z);
This is how the correct login/logoff should work.
Anyways please show how you implemented udb_getPosition and udb_SetPosition, because seems like they are broken, too.

Regrads,
Jan (DracoBlue)
Reply
#25

Thanks for the help draco
Reply
#26

Quote:
Originally Posted by FeaR
pawn Код:
public udb_getPosition(nickname[]) {
 new pwd_hash,acc_state,lvl,money,banks,position,kills,deaths,suicides,jail,mute,clantag[MAX_STRING];
 if (udb_Load(nickname,pwd_hash,acc_state,lvl,money,banks,position,kills,deaths,suicides,jail,mute,clantag)) return position;
 return 0;
}

public udb_SetPosition(nickname[],new_position) {
 new pwd_hash,acc_state,lvl,money,banks,position,kills,deaths,suicides,jail,mute,clantag[MAX_STRING];
 if (udb_Load(nickname,pwd_hash,acc_state,lvl,money,banks,position,kills,deaths,suicides,jail,mute,clantag)) {
   udb_Save(nickname,pwd_hash,acc_state,lvl,money,banks,new_position,kills,deaths,suicides,jail,mute,clantag);
     return true;
  }
 return false;
}
thats how they look like in DUDB..
Yeah, but you want to save/read 3 floats extra.

Change this in your public udb_Create(nickname[],pwd[],acc_state,clantag[],Float,Float:y,Float:z)

Replace
pawn Код:
public udb_Create(nickname[],pwd[],acc_state,clantag[])
pawn Код:
public udb_Create(nickname[],pwd[],acc_state,clantag[],Float:x,Float:y,Float:z)
Replace
pawn Код:
udb_Save(nickname,udb_hash(pwd),acc_state,clantag);
pawn Код:
udb_Save(nickname,udb_hash(pwd),acc_state,clantag,x,y,z);

Change this in your public udb_Save(nickname[],pwd_hash,acc_state,clantag[])

Replace
pawn Код:
udb_Save(nickname[],pwd_hash,acc_state,clantag[])
pawn Код:
udb_Save(nickname[],pwd_hash,acc_state,clantag[],Float:x,Float:y,Float:z)
Replace
pawn Код:
strcat(tmpres,clantag);
pawn Код:
strcat(tmpres,clantag);
 format(tmpres,sizeof(tmpres),"%s;%f;%f;%f",tmpres,x,y,z);

Change public udb_Load(nickname[],&pwd_hash,&acc_state,clantag[])

Replace
pawn Код:
public udb_Load(nickname[],&pwd_hash,&acc_state,clantag[]) {
pawn Код:
public udb_Load(nickname[],&pwd_hash,&acc_state,clantag[],&Float:x,&Float:y.&Float:z)
Replace
pawn Код:
set(clantag,strtok(tmpres,i,';'));
pawn Код:
set(clantag,strtok(tmpres,i,';'));
 x=floatstr(strtok(tmpres,i,';'));
 y=floatstr(strtok(tmpres,i,';'));
 z=floatstr(strtok(tmpres,i,';'));

Change every(!)
pawn Код:
new pwd_hash,acc_state,clantag[MAX_STRING];
 if (udb_Load(nickname,pwd_hash,acc_state,clantag))
pawn Код:
new pwd_hash,acc_state,clantag[MAX_STRING],Float:x,Float:y,Float:z;
 if (udb_Load(nickname,pwd_hash,acc_state,clantag,x,y,z))
Change in all old setMethods:
pawn Код:
udb_Save(nickname,new_pwdhash,acc_state,clantag);
pawn Код:
udb_Save(nickname,new_pwdhash,acc_state,clantag,x,y,z);
pawn Код:
udb_Save(nickname,pwd_hash,new_acc_state,clantag);
pawn Код:
udb_Save(nickname,pwd_hash,new_acc_state,clantag,x,y,z);
pawn Код:
udb_Save(nickname,pwd_hash,acc_state,new_clantag);
pawn Код:
udb_Save(nickname,pwd_hash,acc_state,new_clantag,x,y,z);



Add the new getFunction:
pawn Код:
public udb_getPosition(nickname[],&Float:x,&Float:y,&Float:z) {
 new pwd_hash,acc_state,clantag[MAX_STRING];
 if (udb_Load(nickname,pwd_hash,acc_state,clantag,x,y,z)) return true;
 return false;
}
Add the new setFunction:
pawn Код:
public udb_setPosition(nickname[],Float:new_x,Float:new_y,Float:new_z) {
 new pwd_hash,acc_state,clantag[MAX_STRING].Float:x,Float:y,Float:z;
 if (udb_Load(nickname,pwd_hash,acc_state,clantag,x,y,z)) {
   udb_Save(nickname,pwd_hash,acc_state,new_clantag,new_x,new_y,new_z);
     return true;
  }
 return false;
}
Thats it!

Regrads,
Jan (DracoBlue)
Reply
#27

error
Код:
C:\Documents and Settings\Patrick\Desktop\samp01b-server\gamemodes\src\dm.pwn(186) : error 017: undefined symbol "udb_getPosition"
the code
Код:
#include <dutils>
#include <DUDB>
....................
....................
public OnPlayerDisconnect(playerid)
{
	printf("OnPlayerDisconnect(%d)", playerid);
	new Float:x;
	new Float:y;
	new Float:z;
	new playername[256];
	GetPlayerName(playerid,playername,sizeof(playername));
	udb_getPosition(playername,x,y,z);
	SetPlayerPos(playerid, x,y,z);
	return 1;
}
sorry if i have completly lost the point im a n00b
as we all know
Reply
#28

2DracoBlue i think getpos should return a coord, otherwise if it return just "true", we don't get anything useful from it, right?
Reply
#29

@ Bigpaddy

I think the solution is on the upper post
Reply
#30

This should work:
pawn Код:
return SystemMsg(playerid,"Successfully authed!");
  } else {
    // Login was incorrect
    return SystemMsg(playerid,"Login failed!");
  }
 }
Reply
#31

no erros and warnings now,but 2 other problems(i cant spawn and if try /register password then the server shows up that the command is unknown).
Reply
#32

Quote:
Originally Posted by GanG$Ta
no erros and warnings now,but 2 other problems(i cant spawn and if try /register password then the server shows up that the command is unknown).
Are you sure that your /register is implemented correctly? Maybe you could show us the /register again here?

Kind regards,
Jan (DracoBlue)
Reply
#33

http://pastebin.ca/558598

//edit: spawning works now but the register command still didnt works here is the new script: http://pastebin.ca/561516

//edit2: should can someone give me a script just with the register and loginsystem?maybe then it works.
Reply
#34

i know how to save things like health position etc but how would i save something thats words not number, i want to do /name [name] and it saves the [name] bit of the command to DUDB file like name=[name]
so i know i need
Код:
dcmd(name,4,cmdtext);
then
Код:
dcmd_name(playerid, params[])
and something that starts with
Код:
dUserSetINT(PlayerName(playerid)).("name",
but then what? thanks
Reply
#35

When i insert code :

#include <dutils>
#include <dudb>

i get this :

D:\GTA_San_Andreas\samp\gamemodes\rpglm.pwn(962) : error 021: symbol already defined: "strtok"
D:\GTA_San_Andreas\samp\gamemodes\rpglm.pwn(977) : error 047: array sizes do not match, or destination array is too small
D:\GTA_San_Andreas\samp\gamemodes\rpglm.pwn(981) : warning 203: symbol is never used: "ret_memcpy"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#36

what i need to fix?
Reply
#37

removed the strtok definition from your gamemode. Its already defined in dutils!
Reply
#38

Dude i get the same error every time "Cannot Find BUDB" What should i do?
Reply
#39

did u put DUDB in you pawno/include folder?
Reply
#40

What do i look stupid?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)