23.06.2012, 19:39
Oke fixed so far, but now, It keeps setting the player to his LAST position. but with the Shelter's Interior id....
Any ideas how to fix?
Any ideas how to fix?
pawn Код:
public OnPlayerLoginAttempt(playerid, password[])
{
new string[128], Year, Month, Day, Minute, Hour, Second, Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), "Accounts/%s.ini", Name);
if(Player[playerid][LoginAttempts] == 3)
{
SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
Kick(playerid);
}
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
if(fexist(string))
{
if(strcmp(dini_Get(string, "Password"), password, false) == 0)
{
Player[playerid][Authenticated] = 1;
Player[playerid][Password] = dini_Get(string, "Password");
Player[playerid][AdminLevel] = dini_Int(string, "AdminLevel");
Player[playerid][LastX] = dini_Float(string, "LastX");
Player[playerid][LastY] = dini_Float(string, "LastY");
Player[playerid][LastZ] = dini_Float(string, "LastZ");
Player[playerid][LastWorld] = dini_Int(string, "LastWorld");
Player[playerid][LastInterior] = dini_Int(string, "LastInterior");
Player[playerid][Health] = dini_Float(string, "Health");
Player[playerid][Armour] = dini_Float(string, "Armour");
Player[playerid][LastSkin] = dini_Int(string, "LastSkin");
Player[playerid][Money] = dini_Int(string, "Money");
Player[playerid][Banned] = dini_Int(string, "Banned");
Player[playerid][Spawn] = dini_Int(string, "Spawn");
Player[playerid][Shelter] = dini_Int(string, "Shelter");
if(Player[playerid][Spawn] == 1)
{
SetPlayerPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
SetPlayerInterior(playerid, Player[playerid][LastInterior]);
SetPlayerVirtualWorld(playerid, Player[playerid][LastWorld]);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, Player[playerid][LastSkin]);
}
else if(Player[playerid][Spawn] == 2)
{
if(Player[playerid][Shelter] == 1)
{
SetPlayerPos(playerid, 2226.8325, -1183.8024, 1029.8043);
SetPlayerInterior(playerid, 15);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, Player[playerid][LastSkin]);
}
else if(Player[playerid][Shelter] == 2)
{
SetPlayerPos(playerid, 2492.3364, -1702.5139, 1018.3438);
SetPlayerInterior(playerid, 3);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, Player[playerid][LastSkin]);
}
else if(Player[playerid][Shelter] == 3)
{
SetPlayerPos(playerid, -2163.3225, 644.2694, 1057.5938);
SetPlayerInterior(playerid, 1);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, Player[playerid][LastSkin]);
}
else if(Player[playerid][Shelter] == 4)
{
SetPlayerPos(playerid, 772.2763,-22.1738,1000.5859);
SetPlayerInterior(playerid, 6);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, Player[playerid][LastSkin]);
}
}
new Flaw = floatround(Player[playerid][Health], floatround_ceil);
SetPlayerHealth(playerid, Flaw);
Flaw = floatround(Player[playerid][Armour], floatround_ceil);
SetPlayerArmour(playerid, Flaw);
GivePlayerMoney(playerid, Player[playerid][Money]);
SetPlayerSkin(playerid, Player[playerid][LastSkin]);
}
else
{
new Sum;
Sum = 3-Player[playerid][LoginAttempts];
SendClientMessage(playerid, ADMINORANGE, "The password you have entered does not match your account. Please try again or use the forums.");
Player[playerid][LoginAttempts]++;
format(string, sizeof(string), "You have %d remaining login attempts, before you are auto-banned.", Sum);
SendClientMessage(playerid, WHITE, string);
ShowPlayerDialog(playerid, 3894, DIALOG_STYLE_PASSWORD, "Authentication", "Welcome back to Volcom Roleplay\n\nYou have an account, please enter your password to authenticate.", "Login", "Help");
if(Player[playerid][LoginAttempts] == 3)
{
SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
Kick(playerid);
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You must register first.");
}
return 1;
}