SA-MP Forums Archive
Fighting styles aren't saving? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Fighting styles aren't saving? (/showthread.php?tid=167727)



Fighting styles aren't saving? - Mr. Despair - 13.08.2010

This is my fighting style portion.

Код:
if(dialogid == FIGHTMENU)
	{
		if(response)
		{
			if(listitem == 0)
			{
				SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
				SendClientMessage(playerid, COLOR_GREEN, " You now know how to box !");
			}
			if(listitem == 1)
			{
				SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
				SendClientMessage(playerid, COLOR_GREEN, " You now know how to fight better !");
			}
			if(listitem == 2)
			{
			    SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
			    SendClientMessage(playerid, COLOR_GREEN, " You now know how to fight better !");
			}
			if(listitem == 3)
			{
				SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
				SendClientMessage(playerid, COLOR_GREEN, " You now know how to fight better !");
			}
			if(listitem == 4)
			{
			    SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
			    SendClientMessage(playerid, COLOR_GREEN, " You now know how to fight better !");
			}
			if(listitem == 5)
			{
				SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
			}
		}
	}
I want to make it so when you learn one of these it saves when you log out because players will learn the style and lose it upon logout. Also, how would I make each fighting style cost money? Thanks in advance.


Re: Fighting styles aren't saving? - Las Venturas CNR - 13.08.2010

For the money, use GivePlayerMoney.

So if you wanted to take 10k from them, under the function where it sets their style, put this under there:

GivePlayerMoney(playerid, -10000);

We added a "-" since were taking money, don't add it like this GivePlayerMoney(playerid, 10000);
to give them money. And you can change the "10k" to whatever you want for the money.


EDIT: Also, heres a script which saves them, but it isn't dialog: https://sampforum.blast.hk/showthread.php?tid=132549


Re: Fighting styles aren't saving? - Mr. Despair - 13.08.2010

Thanks a lot. I don't really wanna get rid my current system to learn moves as it's more RP. I just want a way that it'll save when someone logs out. Any ideas?


Re: Fighting styles aren't saving? - [L3th4l] - 13.08.2010

Be cooperative with us. Show how you saving your system, when they log out and when they login.


Re: Fighting styles aren't saving? - Claude - 13.08.2010

Using dini
MUST have the include

pawn Код:
#include <dini>
Add below OnPlayerDisconnect
pawn Код:
dini_IntSet(playerid, "Fighting Style", GetPlayerFightingStyle(playerid));
Add below OnPlayerConnect
pawn Код:
SetPlayerFightingStyle(playerid, dini_Int(playerid, "Fighting Style"));



Re: Fighting styles aren't saving? - Mr. Despair - 13.08.2010

I'm getting this error when I try to put either of them under the OnPlayerDisconnect and OnPlayerConnect
Код:
error 035: argument type mismatch (argument 1)



Re: Fighting styles aren't saving? - Claude - 13.08.2010

Quote:
Originally Posted by Mr. Despair
Посмотреть сообщение
I'm getting this error when I try to put either of them under the OnPlayerDisconnect and OnPlayerConnect
Код:
error 035: argument type mismatch (argument 1)
pawn Код:
dini_IntSet(playerid, "FightingStyle", GetPlayerFightingStyle(playerid));
pawn Код:
SetPlayerFightingStyle(playerid, dini_Int(playerid, "FightingStyle"));