12.03.2013, 09:50
You want with saving it or without saving? I will give you an example in saving and loading fighting styles and you could use the same as that... In your waling styles!
So yeah here will be code under OnDialogReponse:
Now we need loading: public OnPlayerSpawn(playerid)
Only remember to create on enum Fighting and in rest of saving loading code..
like: new Fighting;
So yeah here will be code under OnDialogReponse:
pawn Код:
if (dialogid == fighting)
{
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'");
}
}
pawn Код:
if(pInfo[playerid][Fighting] == 0)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
}
if(pInfo[playerid][Fighting] == 1)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
}
//etc etc etc!
like: new Fighting;