20.05.2017, 11:45
Quote:
|
Now about the money and the skin, you'll have to set them after you confirm that the password is correct.
Something like: Код:
case DIALOG_LOGIN:
{
if(!response)
return Kick(playerid);
else
{
if(!strlen(inputtext))
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Server - Login", "Wrong password\nTry again!", "Login", "Exit");
if(PlayerInfo[playerid][pPass] == udb_hash(inputtext))
{
GivePlayerMoney(playerid, PlayerInfo[playerid][Cartera]);
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
//Other part of your code
}
else
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Server - Login", "Wrong password\nTry again!", "Login", "Exit");
}
}
|
Код:
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
new Float:x, Float:y, Float:z, skin;
skin = PlayerInfo[playerid][Skin];
x = PlayerInfo[playerid][pPos_x];
y = PlayerInfo[playerid][pPos_y];
z = PlayerInfo[playerid][pPos_z];
SetSpawnInfo(playerid, 0, skin, x, y, z, 0, 0, 0, 0, 0, 0, 0);
StopAudioStreamForPlayer(playerid);
PlayerInfo[playerid][logged] = 1;
TogglePlayerSpectating(playerid, false);
GivePlayerMoney(playerid, PlayerInfo[playerid][Cartera]);
}
else
{
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Server - Login", "Wrong password\nTry again!", "Login", "Exit");
}
return 1;
}
}
Код:
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][logged]==1)
{
SetPlayerScore(playerid, PlayerInfo[playerid][Nivel]);
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
GivePlayerMoney(playerid, PlayerInfo[playerid][Cartera]);
StopAudioStreamForPlayer(playerid);
SetPlayerPos(playerid, 1271.3654,181.0756,19.4705);
SetCameraBehindPlayer(playerid);
PlayerInfo[playerid][logged] = 0;
}
if(IsPlayerConnected(playerid))
{
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
SetPlayerToTeamColor(playerid);
TogglePlayerSpectating(playerid, 0);
StopAudioStreamForPlayer(playerid);
SetCameraBehindPlayer(playerid);
SetTimerEx("payday", 60000, false, "f", playerid);
}
if(PlayerInfo[playerid][pPos_x] == 0 && PlayerInfo[playerid][pPos_y] == 0)
{
SetPlayerPos(playerid, 1271.3654,181.0756,19.4705);
}
else
{
SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
}
return 1;
}


