Can anyone help me with this code? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can anyone help me with this code? (
/showthread.php?tid=297850)
Can anyone help me with this code? -
chaosnz - 18.11.2011
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..
Re: Can anyone help me with this code? -
wumpyc - 18.11.2011
use gametextforplayer then..