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
#2

Save it to the player's account file.
Reply
#3

Mhm. How?....
This forum requires that you wait 120 seconds between posts. Please try again in 3 seconds.
Reply
#4

ANYONE!!!!!?!
I'm pissed off. Sorry if I'm being harsh.
Reply
#5

@itsmelmao - Nice name.
And fighstyle is the fighting style of the player. Like in normal gta when you go to gym and "learn new moves" it changes your fighting style...
Reply
#6

Quote:
Originally Posted by itsmelmao
Посмотреть сообщение
what is fightstyle? :S
Here is some info:

https://sampwiki.blast.hk/wiki/Fightingstyles
https://sampwiki.blast.hk/wiki/SetPlayerFightingStyle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)