SA-MP Forums Archive
[Tutorial] [TUT] Creating a Register System using Dini - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] [TUT] Creating a Register System using Dini (/showthread.php?tid=101560)

Pages: 1 2 3 4


Re: [TUT] Creating a Register System using Dini - PotH3Ad - 28.12.2009

Quote:
Originally Posted by dirkblok
Hey,

How can I make it save the money when the player disconnects?

Thanks
Add this under OnPlayerDisconnect:

Code:
dini_IntSet(file,"Cash", GetPlayerMoney(playerid));
Quote:
Originally Posted by Lajko1
fixed i just wanna ask you , how i can make when player chose skin in class selection like example : skin 50 it will save to script files , and when he go offline and later come back he will have same skin 50 when he login ? how to do this ? like in crazy bob server , i hope you can help , ty
Add "Skin" in the enum pInfo.

Under the /login cmd add:

Code:
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
Add this under OnPlayerSpawn:

Code:
dini_IntSet(file,"Skin", GetPlayerSkin(playerid));



Re: [TUT] Creating a Register System using Dini - Eazy_Efolife - 04.01.2010

Post at the script.request thread


Re: [TUT] Creating a Register System using Dini - Nakki - 11.01.2010

Where i add that
Code:
enum pInfo
{

}
new PlayerInfo[MAX_PLAYERS][pInfo];
?


Re: [TUT] Creating a Register System using Dini - [DK]JaloNik - 14.07.2010

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
Usefull for newbies like me!
ftw!!!!!


Re: [TUT] Creating a Register System using Dini - sorfa - 15.07.2010

Hy, this is very good tutorial...But i have one one warning.
Here he is:
Код:
C:\Users\SARMA\Desktop\Sarma's RolePlay\gamemodes\Sarma'sRolePlay.pwn(299) : warning 203: symbol is never used: "strtok"
Pls Help....

Sorry on my bad English..


Re: [TUT] Creating a Register System using Dini - [DK]JaloNik - 15.07.2010

Quote:
Originally Posted by sorfa
Посмотреть сообщение
Hy, this is very good tutorial...But i have one one warning.
Here he is:
Код:
C:\Users\SARMA\Desktop\Sarma's RolePlay\gamemodes\Sarma'sRolePlay.pwn(299) : warning 203: symbol is never used: "strtok"
Pls Help....

Sorry on my bad English..
You can just ignore this lol. It just says that the symbol strtok isn't in use.


Re: [TUT] Creating a Register System using Dini - sorfa - 15.07.2010

Tnx...But i fix it...


Re: [TUT] Creating a Register System using Dini - Anthonyx3' - 24.08.2010

what is eadmin


Re: [TUT] Creating a Register System using Dini - R@ger - 24.08.2010

Quote:
Originally Posted by Anthony[Gl-RP]
View Post
what is eadmin
its a defined color in this tutorial


Re: [TUT] Creating a Register System using Dini - r3k1lLz_ - 07.09.2010

Can someone post a script with this finished because I kept getting all these errors


Re: [TUT] Creating a Register System using Dini - Guest3598475934857938411 - 02.10.2010

Here it had some erros but maneged to fix em as always....

If anyone had some errors just coppy this
pawn Code:
#include <a_samp>
#include <dini>
#include <dudb>
#define COLOR 0xFFFF00AA
#pragma unused ret_memcpy
#define eadmin 0x33660000


//------------------------
new IsLogged[MAX_PLAYERS];

enum pInfo
{
    AdminLevel,
         Cash,
}

