Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- #include <a_objects>
- #include <streamer>
- #include <YSI\y_ini>
- #include <YSI\y_iterate>
- #include <utils>
- #include <zcmd>
- #pragma unused IsNumeric
- #pragma unused ReturnUser
- #define D_REGISTER 1
- #define D_LOGIN 2
- #define D_SREGISTER 3
- #define D_EMAIL 4
- #define D_COUNTRY 5
- #define D_SEX 6
- #define D_AGE 7
- #define SCM SendClientMessage
- #define SCMTA SendClientMessageToAll
- #define SPD ShowPlayerDialog
- #define IPI INVALID_PLAYER_ID
- #define DSI DIALOG_STYLE_INPUT
- #define DSM DIALOG_STYLE_MSGBOX
- #define DSL DIALOG_STYLE_LIST
- #define DSP DIALOG_STYLE_PASSWORD
- #define F_PLAYERS "Server/Players/%s.ini"
- native WP_Hash(buffer[],len,const str[]);
- enum PlayerInfo
- {
- Pass[129],
- Email,
- Country,
- Sex,
- Age
- }
- new pInfo[MAX_PLAYERS][PlayerInfo];
- stock F_PLAYERS(playerid)
- {
- new str[128],name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(str,sizeof(str),UserPath,name);
- return str;
- }
- forward loadaccount_user(playerid, name[], value[]);
- public loadaccount_user(playerid, name[], value[])
- {
- INI_String("Password", pInfo[playerid][Pass],129);
- INI_Int("Email",pInfo[playerid][D_EMAIL]);
- INI_Int("Counrty",pInfo[playerid][D_COUNTRY]);
- INI_Int("Sex",pInfo[playerid][D_SEX]);
- INI_Int("Age",pInfo[playerid][D_AGE]);
- return 1;
- }
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("xInsanity | v1.0.0 | xLeafyz.");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- if(fexist(F_PLAYERS(playerid)))
- {
- INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
- SPD(playerid,D_LOGIN,DSI,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Exit");
- }
- else
- {
- SPD(playerid,D_REGISTER,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Exit");
- return 1;
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:file = INI_Open(F_PLAYERS(playerid));
- INI_SetTag(file,"Player's Data");
- INI_WriteInt(file,"Email",pInfo[playerid][Email]);
- INI_WriteInt(file,"Country",pInfo[playerid][Country]);
- INI_WriteInt(file,"Sex",pInfo[playerid][Sex]);
- INI_WriteInt(file,"Age",pInfo[playerid][Age]);
- INI_Close(file);
- 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 == D_REGISTER)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext))
- {
- SPD(playerid,D_REGISTER,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
- SPD(playerid,D_EMAIL,DSI,"Register","Welcome! This ssd is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
- SPD(playerid,D_COUNTRY,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
- SPD(playerid,D_SEX,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
- SPD(playerid,D_AGE,DSI,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Next","Exit");
- return 1;
- }
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- new INI:file = INI_Open(F_PLAYERS(playerid));
- INI_SetTag(file,"Player's Data");
- INI_WriteString(file,"Password",hashpass);
- INI_WriteInt(file,"Email",0);
- INI_WriteInt(file,"Country",0);
- INI_WriteInt(file,"Sex",0);
- INI_WriteInt(file,"Age",0);
- INI_Close(file);
- SCM(playerid,-1,"You have been successfully registered");
- return 1;
- }
- }
- if(dialogid == D_LOGIN)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- if(!strcmp(hashpass, pInfo[playerid][Pass], false))
- {
- INI_ParseFile(F_PLAYERS(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
- SetPlayerScore(playerid,pInfo[playerid][Scores]);
- GivePlayerMoney(playerid,pInfo[playerid][Money]);
- SCM(playerid,-1,"Welcome back! You have successfully logged in");
- }
- else
- {
- SPD(playerid,D_LOGIN,DSI,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Add Comment
Please, Sign In to add comment