problem with jail timer
#1

Hello, I have a big problem with jail system. I have a server where player can be jailed for some time. Everything works, this jail timer works fine until
Quote:

else if(GetPVarInt(i, "Jail") == 1)

where server should say "Unjailed". But server says nothing and player stays in the same position (SetPlayerPos don't work)! But the biggest mistery of this script for me is that function
Quote:

SetPVarInt(i, "Jail", GetPVarInt(i, "Jail")-1);

works... I'm not so good in pawno, anyne can help me explaining why player do not get teleported and server message do not show, but SetPVarIn works fine?

Код:
else if(GetPVarInt(i, "Jail") == 1)
		{
		SetPlayerHealth(i, 100);
       			SetPlayerPos(i, 621.689453125, -596.9580078125, 16.731489181519);
       			SendClientMessage(i, COLOR_GREEN, "SERVER: Unjailed!");
		format(file, 128, "/Accounts/%s.ini", GetName(i));
       			SetPVarInt(i, "Jail", GetPVarInt(i, "Jail")-1);
		}
Reply
#2

pawn Код:
else if(GetPVarInt(i, "Jail") == 1)
        {
        SetPlayerHealth(i, 100);
                SetPlayerPos(i, 621.689453125, -596.9580078125, 16.731489181519);
                SendClientMessage(i, COLOR_GREEN, "SERVER: Unjailed!");
        format(file, 128, "/Accounts/%s.ini", GetName(i));
                SetPVarInt(i, "Jail", GetPVarInt(i, "Jail")-1);
                        printf("hello");
        }
See if it prints hello.
Reply
#3

It doesn't!

EDIT: Fixed!
Reply
#4

SetPVarInt(i, "Jail", GetPVarInt(i, "Jail")-1);
GetPVarInt returns 0 if there is no such variable, therefore first time you set it, it sets Jail to -1, and -1 is not ==1
Simply when jailing do this SetPVarInt(i, "Jail", 1);
when taking him out of jail
DeletePVar(i, "jail");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)