Fighting styles aren't saving?
#1

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

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
Reply
#3

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?
Reply
#4

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

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"));
Reply
#6

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)
Reply
#7

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"));
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)