10.02.2017, 23:40
Basically what the title says, I'm using a cheeky way to get around the class select buttons with TogglePlayerSpectating.
When I first login, instead of getting put at my old coordinates, I get put at 0,0,0. The save/loading works because my money is loaded correctly.
This same system works in an old script of mine (at the time of use, during 0.3.7 still, can't test now because don't have Whirlpool), but not for this script, for some reason.
Problem script:
Old working script:
When I first login, instead of getting put at my old coordinates, I get put at 0,0,0. The save/loading works because my money is loaded correctly.
This same system works in an old script of mine (at the time of use, during 0.3.7 still, can't test now because don't have Whirlpool), but not for this script, for some reason.
Problem script:
pawn Код:
case DIALOG_LOGIN:
{
if (!response) return SCM(playerid, COLOR_WHITE, "You have failed to login. Please reconnect and try again.");
if(response)
{
if(udb_hash(inputtext) == pInfo[playerid][pPassword])
{
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, pInfo[playerid][pCash]);
SetSpawnInfo(playerid, NO_TEAM, pInfo[playerid][pSkin], pInfo[playerid][pX], pInfo[playerid][pY], pInfo[playerid][pZ], pInfo[playerid][pA], 0, 0, 0, 0, 0, 0);
TogglePlayerSpectating(playerid, false);
SCM(playerid, COLOR_YELLOW, "Login Successful!");
return 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
pawn Код:
if(dialogid == REGISTER_LOGIN)
{
if(!response) return Kick(playerid);
if(response)
{
new hpass[129];
WP_Hash(hpass, sizeof(hpass), inputtext);
if(!strcmp(hpass, pInfo[playerid][pPass], false))
{
if(LoginAttempt[playerid] > 0)
{
LoginAttempt[playerid] = 0;
return ShowPlayerDialog(playerid, REGISTER_LOGIN2, DIALOG_STYLE_PASSWORD, "Login", "You made too many login attempts. Enter your second password to Login.", "Enter", "Cancel");
}
IsPlayerLoggedIn[playerid] = true;
SCM(playerid, COLOR_GREEN, "You've successfully logged in. Welcome back.");
SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], pInfo[playerid][pX], pInfo[playerid][pY], pInfo[playerid][pZ], pInfo[playerid][pA], 0, 0, 0, 0, 0, 0);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(pid);
SetPlayerVirtualWorld(playerid, pInfo[playerid][pVW]);
SetPlayerInterior(playerid, pInfo[playerid][pInterior]);
SetPlayerScore(playerid, pInfo[playerid][pPlayingHours]);
TIMER_MONEYCHECK[playerid] = SetTimerEx("MoneyCheck", 1000, true, "i", playerid);
TIMER_CURRENTWEAPON[playerid] = SetTimerEx("CurrentWeapon", 150, true, "i", playerid);
TIMER_PAYCHECK[playerid] = SetTimerEx("PayCheckTimer", 60000*60, true, "i", playerid);
PayTime[playerid] = 3600;
if(pInfo[playerid][pRegistered] == false) // If their not registered/accepted by helpers.
{
SetSpawnInfo(playerid, NO_TEAM, pInfo[playerid][pSkin], -4846.1611,1949.6287,2.8717,123.7555, 0, 0, 0, 0, 0, 0);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SaveUser(playerid);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(pid);
LoadInterior(pid);
SCM(pid,COLOR_ORANGE, "A helper will be with you shortly.");
new str[128];
format(str,sizeof(str), "NOTIFICATION: Player %s (%d) is now ready for the RP test. Use /hhgoto to teleport to the player.", GetName(pid), pid);
SendClientMessageToHelpers(COLOR_HELPER, str);
}
if(pInfo[playerid][pDrugAddiction] > 0) // If the player is addicted to a drug.
{
TIMER_ADDICTION[playerid] = SetTimerEx("DrugAddiction", 900000, true, "i", playerid);
}
Weapon[playerid][pInfo[playerid][pWeapon0]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon0], 99999);
Weapon[playerid][pInfo[playerid][pWeapon1]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon1], 99999);
Weapon[playerid][pInfo[playerid][pWeapon2]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon2], 99999);
Weapon[playerid][pInfo[playerid][pWeapon3]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon3], 99999);
Weapon[playerid][pInfo[playerid][pWeapon4]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon4], 99999);
Weapon[playerid][pInfo[playerid][pWeapon5]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon5], 99999);
Weapon[playerid][pInfo[playerid][pWeapon6]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon6], 99999);
Weapon[playerid][pInfo[playerid][pWeapon7]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon7], 99999);
Weapon[playerid][pInfo[playerid][pWeapon8]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon8], 99999);
Weapon[playerid][pInfo[playerid][pWeapon9]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon9], 99999);
Weapon[playerid][pInfo[playerid][pWeapon10]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon10], 99999);
Weapon[playerid][pInfo[playerid][pWeapon11]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon11], 99999);
Weapon[playerid][pInfo[playerid][pWeapon12]] = true;
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon12], 99999);
SetPlayerArmedWeapon(playerid, pInfo[playerid][pWeapon0]);
for(new i=0; i<MAX_HOUSES; i++)
{
new path[30];
format(path,sizeof(path), HPATH, i);
if(fexist(path))
{
if(strsame(GetName(playerid), hInfo[i][hRenter], true) && hInfo[i][hRent] > 0)
{
pInfo[playerid][pMoney] -= hInfo[i][hRent];
hInfo[i][hRentPay] += hInfo[i][hRent];
new str[128];
format(str, sizeof(str), "You have paid $%i for rent. (House ID %i)", hInfo[i][hRent], i);
SCM(playerid, COLOR_WHITE, str);
}
}
}
}
else
{
SCM(pid,COLOR_GREY, "ERROR: You've entered an incorrect password.");
LoginAttempt[playerid] += 1;
if(LoginAttempt[playerid] == 3)
{
new astr[64], ipstr[16];
GetPlayerIp(playerid, ipstr, sizeof(ipstr));
format(astr, sizeof(astr), "Player %s (%i) with ip %s failed to login. They have been kicked.", GetName(playerid), playerid, ipstr);
SendClientMessageToAdmins(COLOR_ADMIN, astr, 1);
Kick(playerid);
return 1;
}
ShowPlayerDialog(playerid, REGISTER_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Enter your password to Login.", "Enter", "Cancel");
return 1;
}
}
}