SA-MP Forums Archive
Got tired of it. *help please* - 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: Got tired of it. *help please* (/showthread.php?tid=481668)



Got tired of it. *help please* - DemME - 16.12.2013

Someone can teach me how to build a textdraw command with time, I mean I'm trying to do when someone is typing wrong command, it will show at the screen textdraw " You have typed wrong command " for expiremental time, of 25 seconds? I tried alot of hours to get it, but didn't success, please can someone help me out?
I made the textdraw already, could someone import it into a timer?
Код:
Textdraw0 = CreatePlayerTextDraw(playerid,172.000000, 403.000000, "You cannot use this command");
PlayerTextDrawBackgroundColor(playerid,Textdraw0, 255);
PlayerTextDrawFont(playerid,Textdraw0, 2);
PlayerTextDrawLetterSize(playerid,Textdraw0, 0.390000, 1.600000);
PlayerTextDrawColor(playerid,Textdraw0, -1);
PlayerTextDrawSetOutline(playerid,Textdraw0, 1);
PlayerTextDrawSetProportional(playerid,Textdraw0, 1);
PlayerTextDrawSetSelectable(playerid,Textdraw0, 0);
Example: If I'll write /blabla and it doesn't include within the gamemode, it will show me the textdraw above for 25secs


Re: Got tired of it. *help please* - RowdyrideR - 17.12.2013

Top:

Код:
new PlayerText:CmdT[MAX_PLAYERS];
new CmdTimer[MAX_PLAYERS];
forward BadCmd(playerid);
Under public OnPlayerConnect(playerid)

Код:
CmdT[playerid] = CreatePlayerTextDraw(playerid,172.000000, 403.000000, "You cannot use this command");
PlayerTextDrawBackgroundColor(playerid,CmdT[playerid], 255);
PlayerTextDrawFont(playerid,CmdT[playerid], 2);
PlayerTextDrawLetterSize(playerid,CmdT[playerid], 0.390000, 1.600000);
PlayerTextDrawColor(playerid,CmdT[playerid], -1);
PlayerTextDrawSetOutline(playerid,CmdT[playerid], 1);
PlayerTextDrawSetProportional(playerid,CmdT[playerid], 1);
PlayerTextDrawSetSelectable(playerid,CmdT[playerid], 0);
Under public OnPlayerCommandPerformed(playerid, cmdtext[], success)

Код:
KillTimer(CmdTimer[playerid]);
PlayerTextDrawHide(playerid,CmdT[playerid]);
PlayerTextDrawShow(playerid,CmdT[playerid]);
CmdTimer[playerid]=SetTimerEx("BadCmd",25000,false,"i",playerid);
Anywhere:

Код:
public BadCmd(playerid)
{
PlayerTextDrawHide(playerid, CmdT[playerid]);
return 1;
}




- Not tested.
- It isn't the best way I guess.


Re: Got tired of it. *help please* - PawnoQ - 17.12.2013

No need to create this texdraw for MAX_PLAYERS.
Just generate one single "global" texdraw and use ShowTexdrawForPlayer.
Replace the "return 0;" under OnPlayerCommand with the ShowTexdrawForPlayer and the timer my foreposter made.


Re: Got tired of it. *help please* - DemME - 17.12.2013

Quote:
Originally Posted by RowdyrideR
Посмотреть сообщение
Top:

Код:
new PlayerText:CmdT[MAX_PLAYERS];
new CmdTimer[MAX_PLAYERS];
forward BadCmd(playerid);
Under public OnPlayerConnect(playerid)

Код:
CmdT[playerid] = CreatePlayerTextDraw(playerid,172.000000, 403.000000, "You cannot use this command");
PlayerTextDrawBackgroundColor(playerid,CmdT[playerid], 255);
PlayerTextDrawFont(playerid,CmdT[playerid], 2);
PlayerTextDrawLetterSize(playerid,CmdT[playerid], 0.390000, 1.600000);
PlayerTextDrawColor(playerid,CmdT[playerid], -1);
PlayerTextDrawSetOutline(playerid,CmdT[playerid], 1);
PlayerTextDrawSetProportional(playerid,CmdT[playerid], 1);
PlayerTextDrawSetSelectable(playerid,CmdT[playerid], 0);
Under public OnPlayerCommandPerformed(playerid, cmdtext[], success)

Код:
KillTimer(CmdTimer[playerid]);
PlayerTextDrawHide(playerid,CmdT[playerid]);
PlayerTextDrawShow(playerid,CmdT[playerid]);
CmdTimer[playerid]=SetTimerEx("BadCmd",25000,false,"i",playerid);
Anywhere:

Код:
public BadCmd(playerid)
{
PlayerTextDrawHide(playerid, CmdT[playerid]);
return 1;
}




- Not tested.
- It isn't the best way I guess.
Much apprcieate, works clearly thx. +rep