SA-MP Forums Archive
[FilterScript] New!! Super Login System For RolePlay GameMode - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] New!! Super Login System For RolePlay GameMode (/showthread.php?tid=637320)

Pages: 1 2


New!! My First Script Super Login System For RolePlay GameMode - HoussamMaroc - 12.07.2017

Register & Login System By HoussamMaroc
Register By TextDraw







PHP Code:
#include <a_samp>
#include <zcmd>
#include <abc_Dini>
#include <sscanf2>
#pragma unused strtok
#define pX 1234.00
#define pY 1234.00
#define pZ 8.00
#define Get(%0,%1,%2); new %2[128];GetPlayer%0(%1,%2,sizeof(%2));
#define Get2(%0,%1,%2,%3); new Float:%1;new Float:%2;new Float:%3;GetPlayerPos(%0,%1,%2,%3);
forward ShowPassword(playerid);
forward Spawned(playerid);
enum pInfo
{
    
PassShow,
    
LFinished,
    
Registered,
    
Skin,
    
Pass[500],
}
enum
{
    
DIALOG_LOGIN5000,
    
DIALOG_LFINISHED,
    
DIALOG_SKIN,
    
DIALOG_LOGIN2,
    
DIALOG_LOGIN3,
    
DIALOG_FLOGIN,
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
new 
Text:Textdraw[MAX_PLAYERS][100];
new 
string2[128];
new 
string3[128];
new 
lskin[256],money[256],Float:dX,Float:dY,Float:dZ;
public 
OnFilterScriptInit()
{
    print(
"\n----------------------------------------------");
    print(
"-----Register System By HoussamMaroc-----");
    print(
"----------------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    if (
IsPlayerNPC(playerid))
        return 
1;
        
    
SetTimerEx("spec",74,false,"i",playerid);
    return 
1;
}
forward spec(playerid);
public 
spec(playerid)
{
    
SelectTextDraw(playerid,51);
    return 
TogglePlayerSpectating(playerid,true);
}
public 
OnPlayerConnect(playerid)
{
    
Get(Name,playerid,plname);
    
format(string3,sizeof string3,"/%s.ini",plname);
    if(
fexist(string3))
    {
        
ShowPlayerDialog(playeridDIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"{00ff00}Enter Your {0000ff}Password","{00ff00}You Aready Register Please Login","Login","Cancel");
        
money dini_Get(string3,"Cash");
        
GivePlayerMoney(playerid,strval(money));
        return 
0;
    }
    else
    {
   
Textdraw[playerid][0] = TextDrawCreate(209.000000162.960006"LD_POKE:cd9c");TextDrawLetterSize(Textdraw[playerid][0], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][0], 198.000000106.399978);TextDrawAlignment(Textdraw[playerid][0], 1);TextDrawColor(Textdraw[playerid][0], 107);TextDrawSetShadow(Textdraw[playerid][0], 0);TextDrawSetOutline(Textdraw[playerid][0], 0);TextDrawFont(Textdraw[playerid][0], 4);
   
Textdraw[playerid][1] = TextDrawCreate(208.000000169.119995"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][1], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][1], 199.000000, -33.599990);TextDrawAlignment(Textdraw[playerid][1], 1);TextDrawColor(Textdraw[playerid][1], 60);TextDrawSetShadow(Textdraw[playerid][1], 0);TextDrawSetOutline(Textdraw[playerid][1], 0);TextDrawFont(Textdraw[playerid][1], 4);
   
Textdraw[playerid][2] = TextDrawCreate(305.000000131.600021"Register");TextDrawLetterSize(Textdraw[playerid][2], 1.8264983.375200);TextDrawAlignment(Textdraw[playerid][2], 2);TextDrawColor(Textdraw[playerid][2], -16776961);TextDrawSetShadow(Textdraw[playerid][2], 0);TextDrawSetOutline(Textdraw[playerid][2], 1);TextDrawBackgroundColor(Textdraw[playerid][2], 41215);TextDrawFont(Textdraw[playerid][2], 0);TextDrawSetProportional(Textdraw[playerid][2], 1);
   
Textdraw[playerid][3] = TextDrawCreate(209.000000179.760009"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][3], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][3], 198.00000013.439987);TextDrawAlignment(Textdraw[playerid][3], 1);TextDrawColor(Textdraw[playerid][3], -2139062017);TextDrawSetShadow(Textdraw[playerid][3], 0);TextDrawSetOutline(Textdraw[playerid][3], 0);TextDrawFont(Textdraw[playerid][3], 4);
   
Textdraw[playerid][4] = TextDrawCreate(208.000000179.199996plname);TextDrawLetterSize(Textdraw[playerid][4], 0.4499991.600000);TextDrawAlignment(Textdraw[playerid][4], 1);TextDrawColor(Textdraw[playerid][4], -1);TextDrawSetShadow(Textdraw[playerid][4], 0);TextDrawSetOutline(Textdraw[playerid][4], 1);TextDrawBackgroundColor(Textdraw[playerid][4], 51);TextDrawFont(Textdraw[playerid][4], 1);TextDrawSetProportional(Textdraw[playerid][4], 1);
   
Textdraw[playerid][5] = TextDrawCreate(209.000000207.199996"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][5], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][5], 198.00000012.880004);TextDrawAlignment(Textdraw[playerid][5], 1);TextDrawColor(Textdraw[playerid][5], -2139062017);TextDrawSetShadow(Textdraw[playerid][5], 0);TextDrawSetOutline(Textdraw[playerid][5], 0);TextDrawFont(Textdraw[playerid][5], 4);TextDrawSetSelectable(Textdraw[playerid][5], true);
   
Textdraw[playerid][6] = TextDrawCreate(209.000000204.960006"Password");TextDrawLetterSize(Textdraw[playerid][6], 0.4499991.600000);TextDrawAlignment(Textdraw[playerid][6], 1);TextDrawColor(Textdraw[playerid][6], -1);TextDrawSetShadow(Textdraw[playerid][6], 0);TextDrawSetOutline(Textdraw[playerid][6], 1);TextDrawBackgroundColor(Textdraw[playerid][6], 51);TextDrawFont(Textdraw[playerid][6], 1);TextDrawSetProportional(Textdraw[playerid][6], 1);
   
Textdraw[playerid][7] = TextDrawCreate(256.500000233.520004"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][7], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][7], 94.50000029.120010);TextDrawAlignment(Textdraw[playerid][7], 1);TextDrawColor(Textdraw[playerid][7], 16777215);TextDrawSetShadow(Textdraw[playerid][7], 0);TextDrawSetOutline(Textdraw[playerid][7], 0);TextDrawFont(Textdraw[playerid][7], 4);TextDrawSetSelectable(Textdraw[playerid][7], true);
   
Textdraw[playerid][8] = TextDrawCreate(303.500000240.239944"Register");TextDrawLetterSize(Textdraw[playerid][8], 0.4499991.600000);TextDrawAlignment(Textdraw[playerid][8], 2);TextDrawColor(Textdraw[playerid][8], 16711935);TextDrawSetShadow(Textdraw[playerid][8], 0);TextDrawSetOutline(Textdraw[playerid][8], 1);TextDrawBackgroundColor(Textdraw[playerid][8], -16776961);TextDrawFont(Textdraw[playerid][8], 2);TextDrawSetProportional(Textdraw[playerid][8], 1);
   
Textdraw[playerid][9] = TextDrawCreate(209.500000263.760009"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][9], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][9], -4.000000, -128.800003);TextDrawAlignment(Textdraw[playerid][9], 1);TextDrawColor(Textdraw[playerid][9], 255);TextDrawSetShadow(Textdraw[playerid][9], 0);TextDrawSetOutline(Textdraw[playerid][9], 0);TextDrawFont(Textdraw[playerid][9], 4);
   
Textdraw[playerid][10] = TextDrawCreate(405.500000135.520004"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][10], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][10], 3.000000128.240005);TextDrawAlignment(Textdraw[playerid][10], 1);TextDrawColor(Textdraw[playerid][10], 255);TextDrawSetShadow(Textdraw[playerid][10], 0);TextDrawSetOutline(Textdraw[playerid][10], 0);TextDrawFont(Textdraw[playerid][10], 4);
   
Textdraw[playerid][11] = TextDrawCreate(408.500000137.760009"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][11], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][11], -203.000000, -6.160018);TextDrawAlignment(Textdraw[playerid][11], 1);TextDrawColor(Textdraw[playerid][11], 255);TextDrawSetShadow(Textdraw[playerid][11], 0);TextDrawSetOutline(Textdraw[playerid][11], 0);TextDrawFont(Textdraw[playerid][11], 4);
   
Textdraw[playerid][12] = TextDrawCreate(408.500000263.760009"LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][12], 0.0000000.000000);TextDrawTextSize(Textdraw[playerid][12], -203.0000006.160003);TextDrawAlignment(Textdraw[playerid][12], 1);TextDrawColor(Textdraw[playerid][12], 255);TextDrawSetShadow(Textdraw[playerid][12], 0);TextDrawSetOutline(Textdraw[playerid][12], 0);TextDrawFont(Textdraw[playerid][12], 4);
   for(new 
ii<13i++)
     
TextDrawShowForPlayer(playerid,Textdraw[playerid][i]);
   return 
1;
   }
}
public 
OnPlayerDisconnect(playeridreason)
{
    
PlayerInfo[playerid][PassShow] = false;
    
PlayerInfo[playerid][LFinished] = false;
    
PlayerInfo[playerid][Registered] = false;
    
PlayerInfo[playerid][Skin] = -1;
    
GetPlayerPos(playeriddX,dY,dZ);
    
dini_IntSet(string3,"Cash",GetPlayerMoney(playerid));
    
dini_FloatSet(string3,"X",dX);
    
dini_FloatSet(string3,"Y",dY);
    
dini_FloatSet(string3,"Z",dZ);
    
dini_Get(string3,"Cash");
    for(new 
ii<14i++)
      
TextDrawDestroy(Textdraw[playerid][i]);
    return 
1;
}
public 
OnPlayerDeath(playerid,killerid,reason)
{
SetSpawnInfo(playeridNO_TEAM,strval(lskin),pX,pY,pZ,90.0,36,999999,24,999999,14,999999);
return 
1;
}
public 
OnPlayerClickTextDraw(playeridText:clickedid)
{
if(
clickedid == Textdraw[playerid][5])
{
    if(!
PlayerInfo[playerid][LFinished])
    {
    
ShowPlayerDialog(playeridDIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{00ff00}Enter A {0000ff}Password","{00ff00}Pleas Enter A {ff0000}Strong {0000ff}Password","Ok","Cancel");
    return 
1;
    }
    if(
PlayerInfo[playerid][LFinished])
        return 
ShowPlayerDialog(playeridDIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{00ff00}Enter A {0000ff}Password","{00ff00}Change your password","Ok","Cancel");
    return 
1;
}
if(
clickedid == Textdraw[playerid][7])
{
    if(!
PlayerInfo[playerid][LFinished]) return ShowPlayerDialog(playeridDIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{00ff00}No Password Entered","{00ff00}Please Enter A Password","Ok","Cancel");
    
ShowPlayerDialog(playeridDIALOG_LFINISHED,DIALOG_STYLE_MSGBOX,"Rules","Do Not Hack Or Use CLEO Mod\nUse /report to report for a hacker","Register","");
    return 
1;
}
return 
1;
}
public 
OnDialogResponse(playeriddialogidresponse listiteminputtext[])
{
new 
string4[128];
if(
dialogid == DIALOG_LOGIN)
{
    if(
response)
    {
        if(
isnull(inputtext))
            return 
ShowPlayerDialog(playeridDIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{00ff00}Enter A {0000ff}Password","{00ff00}Pleas Enter A {ff0000}Strong {0000ff}Password","Ok","Cancel");
            
        
TextDrawSetString(Textdraw[playerid][6],inputtext );
        
format(PlayerInfo[playerid][Pass], 500 ,"%s",inputtext);
        
PlayerInfo[playerid][PassShow] = true;
        
PlayerInfo[playerid][LFinished] = true;
    }
    else 
    {
        return 
Kick(playerid);
    }
}
if(
dialogid == DIALOG_LOGIN2)
{
    if(
response)
    {
        new 
string5[128];
        
Get(Name,playerid,plname);
        
format(string3,sizeof string3,"%s.ini",plname);
        
format(string5,sizeof string4,"Password Changed. Your New PASS Is (%s)",inputtext);
        
SendClientMessage(playerid,-1,string5);
        
dini_Remove(string3);
        
dini_Set(string3,"Name",string2);
        
dini_Set(string3,"Password",string4);
    }
    return 
1;
}
if(
dialogid == DIALOG_LOGIN3)
{
    if(
response)
    {
        new 
tmp[256];
        
Get(Name,playerid,plname);
        
format(string3,sizeof string3,"%s.ini",plname);
        
tmp dini_Get(string3"Password");
        if(
isnull(inputtext))
        {
            
ShowPlayerDialog(playeridDIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"{00ff00}Enter Your {0000ff}Password","{0000ff}Invalid Password","Login","Cancel");
            return 
0;
        }
        if(!
strcmp(inputtext,tmp,false))
        {
            
format(PlayerInfo[playerid][Pass], 500 ,"%s",inputtext);
               return 
ShowPlayerDialog(playerid,DIALOG_FLOGIN,DIALOG_STYLE_MSGBOX,"Log-in","Thanks For Log-in","Ok","");
        }
        else
        {
            
ShowPlayerDialog(playeridDIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"{00ff00}Enter Your {0000ff}Password","{0000ff}Invalid Password","Login","Cancel");
            return 
0;
        }
     }
}
if(
dialogid == DIALOG_LFINISHED)
{
    if(
response)
    {
      
ShowPlayerDialog(playeridDIALOG_SKIN,DIALOG_STYLE_INPUT,"Choose a skin","Enter Skin Id","Spawn","");
    }
    return 
1;
}
if(
dialogid == DIALOG_SKIN)
{
    if(
response)
    {
    if(!
IsValidSkin(strval(inputtext)))
    {
        
ShowPlayerDialog(playeridDIALOG_SKIN,DIALOG_STYLE_INPUT,"Choose a skin","{0000ff}ERROR: Invalid Skin ID","Spawn","");
        return 
0;
    }
    
PlayerInfo[playerid][Skin] = strval(inputtext);
    for(new 
ii<14i++)
    {
        
TextDrawHideForPlayer(playerid,Textdraw[playerid][i]);
    }
    
    
SetSpawnInfo(playeridNO_TEAM,PlayerInfo[playerid][Skin],pX,pY,pZ,90.0,36,999999,24,999999,14,999999);
    
GivePlayerMoney(playerid50000);
    
TogglePlayerSpectating(playerid,false);
    
CancelSelectTextDraw(playerid);
    
    
Get(Name,playerid,plname);
    
format(string3,sizeof string3,"/%s.ini",plname);
    
dini_Create(string3);
    
dini_Set(string3,"Name",plname);
    
dini_Set(string3,"Password",PlayerInfo[playerid][Pass]);
    
dini_IntSet(string3,"Skin",PlayerInfo[playerid][Skin]);
    
dini_IntSet(string3,"Cash",GetPlayerMoney(playerid));
    
dini_FloatSet(string3,"X",pX);
    
dini_FloatSet(string3,"Y",pY);
     
dini_FloatSet(string3,"Z",pZ);
    }
    return 
1;
}
if(
dialogid == DIALOG_FLOGIN)
{
    
lskin dini_Get(string3,"Skin");
    
SetSpawnInfo(playeridNO_TEAM,strval(lskin),dX,dY,dZ,90.0,36,999999,24,999999,14,999999);
    
SpawnPlayer(playerid);
    
CancelSelectTextDraw(playerid);
    
TogglePlayerSpectating(playerid,false);
}
return 
1;
}
public 
OnPlayerSpawn(playerid)
{
CancelSelectTextDraw(playerid);
return 
1;
}
public 
ShowPassword(playerid)
{
    
TextDrawShowForPlayer(playerid,Textdraw[playerid][13]);
    return 
1;
}
CMD:setskin(playeridparams[])
{
    if(
isnull(params)){ SendClientMessage(playerid7,"/skin [skinid]");return 0;}
    return 
SetPlayerSkinEx(playerid,strval(params));
}
stock IsValidSkin(SkinID)
{
    if((
SkinID == 0)||(SkinID == 7)||(SkinID >= && SkinID <= 41)||(SkinID >= 43 && SkinID <= 64)||(SkinID >= 66 && SkinID <= 73)||(SkinID >= 75 && SkinID <= 85)||(SkinID >= 87 && SkinID <= 118)||(SkinID >= 120 && SkinID <= 148)||(SkinID >= 150 && SkinID <= 207)||(SkinID >= 209 && SkinID <= 264)||(SkinID >= 274 && SkinID <= 288)||(SkinID >= 290 && SkinID <= 299)) return true;
    else return 
false;
}
stock SetPlayerSkinEx(playeridskinid)
{
    new 
sendskin[256];
    
SetPlayerSkin(playerid,skinid);
    
dini_IntSet(string3,"Skin",skinid);
    if(!
IsValidSkin(skinid)) return SendClientMessage(playerid7,"InValid Skin ID");
    
format(sendskin256,"{00ff00}Skin Saved. Your Skin Now Is (%d)",skinid);
    
SendClientMessage(playerid7,sendskin);
    return 
1;

Credits
HoussamMaroc (creator)

iPLEOMAX (textdraws)


Team Samp (a_samp)

Y_Less (sscanf2)

DracoBlue (dini)



Re: New!! Super Login System For RolePlay GameMode - rolex - 12.07.2017

Bugged images, brother!


Re: New!! Super Login System For RolePlay GameMode - HoussemGaming - 12.07.2017

You still use Dini, shit, use MySQL better !! BTW Keep up the good work, +rep.
And use Whirlpool hash to hash player passwords !


Re: New!! Super Login System For RolePlay GameMode - Paulice - 12.07.2017

Not a big fan of it, but +rep for the progress.


Re: New!! Super Login System For RolePlay GameMode - HoussamMaroc - 12.07.2017

thank you


Re: New!! Super Login System For RolePlay GameMode - HoussamMaroc - 12.07.2017

the login is by dialog


Re: New!! Super Login System For RolePlay GameMode - Eoussama - 12.07.2017

Nice, use SQL, and one quick note, the textdraw colors do not match


Re: New!! Super Login System For RolePlay GameMode - HoussemGaming - 12.07.2017

Quote:
Originally Posted by Eoussama
View Post
Nice, use SQL, and one quick note, the textdraw colors do not match
He must hash his passwords too !


Re: New!! Super Login System For RolePlay GameMode - HoussemGaming - 12.07.2017

Quote:
Originally Posted by HoussamMaroc
Посмотреть сообщение
I'm beginner and i try to hash the password but i cant
Add WP_Hash function in your script and hash the password before it get saved in the file, Search some tutorials about it !


Re: New!! Super Login System For RolePlay GameMode - Pottus - 12.07.2017

new Text:Textdraw[MAX_PLAYERS][100];

That says it all to me 1-star.


Re: New!! Super Login System For RolePlay GameMode - JustMe.77 - 12.07.2017

Ugly.. just ugly..


Re: New!! Super Login System For RolePlay GameMode - Hansrutger - 12.07.2017

I don't think people should use textdraws for login purposes at all, simply because you can't make a custom "input" like with dialogs. What you do after one has logged in with for instance character selection/further registration, that is most likely to be good and cool. This opinion is purely subjective on the topic and I'm sure your textdraws are fine for someone else out there!


Re: New!! Super Login System For RolePlay GameMode - Paulice - 13.07.2017

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
I don't think people should use textdraws for login purposes at all, simply because you can't make a custom "input" like with dialogs. What you do after one has logged in with for instance character selection/further registration, that is most likely to be good and cool. This opinion is purely subjective on the topic and I'm sure your textdraws are fine for someone else out there!
True, but not completely (if there is more to just the username and password on the same screen).


Re: New!! Super Login System For RolePlay GameMode - Fairuz - 13.07.2017

Ugly colors and design,1 star.


Re: New!! Super Login System For RolePlay GameMode - delfino - 13.07.2017

Ugh, what a disappointment..

Sorry to say but it's far from a mordern design, the colors dont fit nicely and the coding is bad aswell. It's not 'super' at all.


Re: New!! Super Login System For RolePlay GameMode - xMoBi - 13.07.2017

Color combination isn't matching.
The textdraws look awful.
Rated 1 star.
Improve it.


Re: New!! Super Login System For RolePlay GameMode - Roozevelt - 13.07.2017

Good for beginner


Re: New!! Super Login System For RolePlay GameMode - DarkLight - 13.07.2017

thnx


Re: New!! Super Login System For RolePlay GameMode - Meller - 13.07.2017

This is not good at all, this is fucking horrible.


Re: New!! Super Login System For RolePlay GameMode - IlanZ - 15.07.2017

The design is ugly...