#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_LOGIN= 5000,
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(playerid, classid)
{
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(playerid, DIALOG_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.000000, 162.960006, "LD_POKE:cd9c");TextDrawLetterSize(Textdraw[playerid][0], 0.000000, 0.000000);TextDrawTextSize(Textdraw[playerid][0], 198.000000, 106.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.000000, 169.119995, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][1], 0.000000, 0.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.000000, 131.600021, "Register");TextDrawLetterSize(Textdraw[playerid][2], 1.826498, 3.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.000000, 179.760009, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][3], 0.000000, 0.000000);TextDrawTextSize(Textdraw[playerid][3], 198.000000, 13.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.000000, 179.199996, plname);TextDrawLetterSize(Textdraw[playerid][4], 0.449999, 1.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.000000, 207.199996, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][5], 0.000000, 0.000000);TextDrawTextSize(Textdraw[playerid][5], 198.000000, 12.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.000000, 204.960006, "Password");TextDrawLetterSize(Textdraw[playerid][6], 0.449999, 1.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.500000, 233.520004, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][7], 0.000000, 0.000000);TextDrawTextSize(Textdraw[playerid][7], 94.500000, 29.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.500000, 240.239944, "Register");TextDrawLetterSize(Textdraw[playerid][8], 0.449999, 1.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.500000, 263.760009, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][9], 0.000000, 0.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.500000, 135.520004, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][10], 0.000000, 0.000000);TextDrawTextSize(Textdraw[playerid][10], 3.000000, 128.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.500000, 137.760009, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][11], 0.000000, 0.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.500000, 263.760009, "LD_SPAC:white");TextDrawLetterSize(Textdraw[playerid][12], 0.000000, 0.000000);TextDrawTextSize(Textdraw[playerid][12], -203.000000, 6.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 i; i<13; i++)
TextDrawShowForPlayer(playerid,Textdraw[playerid][i]);
return 1;
}
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerInfo[playerid][PassShow] = false;
PlayerInfo[playerid][LFinished] = false;
PlayerInfo[playerid][Registered] = false;
PlayerInfo[playerid][Skin] = -1;
GetPlayerPos(playerid, dX,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 i; i<14; i++)
TextDrawDestroy(Textdraw[playerid][i]);
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
SetSpawnInfo(playerid, NO_TEAM,strval(lskin),pX,pY,pZ,90.0,36,999999,24,999999,14,999999);
return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == Textdraw[playerid][5])
{
if(!PlayerInfo[playerid][LFinished])
{
ShowPlayerDialog(playerid, DIALOG_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(playerid, DIALOG_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(playerid, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{00ff00}No Password Entered","{00ff00}Please Enter A Password","Ok","Cancel");
ShowPlayerDialog(playerid, DIALOG_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(playerid, dialogid, response , listitem, inputtext[])
{
new string4[128];
if(dialogid == DIALOG_LOGIN)
{
if(response)
{
if(isnull(inputtext))
return ShowPlayerDialog(playerid, DIALOG_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(playerid, DIALOG_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(playerid, DIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"{00ff00}Enter Your {0000ff}Password","{0000ff}Invalid Password","Login","Cancel");
return 0;
}
}
}
if(dialogid == DIALOG_LFINISHED)
{
if(response)
{
ShowPlayerDialog(playerid, DIALOG_SKIN,DIALOG_STYLE_INPUT,"Choose a skin","Enter Skin Id","Spawn","");
}
return 1;
}
if(dialogid == DIALOG_SKIN)
{
if(response)
{
if(!IsValidSkin(strval(inputtext)))
{
ShowPlayerDialog(playerid, DIALOG_SKIN,DIALOG_STYLE_INPUT,"Choose a skin","{0000ff}ERROR: Invalid Skin ID","Spawn","");
return 0;
}
PlayerInfo[playerid][Skin] = strval(inputtext);
for(new i; i<14; i++)
{
TextDrawHideForPlayer(playerid,Textdraw[playerid][i]);
}
SetSpawnInfo(playerid, NO_TEAM,PlayerInfo[playerid][Skin],pX,pY,pZ,90.0,36,999999,24,999999,14,999999);
GivePlayerMoney(playerid, 50000);
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(playerid, NO_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(playerid, params[])
{
if(isnull(params)){ SendClientMessage(playerid, 7,"/skin [skinid]");return 0;}
return SetPlayerSkinEx(playerid,strval(params));
}
stock IsValidSkin(SkinID)
{
if((SkinID == 0)||(SkinID == 7)||(SkinID >= 9 && 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(playerid, skinid)
{
new sendskin[256];
SetPlayerSkin(playerid,skinid);
dini_IntSet(string3,"Skin",skinid);
if(!IsValidSkin(skinid)) return SendClientMessage(playerid, 7,"InValid Skin ID");
format(sendskin, 256,"{00ff00}Skin Saved. Your Skin Now Is (%d)",skinid);
SendClientMessage(playerid, 7,sendskin);
return 1;
}