17.08.2014, 22:56
(
Последний раз редактировалось yellow; 17.08.2014 в 23:48.
)
Hey guys
Problem: KEY_CTRL_BACK only works 1 time.
As you see, it should be like ths:
Player presses "H" 1 time-> Textdraws are shown
Player presses "H" a second time -> Textdraws should be hided.
I printed the var, where i check the state. (if he pressed 1 or. 2 times)
But I only get one result.
If I press "h" for a second time, nothing will happen. No print, no hide.
Do you see a mistake?
SOLVED!!
The Problem was "SelectTextDraw"
Problem: KEY_CTRL_BACK only works 1 time.
Код:
if(newkeys & KEY_CTRL_BACK) //"H" Stats
{
printf("%d",h[playerid]);
if(h[playerid] == 1)
{
TextDrawHideForPlayer(playerid,Box);
TextDrawHideForPlayer(playerid,Credit);
TextDrawHideForPlayer(playerid,Line);
TextDrawHideForPlayer(playerid,Line2);
TextDrawHideForPlayer(playerid,Next);
TextDrawHideForPlayer(playerid,Back);
PlayerTextDrawHide(playerid,Status[playerid]);
PlayerTextDrawHide(playerid,Player[playerid]);
h[playerid] = 0;
}
else if(h[playerid] == 0){
/*
new currentpage[MAX_PLAYERS];
new Text:Box;
new Text:Credit;
new Text:Status;
new Text:Line;//
new Text:Player;//
new Text:Line2;//
new Text:Next;//
new Text:Back;//
*/
TextDrawShowForPlayer(playerid,Box);
TextDrawShowForPlayer(playerid,Credit);
PlayerTextDrawShow(playerid,Status[playerid]);
TextDrawShowForPlayer(playerid,Line);
PlayerTextDrawShow(playerid,Player[playerid]);
TextDrawShowForPlayer(playerid,Line2);
TextDrawShowForPlayer(playerid,Next);
TextDrawShowForPlayer(playerid,Back);
SelectTextDraw(playerid, 0x00FF00FF);
currentpage[playerid] = 1;
new playerload[64];
new p;
for(;p<MAX_PLAYERS;p++)
{
if(!IsPlayerConnected(p))continue;
GetPlayerName(p,name,sizeof(name));
format(playerload,sizeof(playerload),"%s\n%s ~g~%d",playerload,name,data[p][karma]);
}
PlayerTextDrawSetString(playerid,Player[playerid],playerload);
h[playerid] = 1;
}}
Player presses "H" 1 time-> Textdraws are shown
Player presses "H" a second time -> Textdraws should be hided.
I printed the var, where i check the state. (if he pressed 1 or. 2 times)
But I only get one result.
If I press "h" for a second time, nothing will happen. No print, no hide.
Do you see a mistake?
SOLVED!!
The Problem was "SelectTextDraw"

