SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Closed Thread
 
Thread Tools Display Modes
Old 15/08/2010, 11:28 AM   #11
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1177
Default Re: How to make a register system - DIALOG

Quote:
Originally Posted by Hiddos View Post
Have you created the "myserver" directory in your scriptfiles folder?
Yus just wat i was gunna say
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline  
Old 15/08/2010, 02:32 PM   #12
Hor1z0n
Big Clucker
 
Join Date: May 2009
Posts: 120
Reputation: 1
Default Re: How to make a register system - DIALOG

yes,i created the directory
Hor1z0n is offline  
Old 16/08/2010, 11:07 AM   #13
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1177
Default Re: How to make a register system - DIALOG

Ok, try
pawn Code:
if(dini_Exists(file))
instead of your current. If it dont work idk because it does for me..
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline  
Old 16/08/2010, 11:39 AM   #14
Retardedwolf
High-roller
 
Retardedwolf's Avatar
 
Join Date: Jun 2009
Posts: 1,466
Reputation: 60
Default Re: How to make a register system - DIALOG

It woulda crashed when he tried to save a file in a incorrect directory.
Retardedwolf is offline  
Old 16/08/2010, 12:28 PM   #15
Hor1z0n
Big Clucker
 
Join Date: May 2009
Posts: 120
Reputation: 1
Default Re: How to make a register system - DIALOG

Quote:
Originally Posted by Lorenc_ View Post
Ok, try
pawn Code:
if(dini_Exists(file))
instead of your current. If it dont work idk because it does for me..
where to put that code
Hor1z0n is offline  
Old 18/08/2010, 10:31 AM   #16
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1177
Default Re: How to make a register system - DIALOG

Quote:
Originally Posted by Hor1z0n View Post
where to put that code
Onplayerdisconnect. Replace it with gPlayerLogged
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline  
Old 18/08/2010, 12:01 PM   #17
Hor1z0n
Big Clucker
 
Join Date: May 2009
Posts: 120
Reputation: 1
Default Re: How to make a register system - DIALOG

can you leave here your yahoo id or something to chat ?
Hor1z0n is offline  
Old 20/08/2010, 01:35 AM   #18
CSMajor
Big Clucker
 
CSMajor's Avatar
 
Join Date: Jul 2010
Posts: 102
Reputation: 0
Default Re: How to make a register system - DIALOG

For the second dialogid check, you do not need the string[128]... since it is not used :P
CSMajor is offline  
Old 20/08/2010, 02:46 AM   #19
Shyaam
Little Clucker
 
Join Date: Aug 2010
Posts: 1
Reputation: 0
Default Re: How to make a register system - DIALOG

How would you make a register system like this if you had MySQL?
Shyaam is offline  
Old 20/08/2010, 02:51 AM   #20
CSMajor
Big Clucker
 
CSMajor's Avatar
 
Join Date: Jul 2010
Posts: 102
Reputation: 0
Default Re: How to make a register system - DIALOG

Great tutorial but mine doesnt work.... i got all the right things its just it doesnt create the file or display that i have registered etc..... it does show the register dialog but it doesnt work :S i can login once :S,here is my script:

pawn Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
//#include <strtok>
#include <dini>
#include <dudb>
#pragma unused ret_memcpy
#define SERVER_USER_FILE "cslogin/users/%s.ini"
#define COLOR_RED 0xFFF0000FF
#define COLOR_BLUE 0x0000BBAA
#define COLOR_YELLOW 0xFFFF00AA


#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif
enum pInfo
{
 pAdminLevel,
 pScore,
 pCash,
};
new PlayerInfo [MAX_PLAYERS] [pInfo];
new gPlayerLogged[MAX_PLAYERS];

public OnGameModeInit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYERS],file[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),SERVER_USER_FILE,name);
    if(!dini_Exists(file))
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Welcome You are not registered!","You are not registered\nplease register now!","Register","Cancel");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Your registered!","Welcome back :P\nPlease sign-in below:","Login","Cancel");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYERS],file[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),SERVER_USER_FILE,name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file,"AdminLevel",PlayerInfo[playerid] [pAdminLevel]);
        dini_IntSet(file,"Score",PlayerInfo[playerid] [pScore]);
        dini_IntSet(file,"Cash",PlayerInfo[playerid] [pCash]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[128], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response)return Kick(playerid);
        if(!strlen(inputtext))return ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Welcome You are not registered!","You are not registered\nplease register now!","Register","Cancel");
        {
            dini_Create(file);
            dini_IntSet(file,"Password",udb_hash(inputtext));
            dini_IntSet(file,"AdminLevel",PlayerInfo[playerid] [pAdminLevel] = 0);
            dini_IntSet(file,"Score",PlayerInfo[playerid] [pScore] = 0);
            dini_IntSet(file,"Cash",PlayerInfo[playerid] [pCash] = 100);
            format(string,sizeof(string),"[LoginSys]: You succesfully registered the name %s with password %s, you have been auto logged in.",name,inputtext);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            gPlayerLogged[playerid] = 1;
        }
    }
    if(dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if(!strlen(inputtext))return ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Your registered!","Welcome back :P\nPlease sign-in below:","Login","Cancel");
        new tmp;
        tmp = dini_Int(file,"Password");
        if(udb_hash(inputtext) != tmp)
        {
            SendClientMessage(playerid,COLOR_RED,"Sorry Wrong Password!");
            ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Your registered!","Welcome back :P\nPlease sign-in below:","Login","Cancel");
        }
        else
        {
        gPlayerLogged[playerid] = 1;
        PlayerInfo[playerid] [pAdminLevel] = dini_Int(file,"AdminLevel");
        SetPlayerScore(playerid,PlayerInfo[playerid] [pScore]);
        GivePlayerMoney(playerid,dini_Int(file,"Cash")-GetPlayerMoney(playerid));
        SendClientMessage(playerid,COLOR_BLUE,"[LoginSys]: Successfully Logged In!");
        }
    }
       
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
CSMajor is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help] Register/Login System with DIALOG BMGP Help Archive 5 14/12/2010 05:34 PM
Changeing A Register System To Dialog robert4049 Help Archive 2 14/07/2010 08:53 PM
How to make Register script with a dialog? GangsTa_ Help Archive 6 30/05/2010 05:07 AM
Dialog Register System SlashPT Help Archive 3 08/01/2010 11:02 AM
How to make login/register system with DIALOG? juseong111 Help Archive 3 20/10/2009 01:20 PM


All times are GMT. The time now is 04:51 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.