PDA

View Full Version : I need help with saving fighting styles. (y_ini)


TrueForYourSelf
20/02/2013, 11:36 AM
So I have this dialog and already defined Fighting in my script but how I could make it saveable?


if (dialogid == dregister2)
{
if (response)
{
if (listitem == 0)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Normal");
}
if (listitem == 1)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Boxing");
}
if (listitem == 2)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - KungFu");
}
if (listitem == 3)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Knee Head");
}
if (listitem == 4)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Grab Kick");
}
if (listitem == 5)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Elbow");
}
}
else
{
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You selected 'cancel'");
}
}

TrueForYourSelf
20/02/2013, 12:42 PM
This could work?

public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPU T,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_I NPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}
SetPlayerFightingStyle(playerid, pInfo[playerid][Fighting]);
return 1;
}

//OnDialog
if (dialogid == dregister2)
{
if (response)
{
if (listitem == 0)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
pInfo[playerid][Fighting] = 0;
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Normal");
}
if (listitem == 1)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
pInfo[playerid][Fighting] = 1;
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Boxing");
}
if (listitem == 2)
{
pInfo[playerid][Fighting] = 2;
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - KungFu");
}
if (listitem == 3)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
pInfo[playerid][Fighting] = 3;
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Knee Head");
}
if (listitem == 4)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
pInfo[playerid][Fighting] = 4;
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Grab Kick");
}
if (listitem == 5)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
pInfo[playerid][Fighting] = 5;
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have changed your fighting style to - Elbow");
}
}
else
{
SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You selected 'cancel'");
}
}

TrueForYourSelf
20/02/2013, 01:18 PM
But I have registration/ login etc.. I just want to know if it will work like that by reading them from saved numbers?