Can anyone help me with this code?
#1

Ive created Safezones where players get healed and armoured etc when they enter and a textdraw shows up telling them that they are in it. But the only situation is, the textdraw itself flashes

Код:
public SafeZoneCheckLS(playerid)
{
    new Float: PHealth;
    new Float: PArmour;
   	if(IsPlayerInRangeOfPoint(playerid, 65,1111.5333,-1790.6764,16.5938))//los Santos SafeZone
    {
	 	GivePlayerMoney(playerid,1);
		GetPlayerHealth(playerid,PHealth);
		GetPlayerArmour(playerid,PArmour);
		if(PHealth < 999)
		{
			SetPlayerHealth(playerid,1000);
		}
		if(PArmour < 999)
		{
			SetPlayerArmour(playerid,1000);
		}
        TextDrawShowForPlayer(playerid, TextSZ);
		ResetPlayerWeapons(playerid);
		//Anti Minigun
		if(!IsPlayerLAdmin(playerid))
	    {
			if(GetPlayerWeapon(playerid) == 38) //Ban if they have a minigun
			{
				new stringsys [128];
				new pName[MAX_PLAYER_NAME];
   				GetPlayerName(playerid, pName, sizeof(pName));
				format(stringsys, sizeof(stringsys), "[STRYKER]{44FF00} %s {FFFF00} has been banned for having a Minigun in a safezone.{33FF00} ", pName);
				SendClientMessageToAll(COLOR_GREY, stringsys);
				Kick(playerid);
			}
			if(GetPlayerWeapon(playerid) == 35) //Ban if they have a minigun
			{
				new stringsys [128];
				new pName[MAX_PLAYER_NAME];
   				GetPlayerName(playerid, pName, sizeof(pName));
				format(stringsys, sizeof(stringsys), "[STRYKER]{44FF00} %s {FFFF00} has been banned for having a Rocket Launcher in a safezone.{33FF00} ", pName);
				SendClientMessageToAll(COLOR_GREY, stringsys);
				Kick(playerid);
			}
			if(GetPlayerWeapon(playerid) == 36) //Ban if they have a minigun
			{
				new stringsys [128];
				new pName[MAX_PLAYER_NAME];
   				GetPlayerName(playerid, pName, sizeof(pName));
				format(stringsys, sizeof(stringsys), "[STRYKER]{44FF00} %s {FFFF00} has been banned for having a HS Rocket Launcher in a safezone.{33FF00} ", pName);
				SendClientMessageToAll(COLOR_GREY, stringsys);
				Kick(playerid);
			}
			if(GetPlayerWeapon(playerid) == 37) //Ban if they have a minigun
			{
				new stringsys [128];
				new pName[MAX_PLAYER_NAME];
   				GetPlayerName(playerid, pName, sizeof(pName));
				format(stringsys, sizeof(stringsys), "[STRYKER]{44FF00} %s {FFFF00} has been banned for having a Flame Thrower in a safezone.{33FF00} ", pName);
				SendClientMessageToAll(COLOR_GREY, stringsys);
				Kick(playerid);
			}
		}
	}
   	else if(!IsPlayerInRangeOfPoint(playerid, 75,1111.5333,-1790.6764,16.5938))//los Santos SafeZone
    {
        TextDrawHideForPlayer(playerid, TextSZ);
	}
	return 1;
}
Ignore the Sendclientmessage as i set it to that to test it on my local. The problem is with the "TextDrawHideForPlayer(playerid, TextSZ);" as when the textdraw shows, the TextDrawHideForPlayer gets called pretty much instantaneously straight after it shows, and keeps repeating.

I have a theory thou, I am using 3 instances where the "TextDrawHideForPlayer(playerid, TextSZ);" gets called all on a 1 second timer, If im right, would creating 2 more TextDraws and renaming them to example "TextSZSF", "TextSZLS" and "TextSZLV" solve the flashing problem?

Thanks to anyone that can offer any help..
Reply
#2

use gametextforplayer then..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)