03.06.2010, 17:50
Hello, I have a little problem with textdraws.
I've created a AFK system that shows you an textdraw when you type /afk and hides it when you type /back.
First command works fine but the second one don't hides the textdraws.
My full code
http://pastebin.com/cKmVhxvQ
I've created a AFK system that shows you an textdraw when you type /afk and hides it when you type /back.
First command works fine but the second one don't hides the textdraws.
My full code
Code:
#include <a_samp> #define FILTERSCRIPT new Text:Textdrawafk1; new Text:Textdrawafk2; new Float:PosX[MAX_PLAYERS], Float:PosY[MAX_PLAYERS], Float:PosZ[MAX_PLAYERS], Float:PosA[MAX_PLAYERS], PosI[MAX_PLAYERS]; // public OnPlayerCommandText(playerid, cmdtext[]) { Textdrawafk1 = TextDrawCreate(30.000000, 125.000000, "AFK"); TextDrawBackgroundColor(Textdrawafk1, 255); TextDrawFont(Textdrawafk1, 1); TextDrawLetterSize(Textdrawafk1, 0.659999, 2.200000); TextDrawColor(Textdrawafk1, -65281); TextDrawSetOutline(Textdrawafk1, 1); TextDrawSetProportional(Textdrawafk1, 1); Textdrawafk2 = TextDrawCreate(67.000000, 148.000000, "Type /Volver to return"); TextDrawBackgroundColor(Textdrawafk2, 255); TextDrawFont(Textdrawafk2, 3); TextDrawLetterSize(Textdrawafk2, 0.280000, 1.000000); TextDrawColor(Textdrawafk2, 16777215); TextDrawSetOutline(Textdrawafk2, 1); TextDrawSetProportional(Textdrawafk2, 1); if(strcmp(cmdtext, "/afk", true) == 0 || strcmp(cmdtext, "/awayfromthekeyboard", true) == 0) { GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]); GetPlayerFacingAngle(playerid, PosA[playerid]); PosI[playerid] = (GetPlayerInterior(playerid)); SetPlayerCameraPos(playerid, 1538.5831,-1740.6989,13.5469); SetPlayerCameraLookAt(playerid, 1538.5831,-1740.6989,13.5469); SetPlayerPos(playerid, 2691.6028,2784.7532,59.0212); SetPlayerFacingAngle(playerid, 269.6573); ResetPlayerWeapons(playerid); new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,18); TextDrawShowForPlayer(playerid,Textdrawafk1); TextDrawShowForPlayer(playerid,Textdrawafk2); TogglePlayerControllable(playerid,0); return 1; } if(strcmp(cmdtext, "/back", true) == 0 || strcmp(cmdtext, "/backtokeyboard", true) == 0) { SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]); SetPlayerFacingAngle(playerid, PosA[playerid]); SetPlayerInterior(playerid, PosI[playerid]); new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,18); SetCameraBehindPlayer(playerid); TextDrawHideForPlayer(playerid,Textdrawafk1); TextDrawHideForPlayer(playerid,Textdrawafk2); TogglePlayerControllable(playerid,1); return 1; } return 0; }
http://pastebin.com/cKmVhxvQ