Command problem
#1

Player should not be able to enter this command before end the timer but it is not work correctly 'cause he can do it.
What is wrong?

Код:
forward showedslotmachine(playerid, showed);
public showedslotmachine(playerid, showed)
{
	PlayerTextDrawHide(playerid, Textdraw0[playerid]);
	PlayerTextDrawHide(playerid, Textdraw1[playerid]);
	PlayerTextDrawHide(playerid, Textdraw2[playerid]);
	PlayerTextDrawHide(playerid, Textdraw3[playerid]);
	showed = false;
}

CMD:play(playerid, params[])
{
    new bool:showed;

    new rand1 = random(sizeof(RandomBox1));
    new rand2 = random(sizeof(RandomBox2));
    new rand3 = random(sizeof(RandomBox3));
    
    if(!showed)
    {
		showed = true;
		PlayerTextDrawHide(playerid, Textdraw0[playerid]);
		PlayerTextDrawHide(playerid, Textdraw1[playerid]);
		PlayerTextDrawHide(playerid, Textdraw2[playerid]);
		PlayerTextDrawHide(playerid, Textdraw3[playerid]);

		PlayerTextDrawShow(playerid, Textdraw0[playerid]);

		PlayerTextDrawShow(playerid, Textdraw1[playerid]);
		PlayerTextDrawSetString(playerid, Textdraw1[playerid], RandomBox1[rand1]);
		PlayerTextDrawShow(playerid, Textdraw2[playerid]);
		PlayerTextDrawSetString(playerid, Textdraw2[playerid], RandomBox2[rand2]);
		PlayerTextDrawShow(playerid, Textdraw3[playerid]);
		PlayerTextDrawSetString(playerid, Textdraw3[playerid], RandomBox3[rand3]);

		SetTimerEx("showedslotmachine", 2500, false, "ib", playerid, showed);
	}

	return 1;
}
Reply
#2

You need to have
pawn Код:
new bool:showed[MAX_PLAYERS] = false;
At the top of your code under the includes. Not inside the command.
Reply
#3

Your boolean is inside that command not global, get it out of the brackets like the above poster said.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)