Fightstyle saving problem
#1

Look, so I took a fighstyle system from another GM, and added it to my GM.
Now there is one problem, the fighstyle works fine, deducts money and sets fighstyle.
But it doesnt "save". So when you login again you need to go to the gym again and pay for the fighstyle again.
How do I make it save?
Codes -
pawn Код:
enum pInfo
{

    pFightingStyle,//Fightstyle :D
};
Dialog -- :
pawn Код:
public  OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
 //-------------------------------Gym----------------------------------------
    if(dialogid == 26) //gym
    {
        if(response)
        {
            if(listitem == 0) //normal
            {
                if(GetPlayerPCash(playerid)>=1)
                {
                    PlayerInfo[playerid][pFightingStyle] = 4;
                    SetPlayerFightingStyle(playerid, PlayerInfo[playerid][pFightingStyle]);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have learnt a new fighting style.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have the cash for that !");
                }
            }
            if(listitem == 1) //boxing
            {
                if(GetPlayerPCash(playerid)>=999)
                {
                    PlayerInfo[playerid][pFightingStyle] = 5;
                    SetPlayerFightingStyle(playerid, PlayerInfo[playerid][pFightingStyle]);
                    GivePlayerPCash(playerid, - 1000);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have learnt a new fighting style.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have the cash for that !");
                }
            }
            if(listitem == 2) //kung fu
            {
                if(GetPlayerPCash(playerid)>=999)
                {
                    PlayerInfo[playerid][pFightingStyle] = 6;
                    SetPlayerFightingStyle(playerid, PlayerInfo[playerid][pFightingStyle]);
                    GivePlayerPCash(playerid, - 1000);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have learnt a new fighting style.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have the cash for that !");
                }
            }
            if(listitem == 3) //kneehead
            {
                if(GetPlayerPCash(playerid)>=999)
                {
                    PlayerInfo[playerid][pFightingStyle] = 7;
                    SetPlayerFightingStyle(playerid, PlayerInfo[playerid][pFightingStyle]);
                    GivePlayerPCash(playerid, - 1000);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have learnt a new fighting style.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have the cash for that !");
                }
            }
            if(listitem == 4) //grabkick
            {
                if(GetPlayerPCash(playerid)>=999)
                {
                    PlayerInfo[playerid][pFightingStyle] = 15;
                    SetPlayerFightingStyle(playerid, PlayerInfo[playerid][pFightingStyle]);
                    GivePlayerPCash(playerid, - 1000);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have learnt a new fighting style.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have the cash for that !");
                }
            }
            if(listitem == 5) //elbow
            {
                if(GetPlayerPCash(playerid)>=999)
                {
                    PlayerInfo[playerid][pFightingStyle] = 26;
                    SetPlayerFightingStyle(playerid, PlayerInfo[playerid][pFightingStyle]);
                    GivePlayerPCash(playerid, - 1000);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have learnt a new fighting style.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have the cash for that !");
                }
            }
        }
    }
    return 0;
}
Under on gamemode init ----:
pawn Код:
//-----------------------------custom training pickup XD------
    iTraining = CreatePickup(1239, 23, 766.1840,13.3013,1000.7027); //Training custom pickup :P
Under OnPlayerCommandText ----:
pawn Код:
if(strcmp(cmd, "/train", true) == 0)
    {
        if(!IsPlayerInRangeOfPoint(playerid, 3, 766.1840,13.3013,1000.7027))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "   You are not at a trainer !");
            return 1;
        }
        DisplayDialogForPlayer(playerid, 1); //Training
        return 1;
    }
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == iTraining)
    {
        GameTextForPlayer(playerid, "~w~Type /train to learn ~n~~r~Fighting Techniques", 5000, 3);
        return 1;
    }
    return 1;
}
I use dini, i would like to make something like fightstyles.ini to save them? or anything else that is possible.

pawn Код:
public DisplayDialogForPlayer(playerid, dialogid)
{
    switch(dialogid)
    {
        case 1:
        {
            ShowPlayerDialog(playerid,26,DIALOG_STYLE_LIST,"Gym","Normal        $0\nBoxing      $1000\nKung Fu  $1000\nKneehead $1000\nGrabkick $1000\nElbow        $1000","Learn","Cancel");
        }
    }
    return 1;
}
Reply


Messages In This Thread
Fightstyle saving problem - by anantanni - 16.04.2011, 19:06
Re: Fightstyle saving problem - by austin070 - 16.04.2011, 19:14
Re: Fightstyle saving problem - by anantanni - 16.04.2011, 19:17
Re: Fightstyle saving problem - by anantanni - 16.04.2011, 21:11
Re: Fightstyle saving problem - by anantanni - 16.04.2011, 21:33
Re: Fightstyle saving problem - by Stigg - 16.04.2011, 21:54

Forum Jump:


Users browsing this thread: 4 Guest(s)