ShowPlayerMark
#1

hey guys why this stream wont work ? i mean i want to see my team mates and opponents only in that attacked turf

Код HTML:
public OnPlayerStreamIn(playerid, forplayerid)
{
    if(Undercover[playerid] == 1)
	{
	    TeamColor(playerid);
		ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);
		SetPlayerMarkerForPlayer( playerid, forplayerid, ( GetPlayerColor( forplayerid ) & 0xFFFFFF00 ) );
		SetPlayerMarkerForPlayer( forplayerid, playerid, ( GetPlayerColor( playerid ) & 0xFFFFFF00 ) );
		return 1;
	}
	if(IsInWar1(playerid) && IsInWar1(forplayerid) || IsInWar2(playerid) && IsInWar2(forplayerid))
	{
	    new zone = GetPlayerZone(playerid);
	    if(zone == -1 || TakeON[zone] == 0 || !IsPlayerInZone(forplayerid, zone))
	    {
			SetPlayerMarkerForPlayer( playerid, forplayerid, GetPlayerColor( forplayerid ) );
			SetPlayerMarkerForPlayer( forplayerid, playerid, GetPlayerColor( playerid ) );
		}
	}
	else
	{
	    if(PlayerPaintballing[playerid] && PlayerPaintballing[forplayerid] || InClanWar[playerid] && InClanWar[forplayerid])
		{
			SetPlayerMarkerForPlayer( playerid, forplayerid, GetPlayerColor( forplayerid ) );
			SetPlayerMarkerForPlayer( forplayerid, playerid, GetPlayerColor( playerid ) );
		}
		else
		{
			SetPlayerMarkerForPlayer( playerid, forplayerid, ( GetPlayerColor( forplayerid ) & 0xFFFFFF00 ) );
			SetPlayerMarkerForPlayer( forplayerid, playerid, ( GetPlayerColor( playerid ) & 0xFFFFFF00 ) );
		}
	}
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	if(!IsInWar1(playerid) && !IsInWar2(playerid) && !IsInWar1(forplayerid) && !IsInWar2(forplayerid))
	{
	   	SetPlayerMarkerForPlayer( playerid, forplayerid, ( GetPlayerColor( forplayerid ) & 0xFFFFFF00 ) );
		SetPlayerMarkerForPlayer( forplayerid, playerid, ( GetPlayerColor( playerid ) & 0xFFFFFF00 ) );
 	}
	return 1;
}
Under OnGameModeInit , showplayermarker(0); why is not working ? if i put it 1 i see only at war but i see in every turf not only in that attacked one
Reply
#2

Information

You will also need to do the exact same thing for OnPlayerSpawn, because your code only runs when OnPlayerStream(In/Out) is called, what about players that never come within streaming distance of the players?

Also ShowPlayerMarkers should be 2 then since you want Streamed not Global.
Reply
#3

so should i add this ?

Код HTML:
if(IsInWar1(playerid) && IsInWar1(forplayerid) || IsInWar2(playerid) && IsInWar2(forplayerid))
	{
	    new zone = GetPlayerZone(playerid);
	    if(zone == -1 || TakeON[zone] == 0 || !IsPlayerInZone(forplayerid, zone))
	    {
			SetPlayerMarkerForPlayer( playerid, forplayerid, GetPlayerColor( forplayerid ) );
			SetPlayerMarkerForPlayer( forplayerid, playerid, GetPlayerColor( playerid ) );
		}
	}
under onplayerspawn ?
Reply
#4

Information

Yes, though its not a requirement, it might be safe to do so. That way you don't get any weird outcomes.
Reply
#5

ok , man it's working i can see him but the thing is i want to see him and he can see me only if i am in that attacked turf not in the near one or the next one , just only in that attacked turf , showplayermarker(2); just for the attacked turf not for everyone
Reply
#6

Information

Then you need to compare the zones that playerid and forplayerid are in, and make sure they match before setting their color to visible.