new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerDisconnect(playerid, reason)
{
IsLogged[playerid] = 0;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256], idx, file[128], tmp[256], tmp2[256];
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/register", true) == 0)
    {
        new name[MAX_PLAYER_NAME];
        tmp = strtok(cmdtext, idx);
        GetPlayerName(playerid, name, sizeof(name));
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
        format(file,sizeof(file),"%s.ini",name);
        if(!fexist(file))
            {
                dini_Create(file);
                dini_IntSet(file, "Password", udb_hash(tmp));
                dini_IntSet(file,"AdminLevel", 0);
                dini_IntSet(file,"Cash", 0);
                SendClientMessage(playerid, eadmin, "[System]: Account Created!");
                PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                GetPlayerName(playerid, name, sizeof(name));
                printf("%s has registered a account!", name);
            }
            else
            {
                SendClientMessage(playerid, COLOR, " Account Already Found In Database");
                PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            }
        return 1;
    }

    if(strcmp(cmd, "/login", true) == 0)
    {
        new PlayerName[24];
        tmp = strtok(cmdtext, idx);
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /login [password]");
        new name[MAX_PLAYER_NAME];
        if(IsLogged[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR, "You already are logged in!");
            return 1;
        }
        else
        {
            GetPlayerName(playerid, name, sizeof(name));
            format(file,sizeof(file),"%s.ini",name);
            if(fexist(file))
            {
                tmp2 = dini_Get(file, "Password");
                if(udb_hash(tmp) != strval(tmp2))
                {
                    SendClientMessage(playerid, COLOR, "Login Failed!");
                    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                    printf("%s has failed to login", name);
                }
                else
                {
                    IsLogged[playerid] = 1;
                    SetPlayerMoney(playerid, dini_Int(file, "Cash"));
                    PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
                    SendClientMessage(playerid, COLOR, "[System]: Account Logged into!");
                }
            }
        }
        return 1;
        }
    return 0;
    }



Re: [TUT] Creating a Register System using Dini - karakana7 - 31.10.2010

So for what is these variables in the code, what they doing?
Code:
new cmd[256], idx, file[128], tmp[256], tmp2[256];
cmd = strtok(cmdtext, idx);



Re: [TUT] Creating a Register System using Dini - Rabbayazza - 10.08.2011

if(gLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR, "SERVER: You have not logged in yet.");
Kick(playerid);
return 1;
}

Where does this go?


Re: [TUT] Creating a Register System using Dini - Kush - 10.08.2011

Quote:
Originally Posted by Rabbayazza
View Post
if(gLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR, "SERVER: You have not logged in yet.");
Kick(playerid);
return 1;
}

Where does this go?
Did you really bring this thread back to life? It was dead last year, and so was dini.


Re: [TUT] Creating a Register System using Dini - Rabbayazza - 10.08.2011

Well as you can probably see from my post count, I don't know anything about scripting, so tell me where it goes please.


Re: [TUT] Creating a Register System using Dini - rooney12 - 10.08.2011

This helped me alot!! Thanks

Oh, i hate this lol
This forum requires that you wait 120 seconds between posts. Please try again in 100 seconds.


Re: [TUT] Creating a Register System using Dini - Darnell - 13.08.2011

Quote:

C:\gamemodes\1stDM.pwn(701) : error 017: undefined symbol "tmp"
C:\gamemodes\1stDM.pwn(701) : error 017: undefined symbol "cmdtext"
C:\gamemodes\1stDM.pwn(703) : error 017: undefined symbol "tmp"
C:\gamemodes\1stDM.pwn(704) : error 017: undefined symbol "file"
C:\gamemodes\1stDM.pwn(704) : error 017: undefined symbol "file"

I just converted the commands to ZCMD >.<...god dammit, lol.


Re: [TUT] Creating a Register System using Dini - Shockey HD - 13.08.2011

Quote:
Originally Posted by Darnell
View Post
I just converted the commands to ZCMD >.<...god dammit, lol.
I suggest using Y_INI. This is an outdated tutorial.

Also, You should use SSCANF.


Re: [TUT] Creating a Register System using Dini - Darnell - 13.08.2011

Uhm, so, dini_Int is INI_Int if I'm going to use Y_Ini, for example ?


Re: [TUT] Creating a Register System using Dini - Kaperstone - 13.08.2011

i get this error:
Code:
error 017: undefined symbol "file"
what should i do?