25.12.2013, 21:23
(
Last edited by Pettersen; 28/12/2013 at 11:40 PM.
)
**DELETE
ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose class","MILITARY\nCIVIL", "Choose", "");
public OnPlayerRequestClass(playerid, classid)
{
ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose class","MILITARY\nCIVIL", "Choose", "");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER)
}
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering", "You have entered an invalid password.\nType your password below to register a new account.", "Register", "Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
}
}
if(dialogid == DIALOG_CLASS)
{
if(response)
{
if(listitem == 0) //--MILITARY--//
{
gPlayerClass[playerid] = MILITARY;
PickedClass[playerid] = 1;
SetPlayerColor(playerid,0xFF000000);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0);
SpawnPlayer(playerid);
}
if(listitem == 1) //--CIVIL--//
{
gPlayerClass[playerid] = CIVIL;
PickedClass[playerid] = 1;
SetPlayerColor(playerid,0xFF000000);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0);
SpawnPlayer(playerid);
}
return 1;
}
}
if(dialogid == DIALOG_LOGIN)
{
if (!response) return Kick (playerid);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
}
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;
}
}
return 1;
}