Set Timer and Textdraw Help
#1

hey, Sorry for my bad english xD
i have problem with my textdraw Set String, he doesnt want to hide After showing
script:
Код:
CMD:givecash(playerid, params[])
{
	new str[128], money, id;
	if(pInfo[playerid][Admin] >= 1)
	{
		if(sscanf(params, "ui", id, money)) return SendClientMessage(playerid, COLOR_GREEN, "[INFO]:{FFFFFF} /givecash [playerid] [amount]");
		if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREEN, "[INFO]:{FFFFFF} Player not connected!");
		GivePlayerMoney(id, money);
		format(str, sizeof(str), "[INFO]: {FFFFFF}Administrator %s has given you $%d Money", GetName(playerid), money);
		SendClientMessage(id, COLOR_GREEN, str);
		format(str, sizeof(str), "~g~you recived $%d money from admin %s", money, GetName(playerid));
		TextDrawSetString(textstring, str);
		TextDrawShowForPlayer(playerid, textstring);
		SetTimer("HideTextdraw", 3000, false); // Set timer to hide textdraw
	}
	else return SendClientMessage(playerid, COLOR_GREEN, CANT);
	return 1;
}
public for Forward HideTextdraw:
Код:
forward HideTextdraw(playerid);

public HideTextdraw(playerid)
{
	TextDrawHideForPlayer(playerid, textstring);
}
first i try this is working on localhost (mean textdraw is hide after showing), then when i want to play with my friend in Hamachi server, the textdraw won't hide, Please Help
Reply
#2

Use SetTimerEx instead of SetTimer if you want to use it for a specific playerid.
https://sampwiki.blast.hk/wiki/SetTimerEx

Example:
pawn Код:
SetTimerEx("HideTextdraw", 3000, false, "i", playerid);
Reply
#3

HideTextDraw has a parameter for playerid, use SetTimerEx to transfer the playerid.

EDIT: Wow, Calvin posted at the EXACT moment I did so it didnt show me his post until I refreshed lol.
Reply
#4

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Use SetTimerEx instead of SetTimer if you want to use it for a specific playerid.
https://sampwiki.blast.hk/wiki/SetTimerEx

Example:
pawn Код:
SetTimerEx("HideTextdraw", 3000, false, "i", playerid);
Oh okay, I will try Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)