SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/06/2019, 02:57 PM   #1
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default SetPlayerMaker

Hello, I'm scripting a tdm script with slots!

The Problem:

When I join a match for a very first time.. I can't see opponent team after match starts.. after I die I can see opponent team and also opponent team players can see me and when leave the match i can't see rest of the players who are not in tdm!..
Now, when i start another slot and join, i can see opponent team and they can see me too!

I use SetPlayerColor, and Reseting SetPlayerMarkerForMarker when the player leaves the tdm also doesn't work!
I don't know how to explain it clearly, Sorry!

SetPlayerMarker is called inside a loop!
Code:
pawn Code:
foreach(new i : Player) if(pInfo[i][InPTDM] == 1 && pInfo[i][SlotID] == slotid)
          {
               // other codes
               SetPlayerMarker(i, false);
          }

//
SetPlayerMarker(playerid, bool:show=false)
{
  if(!show)
  {
    foreach(new i : Player) if(pInfo[i][InPTDM] == 1 && pInfo[i][SlotID] == pInfo[playerid][SlotID] && pInfo[i][TeamID] != pInfo[playerid][TeamID])
    {
        SetPlayerMarkerForPlayer(playerid, i, ( GetPlayerColor(i) & 0xFFFFFF00 ) );
        //SetPlayerMarkerForPlayer(Players will see the player's changed blip color,  the player id whose color will be changed, color);
    }
  }
  else if(show)
  {
    foreach(new i : Player) if( i != playerid)
    {
          SetPlayerMarkerForPlayer(i, playerid, GetPlayerColor(playerid));
    }
  }
}

I tried all the possibilities i can. Hoping someone helps me!
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 05:28 PM   #2
Attack97
Little Clucker
 
Attack97's Avatar
 
Join Date: Mar 2013
Location: Ecuador
Posts: 9
Reputation: 0
Default Re: SetPlayerMaker

hola te dejo este codigo es de un GM A/D sirve para ver a los jugadores de tu equipo y no puedes ver a los del equipo contrario.

Aqui te dejo el codigo:

RadarFix();//pones donde quieres que los jugadores sean invisibles

public OnPlayerStreamIn(playerid, forplayerid)
{
if(Player[playerid][Playing] == true && Player[forplayerid][Playing] == true){
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
} else if(Player[playerid][Playing] == false && Player[forplayerid][Playing] == true) {
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
}

return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
if(Player[playerid][Playing] == true && Player[forplayerid][Playing] == true){
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
} else if(Player[playerid][Playing] == false && Player[forplayerid][Playing] == true) {
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
}
return 1;
}

stock RadarFix() {
foreach(new i : Player) {
foreach(new x : Player) {
if(Player[i][Playing] == true && Player[x][Playing] == true) {
if(Player[x][Team] != Player[i][Team]) {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) | 0x00000055);
}
} else if(Player[i][Playing] == false && Player[x][Playing] == true) {
if(Player[x][Team] != Player[i][Team]) {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) | 0x00000055);
}
}
}
}
}
__________________
Attack97 is offline   Reply With Quote
Old 24/06/2019, 07:06 PM   #3
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: SetPlayerMaker

Quote:
Originally Posted by Attack97 View Post
hola te dejo este codigo es de un GM A/D sirve para ver a los jugadores de tu equipo y no puedes ver a los del equipo contrario.

Aqui te dejo el codigo:

RadarFix();//pones donde quieres que los jugadores sean invisibles

public OnPlayerStreamIn(playerid, forplayerid)
{
if(Player[playerid][Playing] == true && Player[forplayerid][Playing] == true){
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
} else if(Player[playerid][Playing] == false && Player[forplayerid][Playing] == true) {
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
}

return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
if(Player[playerid][Playing] == true && Player[forplayerid][Playing] == true){
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
} else if(Player[playerid][Playing] == false && Player[forplayerid][Playing] == true) {
if(Player[forplayerid][Team] != Player[playerid][Team]){
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(forplayerid,playerid,GetP layerColor(playerid) | 0x00000055);
}
}
return 1;
}

