SA-MP Forums Archive
Command problem - 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)
+--- Thread: Command problem (/showthread.php?tid=548574)



Command problem - cnoopers - 30.11.2014

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;
}



Re: Command problem - iiNzTicTx - 30.11.2014

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


Re: Command problem - Beckett - 30.11.2014

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