SA-MP Forums Archive
[Tutorial] Login/Register system [YINI+Whirlpool] - 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] Login/Register system [YINI+Whirlpool] (/showthread.php?tid=352703)

Pages: 1 2 3


Re: Login/Register system [YINI+Whirlpool] - Ukko - 24.06.2012

Quote:
Originally Posted by newbienoob
View Post
Try change this
Code:
loadaccount_%s
//to 
loadaccount_user
Ok, works great now but could you answer my 2nd question?
Quote:

How do I check if player is VIP or not onplayerspawn?




Re: Login/Register system [YINI+Whirlpool] - Littlehelper - 24.06.2012

Code:
public OnPlayerSpawn(playerid)
{
if(/* VIP Variable Here*/ > 1)
{
SendClientMessage(playerid,-1,"You Are VIP");
}
return 1;
}
Like this.


Re: Login/Register system [YINI+Whirlpool] - newbienoob - 24.06.2012

Quote:
Originally Posted by Ukko
View Post
Ok, works great now but could you answer my 2nd question?
If your server is using only 1 VIP level then use this
Code:
if(pInfo[playerid][VIPlevel] == 1)
{
//do something here
}
If your server has more VIP level use this
Code:
if(pInfo[playerid][VIPlevel] >= 1) // If their VIP level is 1 or higher
{//then
//do something here
}



Re: Login/Register system [YINI+Whirlpool] - CoDeZ - 04.07.2012

Thanks for your tutorial
Code:
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
Can you please explain the bExtra part?


Re: Login/Register system [YINI+Whirlpool] - Avi57 - 04.07.2012

every time i log in it says : register !


Re: Login/Register system [YINI+Whirlpool] - Jonny5 - 04.07.2012

Quote:
Originally Posted by CoDeZ
View Post
Thanks for your tutorial
Code:
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
Can you please explain the bExtra part?
.bExtra = true

is allowing the passing of the arg ".extra"
which in this case pass's the players id

Code:
public loadaccount_user(playerid, name[], value[])
without bExtra= true
i THINK it would call the functions like this
Code:
public loadaccount_user( name[], value[])
which in this case you need the extra playerid param for the sake of this tutorial.
hope that clears it up

you can find more info in the y_ini thread.


Re: Login/Register system [YINI+Whirlpool] - misho1 - 15.07.2012

It Won't To Save The Kills And Deaths


Re: Login/Register system [YINI+Whirlpool] - $$inSane - 19.07.2012

good work newbienoob, it helped me alot


Re: Re : Login/Register system [YINI+Whirlpool] - FireCat - 27.07.2012

Quote:
Originally Posted by yusei
View Post
thanks work 100/100
STOP GOING IN ALL TUTORIALS SAYING THANKS!


Re: Login/Register system [YINI+Whirlpool] - mwoww77 - 08.08.2012

It doesnt set the players money and scored to what I set it too, please help


Re: Login/Register system [YINI+Whirlpool] - Weaselpwns - 12.08.2012

Hello, i got some problems..


C:\Users\Weaselpwns\Desktop\TL-RP.pwn(123) : error 017: undefined symbol "Path"
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(125) : error 017: undefined symbol "Path"
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(140) : error 017: undefined symbol "Path"
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(142) : error 017: undefined symbol "Path"
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(144) : error 017: undefined symbol "pInfo"
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(144) : warning 215: expression has no effect
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(144) : error 001: expected token: ";", but found "]"
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(144) : error 029: invalid expression, assumed zero
C:\Users\Weaselpwns\Desktop\TL-RP.pwn(144) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.


Re: Login/Register system [YINI+Whirlpool] - Weaselpwns - 12.08.2012

Codes where it went wrong:

Code:
public OnPlayerDisconnect(playerid, reason)
{
    //Same as OnDialogResponse, we will save their stats inside of their user's account
    if(fexist(Path(playerid)))//Will check if the file is exit or not inside of User's folder that we have created.
    {
        new INI:file = INI_Open(Path(playerid)); //will open their file
        INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
        INI_Close(file);//Now after we've done saving their data, we now need to close the file
        return 1;
    }
    return 1;
}
Code:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
    GetPlayerName(playerid,name,sizeof(name)); //Get player's name
    if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
    {// then
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
        ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login Mate","Welcome back to Thug Life RolePlay!. This account is registered. \nInsert your password to login to your account","Login","Quit :(");/*A dialog with input style will appear so you can insert your password to login.*/
    }
    else //If the connected user is not registered,
    {//then we will 'force' him to register :)
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register Mate","Welcome to Thug Life RolePlay! This account is not registered.\nEnter your own password to create a new account.","Register","Quit :(");
        return 1;
    }
    return 1;
}



Re: Login/Register system [YINI+Whirlpool] - sidney123 - 15.08.2012

I do have a important problem here - I am busy creating a DM server, with an scratch made administration system, and when other users create an account, they get my admin level, my deaths and my kills. It's exactly the same, except for the hased password. I already changed loadaccount_%s to loadaccount_user, and I can't find the problem in the script.


Re: Login/Register system [YINI+Whirlpool] - PaYkOK - 17.08.2012

When i log in , it writes normal , but when i make changes in the .ini file it writes again when i relog . example :
Code:
[Info]
Pass = (THE LONG HASH CODE)
Administrator = 2
Donator = 1
Money = 1000
Kills = 0
deaths = 0
[Info]
Administrator = 2
Donator = 1
Money = 1000
Kills = 0
Deaths = 0



Re: Login/Register system [YINI+Whirlpool] - MarkoN - 21.08.2012

Quote:
Originally Posted by sidney123
View Post
I do have a important problem here - I am busy creating a DM server, with an scratch made administration system, and when other users create an account, they get my admin level, my deaths and my kills. It's exactly the same, except for the hased password. I already changed loadaccount_%s to loadaccount_user, and I can't find the problem in the script.
use on player connect
pInfo[playerid][Admin] = 0;
pInfo[playerid][Kills] = 0;
etc.


Re: Login/Register system [YINI+Whirlpool] - Glint - 05.09.2012

Why don't you use switches under OnDialogResponse.


Re: Login/Register system [YINI+Whirlpool] - Gangster-rocks - 17.09.2012

Quote:
Originally Posted by misho1
View Post
It Won't To Save The Kills And Deaths
u need this
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        pInfo[killerid][Kills] += 1;
    }
    pInfo[playerid][Deaths] += 1;
    return 1;
}



Re: Login/Register system [YINI+Whirlpool] - Qu3esL - 17.09.2012

nice tutorial


Re: Login/Register system [YINI+Whirlpool] - basse - 30.09.2012

i made this to an Filterscript but the dialog never shows


Re: Login/Register system [YINI+Whirlpool] - newbienoob - 30.09.2012

Quote:
Originally Posted by basse
View Post
i made this to an Filterscript but the dialog never shows
Show me your OnPlayerConnect