stock RadarFix() {
foreach(new i : Player) {
foreach(new x : Player) {
if(Player[i][Playing] == true && Player[x][Playing] == true) {
if(Player[x][Team] != Player[i][Team]) {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) | 0x00000055);
}
} else if(Player[i][Playing] == false && Player[x][Playing] == true) {
if(Player[x][Team] != Player[i][Team]) {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) & 0xFFFFFF00);
} else {
SetPlayerMarkerForPlayer(x,i,GetPlayerColor(i) | 0x00000055);
}
}
}
}
}
Thanks bro, but it's a extraction from a gamemode but mine is a filterscript, I don't understand those codes. Could someone help me in understand that code or is there any other way more easier?
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 07:55 PM   #4
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Are you setting a virtual world somewhere?
Symon is offline   Reply With Quote
Old 24/06/2019, 08:01 PM   #5
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: SetPlayerMaker

Quote:
Originally Posted by KeyOfKey View Post
Are you setting a virtual world somewhere?
Yeah, Each slot has it's own virtual world!

Edit: Fixed!

But i got a new issue in listing out team players.
I first used it as Text:TeamPlayer[MAX_SLOTS]; but it listed blue and team players.. Then I changed to playertext.
It shows my name but when there are 2-3 more players in team it shows Error: unmatched title
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 08:03 PM   #6
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Unmatched tilde: Increase textdraw string size.

Also use global textdraws if you're showing team players, keep player textdraws for stats or something similar.

And i don't understand why you changed textdraw type since, as i got it, it was working?

if ain't broke don't fix it...
Symon is offline   Reply With Quote
Old 24/06/2019, 08:06 PM   #7
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: SetPlayerMaker

Quote:
Originally Posted by KeyOfKey View Post
Unmatched tilde: Increase textdraw string size.

Also use global textdraws if you're showing team players, keep player textdraws for stats or something similar.
When i used global textdraw, it listed my name in opponent team players list. The String size if 500
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 08:06 PM   #8
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Increase string size. Or post some code, maybe i can help you better.
Symon is offline   Reply With Quote
Old 24/06/2019, 08:10 PM   #9
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: SetPlayerMaker

pawn Code:
new PlayerText:TeamPlayersTD[MAX_PLAYERS][MAX_SLOTS];

ShowPlayerTeamPlayers(slotid)
{
    new Float:health, ShowString[500], hcolor[15];
   
    PubgTdm[slotid][TeamCount][0] = 0;
    PubgTdm[slotid][TeamCount][1] = 0;
   
    foreach(new ii : Player) if(pInfo[ii][InPTDM] == 1 && pInfo[ii][SlotID] == slotid)
    {
        if(pInfo[ii][TeamID] == TEAMBLUE)
        {
            GetPlayerHealth(ii, health);
            if(health >= 70) strcat(hcolor, "~g~~h~");
            else if(health >= 31) strcat(hcolor, "~y~~h~");
            else if(health <= 30) strcat(hcolor, "~r~~h~");
            format(ShowString, sizeof(ShowString),"~y~~h~%i. ~w~%s %s %.0f%%% ~n~", PubgTdm[slotid][TeamCount][0]+1, _GetName(ii), hcolor, health);
            PubgTdm[slotid][TeamCount][0]++;
            PlayerTextDrawSetString(ii, TeamPlayersTD[ii][slotid], ShowString);
        }
        else if(pInfo[ii][TeamID] == TEAMRED)
        {
            GetPlayerHealth(ii, health);
            if(health >= 70) strcat(hcolor, "~g~~h~");
            else if(health >= 31) strcat(hcolor, "~y~~h~");
            else if(health <= 30) strcat(hcolor, "~r~~h~");
            format(ShowString, sizeof(ShowString),"~y~~h~%i. ~w~%s %s %.0f%%% ~n~", PubgTdm[slotid][TeamCount][1]+1, _GetName(ii), hcolor, health);
            PubgTdm[slotid][TeamCount][1]++;
            PlayerTextDrawSetString(ii, TeamPlayersTD[ii][slotid], ShowString);
        }
    }
}
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 08:17 PM   #10
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Whats that PubgTdm[slotid][TeamCount] [0] and [1]? Explain more, what this function does?
Symon is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 10:23 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.