If player not in Zone
#1

Always prints me Desert? Why? Help please.

Код:
public AreaCheck(playerid)
{
	new Float:hp;
	new Float:counted_health;

	  	counted_health = GetPlayerHealth(playerid, hp) - 1;
			if(IsPlayerInArea(playerid,-2989.536, -2942.825, 2989.536, 502.1487))
			{
				SetPlayerHealth(playerid, counted_health);
				Score = TextDrawCreate(505.000000,130.000000,"Danger Zone"); // X Y
			}
			else
			{
				Score = TextDrawCreate(505.000000,130.000000,"Desert"); // X Y
			}
 			if(IsPlayerInArea(playerid, -3001.214, 443.7593, -1331.278, 1634.903))
			{
				SetPlayerHealth(playerid, counted_health);
				Score = TextDrawCreate(505.000000,130.000000,"Danger Zone"); // X Y
			}
			else
			{
				Score = TextDrawCreate(505.000000,130.000000,"Desert"); // X Y
			}
			if(IsPlayerInArea(playerid, -2989.536, 1623.225, -1576.513, 2977.858))
			{
				SetPlayerHealth(playerid, counted_health);
				Score = TextDrawCreate(505.000000,130.000000,"Danger Zone"); // X Y
			}
			else
			{
				Score = TextDrawCreate(505.000000,130.000000,"Desert"); // X Y
			}
			if(IsPlayerInArea(playerid, 93.423, 1763.359, 350.3363, 2066.984)) // US
			{
				Score = TextDrawCreate(505.000000,130.000000,"U.S Base"); // X Y
			}
			else
			{
				Score = TextDrawCreate(505.000000,130.000000,"Desert"); // X Y
			}
			if(IsPlayerInArea(playerid, 1588.191, 875.8406, 1775.037, 1132.754)) // Iraq
			{
				Score = TextDrawCreate(505.000000,130.000000,"Iraq Base"); // X Y
			}
			else
			{
				Score = TextDrawCreate(505.000000,130.000000,"Desert"); // X Y
			}

	TextDrawUseBox(Score,1);
	TextDrawBoxColor(Score,COLOR_BLACK);
	TextDrawTextSize(Score,600.000000,0.000000);
	TextDrawAlignment(Score,0);
	TextDrawBackgroundColor(Score,0x00ff0033);
	TextDrawFont(Score,1);
	TextDrawLetterSize(Score,0.499999,1.500000);
	TextDrawColor(Score,0xffffffff);
	TextDrawSetOutline(Score,1);
	TextDrawSetProportional(Score,1);
	TextDrawSetShadow(Score,1);
	TextDrawShowForPlayer (playerid, Score);
}
Reply
#2

you must create a Timer to use this : TextDrawDestroy
Reply
#3

No needed because timer are in ONPlayerSpawn with 100 miliseconds.
Something wrong with those else { }
Reply
#4

Please help :/
Reply
#5

Can you tell us what this code exactly does and can you put the whole on pastebin.
Reply
#6

Look at the code what I gave,When I'm in U.S. zone it prints : Desert. Similar with other IsPlayerInZone.
Код:
		if(IsPlayerInArea(playerid, 93.423, 1763.359, 350.3363, 2066.984)) // US
			{
				Score = TextDrawCreate(505.000000,130.000000,"U.S Base"); // X Y
			}
			else
			{
				Score = TextDrawCreate(505.000000,130.000000,"Desert"); // X Y
			}
Reply
#7

Why not just use one else { desert }

Like

if(IsPlayerInArea
{
else if(IsPlayerInArea
{
else if(IsPlayerInArea
{
else
{
desert
}
Reply
#8

Ok will try,if it will work...
Anyway thanks!

EDIT: IT WORKS!
I'm noob now in san andreas scripting
I left CS 1.6 and started coding yesterday.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)