Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 2079.3750000,-3683.2011700,4.3381200);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- print("OnPlayerConnect callback is being called successfully.");
- new PLAYER_NAME[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PLAYER_NAME, sizeof(PLAYER_NAME));
- if(fexist(Path(playerid)))
- {
- INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SaveAccount(playerid);
- PLAYER_INFO[playerid][IS_LOGGEDIN] = false;
- PLAYER_INFO[playerid][NEW_REGISTRATION] = false;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(PLAYER_INFO[playerid][NEW_REGISTRATION])
- {
- //Show class selection
- }
- else if(!PLAYER_INFO[playerid][NEW_REGISTRATION])
- {
- //Spawn player with the guns, skin, previous health, position, etc
- }
- 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 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 == DIALOG_REGISTER)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext) || strlen(inputtext) < 6)
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter a valid password (minimum 6 characters long).","Register","Quit");
- return 1;
- }
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- new INI:file = INI_Open(Path(playerid));
- INI_SetTag(file,"PLAYER DATA");
- INI_WriteString(file,"PASSSORD", hashpass);
- INI_WriteInt(file,"MONEY",0);
- INI_WriteInt(file,"SKIN",0);
- INI_WriteInt(file,"LEVEL",0);
- INI_WriteInt(file,"EXP",0);
- INI_WriteInt(file,"KILLS",0);
- INI_WriteInt(file,"LOGGED IN",0);
- INI_WriteInt(file,"FIRST CONNECTION",0);
- INI_Close(file);
- PLAYER_INFO[playerid][IS_LOGGEDIN] = true;
- PLAYER_INFO[playerid][NEW_REGISTRATION] = true;
- return 1;
- }
- }
- if(dialogid == DIALOG_LOGIN)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- if(!strcmp(hashpass, PLAYER_INFO[playerid][PASSWORD], false))
- {
- INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
- SetPlayerScore(playerid, PLAYER_INFO[playerid][LEVEL]);
- GivePlayerMoney(playerid, PLAYER_INFO[playerid][MONEY]);
- PLAYER_INFO[playerid][IS_LOGGEDIN] = true;
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert the correct password to login to your account.","Login","Quit");//We will tell to them that they've entered an incorrect password
- return 1;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement