SA-MP Forums Archive
Timer making player client crash - 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: Timer making player client crash (/showthread.php?tid=68130)



Timer making player client crash - Coicatak - 07.03.2009

Hi, I got a big problem, this function is supposed to draw gametexts for players who are next to the a defined place. It works perfectly for the different "for" statments but the "if" and "else if" statments make player client crash O.o, well, any idea why please?

Here is the func: http://pastebin.com/f2781704f
Here is what makes client crash, I have ni idea why
pawn Код:
if(PlayerToPoint(1.0, i, 362.0175,188.6333,1008.3828))
{
    GameTextForPlayer(i, "~w~Tapez~~r~/joblist ~w~Pour regarder les annonces de jobs", 3000, 3);
    return 1;
}
else if(PlayerToPoint(1.0, i, 1572.5874,-1675.6232,28.3955))
{
    GameTextForPlayer(i, "~w~Tapez~~r~/roof ~w~Pour descendre", 3000, 3);
    return 1;
}
else if(PlayerToPoint(1.0, i, 242.4418,66.3357,1003.6406))
{
    GameTextForPlayer(i, "~w~Tapez~~r~/roof ~w~Pour acceder au toit", 3000, 3);
     return 1;
}
else if(PlayerToPoint(1, i, 2315.5657,-11.3179,26.7422))
{
    GameTextForPlayer(i, "~w~Tapez~~r~/buy ~w~Pour afficher les produits en vente", 3000, 3);
    return 1;
}
else if (PlayerToPoint(1, i, 362.0175,188.6333,1008.3828))
{
    GameTextForPlayer(i, "~w~Tapez ~g~/help ~n~~w~Pour afficher les commandes liees a la banque.", 3000, 3);
    return 1;
}
Edit: I got new, sometimes instead of crashing client, when I go to the area (I don't know if it does the same with the other ones):
pawn Код:
else if(PlayerToPoint(1.0, i, 242.4418,66.3357,1003.6406))
{
    GameTextForPlayer(i, "~w~Tapez~~r~/roof ~w~Pour acceder au toit", 3000, 3);
     return 1;
}
It will display this gametext but with buggy characters:
pawn Код:
format(string, sizeof(string), "~w~Vous pouvez louer ce vehicule~n~Prix:~g~$%d~n~~w~Pour ce, tapez ~g~/rentcar~n~~w~pour sortir tapez ~r~/exit(ou F)",CarInfo[newcar][cValue]);
And this gametext is located under OnPlayerStateChange, wtf? O.o
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
     {
        new newcar = GetPlayerVehicleID(playerid);
        new string[256];if(IsRentable(newcar))
        {
          new hired;
          for(new p=0; p<MAX_PLAYERS; p++)
          {
            if (HireCar[p] == newcar)
                {
                    hired = 1;
                    break;
                }
            }
            if(hired == 0)
            {
                format(string, sizeof(string), "~w~Vous pouvez louer ce vehicule~n~Prix:~g~$%d~n~~w~Pour ce, tapez ~g~/rentcar~n~~w~pour sortir tapez ~r~/exit(ou F)",CarInfo[newcar][cValue]);
                TogglePlayerControllable(playerid, 0);
                GameTextForPlayer(playerid, string, 5000, 3);
                BrowsingCar[playerid] = 1;
                return 1;
            }
            else
            {
                SendClientMessage(playerid, GREY, "Ceci est un vйhicule de location. Malheureusement pour vous, il est dйjа louй.");
                return 1;
            }
        }
Seriously, I REALLY need this working and this freaking bug is uncommon, why does it display another gametext which has no relations with the other one

HELP PLEASE



Re: Timer making player client crash - Coicatak - 09.03.2009

*bump*

Any help please? This is really urgent

Thanks in advance


Re: Timer making player client crash - MenaceX^ - 09.03.2009

Fix the bad identitation please.


Re: Timer making player client crash - Coicatak - 09.03.2009

Quote:
Originally Posted by MenaceX^
Fix the bad identitation please.
Done


Re: Timer making player client crash - Coicatak - 10.03.2009

HEEEEEELP please


Re: Timer making player client crash - Rimeau - 10.03.2009

You're using pre-defined strings, are you sure no one of them is empty?


Re: Timer making player client crash - MenaceX^ - 10.03.2009

Quote:
Originally Posted by Coicatak
Quote:
Originally Posted by MenaceX^
Fix the bad identitation please.
Done
Not really.


Re: Timer making player client crash - Coicatak - 11.03.2009

Quote:
Originally Posted by Rimeau
You're using pre-defined strings, are you sure no one of them is empty?
I'm not using any pre-defined strings for the if statements, only GameTextForPlayer, and PlayerToPoint... But as soon as I the message is supposed to appear, client crashes. (except for the 'for' statments, god know why, but I don't...)

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by Coicatak
Quote:
Originally Posted by MenaceX^
Fix the bad identitation please.
Done
Not really.
It is on my screen, I think it is a resolution problem... Anyway here is the pastebin: http://pastebin.com/m54d51733 (I hope it will work, i've never used it before)

So any help?


Re: Timer making player client crash - MenaceX^ - 11.03.2009

In which part are you getting crashes?


Re: Timer making player client crash - Coicatak - 11.03.2009

Quote:
Originally Posted by MenaceX^
In which part are you getting crashes?
For every statments below the 'for' ones