[GameMode] TBase para GameModes using Djson
#1



Informaзхes do Sistema:

Bem a algum tempo conheci o DJSON e resolvi criar uma base para GameModes usando essa estrutura.

Й um simples sistema de Registro, vocк pode adicionar suas vontades.

Necessario:

• Criar a pasta "Contas" nos scriptfiles:

• Include DJson: link abaixo...

Screens:

Exemplo de um arquivo usando DJson:

PrintScreen do login:

Creditos:

THE_FALLEN, Dr._.THE e [LF]Player.

Mamгe eu quero mamar!
Reply
#2

parece ser bom, vou baixar
pra ver ja dou edit
Reply
#3

Nao precisa , й so compilar com seu compilador de qualquer versao do samp . (0.3)
Reply
#4

Legal, Ficou bom para base com o sistema de registro parabens
Reply
#5

nem conheзo esse djson mas parece ser bem confuso... mas ficou legal
Reply
#6

djson й o diniІ eu considero um dos melhores. й como voce poder criar uma pasta dentro do arquivo *.json

nesse sistema eu fiz assim: Player/Senhas/senhadecript e Player/Senhas/senhaencript
Reply
#7

Parece muito bom parabйns !
Reply
#8

Ficou legal Daniela,
Obrigado por colocar meus creditos '-'
Reply
#9

Quote:
Originally Posted by THE_FALLEN
View Post
djson й o diniІ eu considero um dos melhores. й como voce poder criar uma pasta dentro do arquivo *.json

nesse sistema eu fiz assim: Player/Senhas/senhadecript e Player/Senhas/senhaencript
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSA

djson й o diniІ

Reply
#10

Quote:
Originally Posted by Stewie`
View Post
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSA

djson й o diniІ

O senhor estб fumando maconha?


Quote:
Originally Posted by DracoBlue
View Post
DJson
Version 1.6.2 (Changelog)
Dini got downloaded nearly 15.000 already! Big thank you to everyone trusting in it!

Today I want to publish the next level of saving data to files. DJson is the library to save more then just little text-strings to files. It contains a cache to make your advanced gamemodes faster, it contains objects/arrays and a transaction based environment (djAutocommit) to override all speed/space/structure limits of dini. With approx 1.700 lines of code its, way bigger then the 250loc dini .


And last but not least: Its published under MIT-License. Use it, love it, hack it, sell it!

I really hope and want to keep what most of you connect with my releases: reliable code! This library walked through massive api tests and technical proofs, so it should work as expectd. Please report if you got any issues, so all others have benefit, too!

Download
Latest Version of DJson is 1.6.2 and can be found at the Download-Area of DracoBlue.net (djson_1_6_2.zip).

Why Djson?
  • Fast: DJson uses a database for caching purpose. So you can easily access the whole filesystem, read/write data, because they are already in the memory! Take a look at djAutocommit if you want to use the full power!
  • Secure: You can use anything but "/" parts of the keys, so save whatever you want - no incompatibilites here! Files are saved, as soon as the whole data is in the cache, so you won't lose any data, even if you turn of the computer while adding data! (Att: This does not count for the final commit, but it's pretty fast, though )
  • Unlimited (512 chars) structured items for paths and content: In djson you can use pathes, like this/is/a/very/long/......./path/up/to/512/characters. In djson you can use so much content as you want, just properly update the DJSON_MAX_STRING, if 512 is still not enough! And of course this limit counts for every single item, so player/vehicle can have unlimited amount of subitems, with again 512 characters!
    • DJSON_MAX_STRING should be at least 170 + maxfilenamelength + maxkeylength + maxvaluelength
  • Files: A reason why to use djson is of course, that the data is saved to files! Since djson uses the JSON-standard, you may use JavaScript, PHP, Flash, Java, ... and so on, to read the data!
  • Arrays/Objects: In DJson you can use objects (hashtables) and arrays (lists) with values, which can be nested as deep as you want. The arrays have some sweet extra functionality, like for example the djCount and the djAppend, which allows you to work with that items, like a general list in any other programming language - and it's all saved!
  • Compatible: Since JSON is a standard, you may use (edit/read) the produced files with PHP/Flash/JavaScript/Java/C# and create for example an online map (see dmap), with nearly no effort!
References
- Official DJson-Page
- Examples
- Function List
- Tweaking DJson
- DJson-Blog in my DevDiary

Tutorials
- Register/Login System Using DJson
- Why not use ONE big file for all user data

Known Issues
- Writing strings with unescaped " does not work! You have to replace " with \" first! This will be fixed in future versions.

Usage
I added a small test-script, called stats.pwn to the release, which counts server restarts and player-connect/deaths.

And since I know, most of you guys are too lazy to read the entire API-Documentation at http://dracoblue.net/djson , here comes a quick and dirty script:
Includes!
pawn Code:
#include <a_samp>
#include <djson>
main() {
}
Register the callbacks:
pawn Code:
public OnGameModeInit() {
    djson_GameModeInit(); // <-- this must be called _before_ you can use any djson function!!
   
    djSetInt("stats.json","server/started",djInt("stats.json","server/started")+1);

    printf("Server starts: %d",djInt("stats.json","server/started"));
   
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit() {
    djson_GameModeExit(); // <-- when you exit the gamemode, after that you can't run any djson function anymore!
    return 1;
}
And now some counting:
pawn Code:
public OnPlayerRequestClass(playerid, classid) {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid) {
    djSetInt("stats.json","players/connected",djInt("stats.json","players/connected")+1);
    return 1;
}

public OnPlayerSpawn(playerid) {
    djSetInt("stats.json","players/spawned",djInt("stats.json","players/spawned")+1);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason) {
    djSetInt("stats.json","players/died",djInt("stats.json","players/died")+1);
    return 1;
}
Have fun coding,
Jan (DracoBlue)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)