textdrawhide timer
#1

Код:
YCMD:sethp(playerid, params[], help)
{
	if(help) return SCM(playerid, COLOR_GREY, "Not supported");

    new string[128], playa, health;
    if(sscanf(params, "ud", playa, health))
	{
        SCM(playerid, COLOR_GRAD, "USAGE:  /sethp [playerid] [health]");
        return 1;
    }
    if (PlayerInfo[playerid][pAdmin] >= 4) {
    	if(IsPlayerConnected(playa))
		{
            if(playa != INVALID_PLAYER_ID)
			{
                SetPlayerHealth(playa, health);
                format(string, sizeof(string), "> You have set %s's health to %d.", GetPlayerNameEx(playa), health);
                SCM(playerid, COLOR_BLUE, string);
                format(string, sizeof(string), "> Admin %s has set your health to %d.", GetPlayerNameEx(playerid), health);
                SCM(playa, COLOR_BLUE, string);
            }
        }
        else SCM(playerid, COLOR_GRAD1, "Invalid player specified.");
    }
    else {
        format(string,sizeof(string),"~n~~n~~w~You cannot use this command.");
		TextDrawSetString(Textdraw69[playerid],string);
		TextDrawShowForPlayer(playerid, Textdraw69[playerid]);
    }
    return 1;
}
Код:
stock HideCMessage(playerid)
{
	TextDrawHideForPlayer(playerid, Textdraw69);
	return 1;
}

timer HideCMessage[4000](playerid)
{
	TextDrawHideForPlayer(playerid, Textdraw69);
	return 1;
}
That's my code, 1 problem, how do I get the textdraw hided after 4 seconds? I am stuck for a few hours, all I try(timers stocks anything) it all gets me error, could anyone please help me? I'm using Y_INI.
Reply
#2

Can we please know the error and which line it is on?
Reply
#3

I need a timer which destroys the textdraw, problem is I can't solve/make it myself..- Requesting some help here :/.
Reply
#4

pawn Код:
SetTimer("hidetextdraw", 4000, false);// This will only be used once, but it will disappear after 4 seconds. I think. Add this timer under TextDrawShowForPlayer

forward hidetextdraw(playerid);

public hidetextdraw(playerid)
{
    TextDrawHideForPlayer(playerid, TextDraw69);
    return 1;
}
Hope this helps. This code hasn't been tested yet, but it should work. If it doesn't, please post something therefore I am able to fix my error.
Reply
#5

Keep getting
(40129) : error 035: argument type mismatch (argument 2)

public hidetextdraw(playerid)
{
TextDrawHideForPlayer(playerid, TextDraw69); <<<<<<< That line
return 1;
}


Sorry, im extremely tired but I want this fixed before I go sleep :P
Reply
#6

When you are creating the textdraw, use TextDrawWhatEverYouWannaCallIt[playerid] = then your textdraw creation (NOTE: you will have to do this under OnPlayerConnect, and then when trying to hide it, use TextDrawHideForPlayer(playerid, TextDrawWhatEverYouWannaCallIt[playerid]);
Reply
#7

Add somewhere

pawn Код:
forward HideTextDraw(playerid, SomeTextDraw, type);
public HideTextDraw(playerid, SomeTextDraw, type)
{
    switch(type)
    {
        case 0: TextDrawHideForAll(Text:SomeTextDraw);
        case 1: TextDrawHideForPlayer(playerid, Text:SomeTextDraw);
        default: PlayerTextDrawHide(playerid, PlayerText:SomeTextDraw);
    }
}
then

pawn Код:
SetTimerEx("HideTextDraw", 4000, false, "iii", playerid, _:Textdraw69[playerid], 1);
hidding textdraw for playerid with type 1 ( TextDrawHideForPlayer )
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)