SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 24/06/2019, 08:23 PM   #11
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
Whats that PubgTdm[slotid][TeamCount] [0] and [1]? Explain more, what this function does?
So man, They are based on slots. So slotid is slotid of the match going on!
This function is called in a 1 second timer to update instance and TeamCount[0] and [1] are used to count the players in the team of that slotid. Like [0] for blue team and [1] red team but they work good.

Debug of the String:
Code:
[02:03:20] ~y~~h~1. ~w~Hoe ~g~~h~ 100% ~n~
[02:03:20] ~y~~h~2. ~w~Roy ~g~~h~~g~~h~ 100% ~n~
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 08:33 PM   #12
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Ok mh let's see what we can do.

First, there's no need the usage of [MAX_SLOTS] in the textdraw. If you're calling ShowPlayerTeamPlayers every 1 second, then i would edit the code in this way:

pawn Code:
new PlayerText:TeamPlayersTD[MAX_PLAYERS];

pawn Code:
ShowPlayerTeamPlayers(playerid, slotid)
{
    if(pInfo[playerid][InPTDM] == 1 && pInfo[playerid][SlotID] == slotid)
    {
        new Float:health, ShowString[800], hcolor[15];

        PubgTdm[slotid][TeamCount][0] = 0;
        PubgTdm[slotid][TeamCount][1] = 0;
       
        GetPlayerHealth(playerid, health);
       
        if(health >= 70) strcat(hcolor, "~h~~g~");
        else if(health >= 31) strcat(hcolor, "~h~~y~");
        else if(health <= 30) strcat(hcolor, "~r~~h~");
       
        switch(pInfo[playerid][TeamID])
        {
            case TEAMBLUE:
            {
                PubgTdm[slotid][TeamCount[0]++;
               
                format(ShowString, sizeof(ShowString),"~y~~h~%i. ~w~%s %s %.0f%%% ~n~", PubgTdm[slotid][TeamCount][0]+1, _GetName(playerid), hcolor, health);
            }
           
            case TEAMRED:
            {
                PubgTdm[slotid][TeamCount][1]++;
               
                format(ShowString, sizeof(ShowString),"~y~~h~%i. ~w~%s %s %.0f%%% ~n~", PubgTdm[slotid][TeamCount][1]+1, _GetName(playerid), hcolor, health);
            }
           
            PlayerTextDrawSetString(playerid, TeamPlayersTD[playerid], ShowString);
            PlayerTextDrawShow(playerid, TeamPlayersTD[playerid]);
        }
    }
}
Symon is offline   Reply With Quote
Old 24/06/2019, 08:45 PM   #13
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: SetPlayerMaker

This function is called inside a loop like a example
Code:
for(new s =0; s < MAX_SLOTS; s++) 
{
   foreach(new i : Player)
   {
        ShowPlayerTeamPlayers(i, s); 
   }
}
So, with your code it will list out only the loop id name!
The Debug shows that the code works but the problem is with the textdraw! either Global or Player text!
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 08:47 PM   #14
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Can you post a screenshot?
Symon is offline   Reply With Quote
Old 24/06/2019, 09:02 PM   #15
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: SetPlayerMaker

Here
SiaReyes is offline   Reply With Quote
Old 24/06/2019, 09:21 PM   #16
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Try changing to global again, and try make a new textdraw, then test it.
Symon is offline   Reply With Quote
Old 25/06/2019, 05:50 AM   #17
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
Try changing to global again, and try make a new textdraw, then test it.
if i use gloabl, it will show my team players name in opponent team players list!

This is the issue i face in global!
SiaReyes is offline   Reply With Quote
Old 25/06/2019, 06:50 AM   #18
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 822
Reputation: 68
Default Re: SetPlayerMaker

Then recreate the textdraw. Make another one and see if it works.
Symon is offline   Reply With Quote
Old 25/06/2019, 06:54 AM   #19
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
Then recreate the textdraw. Make another one and see if it works.
Do you mean create another textdraw like same for red team and show the textdraw of blue and red team in that 1 sec timer, under each team loop?

Example :
Code:
1sectimer()
switch(pteam[ii][team])
 case blue:
{
   TxtSetString;
  Showtextdraw(ii, teambluetxt, string);
}
case red:
{
   TxtSetString;
  Showtextdraw[(ii, teamredtxt, string);
}
SiaReyes is offline   Reply With Quote
Old 25/06/2019, 07:41 AM   #20
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: SetPlayerMaker

Fixed!
SiaReyes 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 11:05 PM.


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