27.11.2009, 17:13
Код:
//Top of your script new FALSE = false; #define TextDrawSetFormat(%0,%1) do{new _str[128]; format(_str,128,%1); TextDrawSetString(%0,_str);}while(FALSE) //This function isn't really necessary, but it simplified the script. new AFKTDTimer; new bool:IsAFKShown; forward HideAFK();
Код:
public OnGameModeInit() { IsAFKShown = false; }
Код:
public SomePublicWhereYouWantToCreateYourTextDraw(...) { IsAFK = TextDrawCreate(260.000000,222.000000,"_"); //Empty TextDraw, it isn't needed to contain something. TextDrawAlignment(IsAFK,0); TextDrawBackgroundColor(IsAFK,0x000000ff); TextDrawFont(IsAFK,3); TextDrawLetterSize(IsAFK,0.599999,1.900000); TextDrawColor(IsAFK,0xff0000ff); TextDrawSetOutline(IsAFK,1); TextDrawSetProportional(IsAFK,1); TextDrawSetShadow(IsAFK,1); }
Код:
public OnPlayerCommandText(playerid, cmdtext) { if(strcmp("/afk",cmdtext, true) == 0) { if(IsAFKShown == true) KillTimer(AFKTDTimer); AFKTDTimer = SetTimer("HideAFK", 5000, false); IsAFKShown = true; TogglePlayerControllable(playerid,0); TextDrawSetFormat(IsAFK, "%s is now AFK!", PlayerName(playerid)) //PlayerName Function from [LSD]Rac3r TextDrawShowForAll(IsAFK); return 1; } return 0; }
Код:
public HideAFK() { IsAFKShown = false; TextDrawHideForAll(IsAFK); return 1; }