same but in reverse needs to be done when the player leaves the zone.
Reply
#7

Код HTML:
function IsPlayerInZone(playerid, zoneid)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	return (x > ZoneInfo[zoneid][zMinX] && x < ZoneInfo[zoneid][zMaxX] && y > ZoneInfo[zoneid][zMinY] && y < ZoneInfo[zoneid][zMaxY] && GetPlayerInterior(playerid) == 0);
}

if(IsInWar1(playerid) && IsInWar1(forplayerid) || IsInWar2(playerid) && IsInWar2(forplayerid))
	{
	    new zone = GetPlayerZone(playerid);
	    if(zone == -1 || TakeON[zone] == 0 || !IsPlayerInZone(forplayerid, zone))
	    {
	        SetTimerEx("warmarkerin",100, false, "i", playerid);
			SetPlayerMarkerForPlayer( playerid, forplayerid, GetPlayerColor( forplayerid ) );
			SetPlayerMarkerForPlayer( forplayerid, playerid, GetPlayerColor( playerid ) );
		}
	}

function warmarkerin(playerid)
{
    ShowPlayerMarkers(2);
	return 1;
}
i have this i realy don't know what should i do more ... i added a timer to set playermarker 2 if he is in the attacked zone and marker 0 if he is out .. still wont work :-s
Reply
#8

Information

ShowPlayerMarkers should be used in OnGameModeInit its a global function that affects a server property.

You do not need a timer for this at all. What I said is all you need to do, simply make two variables as I have done below.

This is an Example, I have not done the full thing for you. That is for you to work out.
Код:
new 
    pzone,
    fzone
;

pzone = GetPlayerZone( playerid );
fzone = GetPlayerZone( forplayerid );

if( pzone == fzone )
{
	// Now set them to visible
}
This is a start, please try and use a bit more initiative and attempt to make an effort into fixing these yourself.
Reply
#9

i did this under ongamemodeinit same under onplayerstreamin

Код HTML:
new
    pzone,
    fzone
	;

	new playerid,forplayerid;
	pzone = GetPlayerZone( playerid );
	fzone = GetPlayerZone( forplayerid );

	if( pzone == fzone )
	{
		SetPlayerMarkerForPlayer( playerid, forplayerid, GetPlayerColor( forplayerid ) );
		SetPlayerMarkerForPlayer( forplayerid, playerid, GetPlayerColor( playerid ) );
	}
	if( fzone == pzone )
	{
		SetPlayerMarkerForPlayer( playerid, forplayerid, GetPlayerColor( forplayerid ) );
		SetPlayerMarkerForPlayer( forplayerid, playerid, GetPlayerColor( playerid ) );
	}
still wont work i realy don't know how to fix it maybe i did something wrong
Reply
#10

Information

Really? Okay before posting here again. Please for the love of god go learn pawn, learn any easy programming language it will make you understand how silly you really are.

Why would you put code in OnGameModeInit ? You realize when that gets called no players are even connected. Your logic is heavily flawed.

I will say this one last time, and this will be my final reply to this thread about this subject.

First: Under OnPlayerStreamIn you need to put that code that we mention before.
Second: ShowPlayerMarkers is to be put in OnGameModeInit and only once with the parameter of 2.
Third: Your Code is wrong, I gave you the right code and you still got it wrong, that takes a real genius to do that.

Код:
new 
    pzone,
    fzone
;

pzone = GetPlayerZone( playerid );
fzone = GetPlayerZone( forplayerid );

if( pzone == fzone )
{
	SetPlayerMarkerForPlayer( playerid, forplayerid, GetPlayerColor( forplayerid ) );
	SetPlayerMarkerForPlayer( forplayerid, playerid, GetPlayerColor( playerid ) );
}
This code is correct, don't change it again. Only add the same to OnPlayerSpawn and that should be it. If you post again saying you can't get it to work, even though I done it for you then you should just stop scripting, since your too lazy to go to the effort to learn what you have done wrong.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)