Textdraw List |Help|
#1

hey guys ,
im trying to do in my zombies mode if player reach "evac" (evac = its like safe zone) his name will be on the
5 players that reached evac
PHP код:
new PlayerCheck[MAX_PLAYERS];
new 
Player1;
new 
Player2;
new 
Player3;
new 
Player4;
new 
Player5
PHP код:
if(team[playerid] == TEAM_HUMAN && Player1 == && PlayerCheck[playerid] == 0)
    {
    
TextDrawSetString(Evacplayer1,PlayerName(playerid));
 
Player1 1;
 
PlayerCheck[playerid] = 1;
 return 
0;
    }
    if(
team[playerid] == TEAM_HUMAN && Player2 == && PlayerCheck[playerid] == 0)
    {
    
TextDrawSetString(Evacplayer2,PlayerName(playerid));
 
Player2 1;
 
PlayerCheck[playerid] = 1;
 return 
0;
    }
    
if(
team[playerid] == TEAM_HUMAN && Player3 == && PlayerCheck[playerid] == 0)
    {
    
TextDrawSetString(Evacplayer3,PlayerName(playerid));
 
Player3 1;
 
PlayerCheck[playerid] = 1;
return 
0;
    }
if(
team[playerid] == TEAM_HUMAN && Player4 == && PlayerCheck[playerid] == 0)
    {
    
TextDrawSetString(Evacplayer4,PlayerName(playerid));
 
Player4 1;
 
PlayerCheck[playerid] = 1;
 return 
0;
    }
if(
team[playerid] == TEAM_HUMAN && Player5 == && PlayerCheck[playerid] == 0)
    {
    
TextDrawSetString(Evacplayer5,PlayerName(playerid));
 
Player5 1;
 
PlayerCheck[playerid] = 1;
 return 
0;
    } 
picture:

that adding my name if i reach evac but if someone reach after me , that just deleted my name from Player 1..
or i tried it with 3 players, the last one that reached evac just kicked me and player 2 from the list and he was Player 1
Reply
#2

Are you checking if the player slot is used?

I haven't read your code thoroughly and am on mobile but it should be something like

For(new I = 0; I < [max players in zombies]; I++)
{
If (!Player[I])
{
...set your textdraw string here for the players name.
}
}

Note replaced Player1. .. Player2... so on with an array: Player
Reply
#3

Quote:
Originally Posted by iiNzTicTx
Посмотреть сообщение
Are you checking if the player slot is used?

I haven't read your code thoroughly and am on mobile but it should be something like

For(new I = 0; I < [max players in zombies]; I++)
{
If (!Player[I])
{
...set your textdraw string here for the players name.
}
}

Note replaced Player1. .. Player2... so on with an array: Player
i tried this:
new Player1;
new Player2;
new Player3;
new Player4;
new Player5;

When new map starting: Player1 = 0;
PHP код:
if(team[playerid] == TEAM_HUMAN && Player1 == && PlayerCheck[playerid] == 0// checking if Player1 in the list available and if PlayerCheck = 0 
    
{
    
TextDrawSetString(Evacplayer1,PlayerName(playerid));
 
Player1 1;
 
PlayerCheck[playerid] = 1;
 return 
0;
    } 
i added this: PlayerCheck[playerid] because i think without it the player name will be in all 5 players list
Reply
#4

pawn Код:
//create a checkpoint with steamer plugin and add a callback OnPlayerEnterDynamicCP(playerid, checkpointid);
//instead of OnPlayerEnterCheckpoint();

new text_classification[5] = {
       Text:Evacplayer1,
       Text:Evacplayer2,
       Text:Evacplayer3,
       Text:Evacplayer4,
       Text:Evacplayer5
};

new classifications[MAX_PLAYERS][5];

//OnPlayerEnterDynamicCP(playerid, checkpointid);

if(checkpointid == evac){
   for(new i = 0; i < 5; i++){
       if(classifications[playerid][i] != 0)continue;
       classifications[playerid][i] += 1;
       TextDrawSetString(text_classification[i],PlayerName(playerid));
       break;
   }
}
Reply
#5

Quote:
Originally Posted by Galletziz
Посмотреть сообщение
pawn Код:
//create a checkpoint with steamer plugin and add a callback OnPlayerEnterDynamicCP(playerid, checkpointid);
//instead of OnPlayerEnterCheckpoint();

new text_classification[5] = {
       Text:Evacplayer1,
       Text:Evacplayer2,
       Text:Evacplayer3,
       Text:Evacplayer4,
       Text:Evacplayer5
};

new classifications[MAX_PLAYERS][5];

//OnPlayerEnterDynamicCP(playerid, checkpointid);

if(checkpointid == evac){
   for(new i = 0; i < 5; i++){
       if(classifications[playerid][i] != 0)continue;
       classifications[playerid][i] += 1;
       TextDrawSetString(text_classification[i],PlayerName(playerid));
       break;
   }
}
Got error: error 008: must be a constant expression; assumed zero
In OnPlayerEnterDynamicCP:
PHP код:
public OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
team[playerid] == TEAM_HUMAN)
    {
        new 
string[256];
        
SetPlayerInterior(playerid,3);
        
SetPlayerPos(playerid,963.9642,-53.1761,1001.1246);
        
format(string,sizeof(string), ""chat""COL_YELLOW" %s made it to evacuation point and has received 3 Coins and 300 XP!",PlayerName(playerid));
        
SendClientMessageToAll(-1,string);
        
DisablePlayerCheckpoint(playerid);
        
CurePlayer(playerid);
        
GivePlayerXP(playerid,300);
        
pInfo[playerid][pEvac]++;
        
pInfo[playerid][pCoins] += 3;
        
SetPlayerColor(playerid,COLOR_YELLOW);
        
TextDrawSetString(Evacplayers,"5 Players that reached Evac:");
        
TextDrawSetString(Allevacplayers,"Player: 1 Player: 2 Player: 3 Player: 4 Player: 5");
        
TextDrawSetString(Evacplayer1,"None");
        
TextDrawSetString(Evacplayer1l,"------------------------------------------");
        
TextDrawSetString(Evacplayer2,"None");
        
TextDrawSetString(Evacplayer2l,"------------------------------------------");
        
TextDrawSetString(Evacplayer3,"None");
        
TextDrawSetString(Evacplayer3l,"------------------------------------------");
        
TextDrawSetString(Evacplayer4,"None");
        
TextDrawSetString(Evacplayer4l,"------------------------------------------");
        
TextDrawSetString(Evacplayer5,"None");
        
TextDrawSetString(Evacplayer5l,"------------------------------------------");
        
TextDrawSetString(Evacnexus,"Nexus Apocalypse");
for(new 
05i++){
       if(
classifications[playerid][i] != 0)continue;
       
classifications[playerid][i] += 1;
       
TextDrawSetString(text_classification[i],PlayerName(playerid));
       }
    }
    return 
1;

Up:
PHP код:
new Text:Evacplayers;
new 
Text:Allevacplayers;
new 
Text:Evacplayer1;
new 
Text:Evacplayer1l;
new 
Text:Evacplayer2;
new 
Text:Evacplayer2l;
new 
Text:Evacplayer3;
new 
Text:Evacplayer3l;
new 
Text:Evacplayer4;
new 
Text:Evacplayer4l;
new 
Text:Evacplayer5;
new 
Text:Evacplayer5l;
new 
Text:Evacnexus
PHP код:
new text_classification[5] =
{
       
Text:Evacplayer1,
       
Text:Evacplayer2,
       
Text:Evacplayer3,
       
Text:Evacplayer4,
       
Text:Evacplayer5
}; 
Reply
#6

anyone maybe know how to fix ? :P
Reply
#7

You don't haven't understand.. з_з

pawn Код:
//above OnGameModeInit()

new Text:Evacplayers;
new Text:Allevacplayers;
new Text:Evacplayerl;
new Text:Evacnexus;  

new text_classification[5]=
{
       Text:Evacplayer1,
       Text:Evacplayer2,
       Text:Evacplayer3,
       Text:Evacplayer4,
       Text:Evacplayer5
};  

new classifications[MAX_PLAYERS][5];

//OnGameModeInit()
new evac_cp_id = CreateDynamicCP(x,y,z,3.5,-1,-1,-1,100.0); // You must change coords where x,y,z.

//OnPlayerEnterDynamicCP(playerid, checkpointid)

        if(checkpointid == evac_cp_id){
                if(team[playerid] == TEAM_HUMAN)
                {
                        new string[256];
                        SetPlayerInterior(playerid,3);
                        SetPlayerPos(playerid,963.9642,-53.1761,1001.1246);
                        format(string,sizeof(string), ""chat""COL_YELLOW" %s made it to evacuation point and has received 3 Coins and 300 XP!",PlayerName(playerid));
                        SendClientMessageToAll(-1,string);
                        DisablePlayerCheckpoint(playerid);
                        CurePlayer(playerid);
                        GivePlayerXP(playerid,300);
                        pInfo[playerid][pEvac]++;
                        pInfo[playerid][pCoins] += 3;
                        SetPlayerColor(playerid,COLOR_YELLOW);

                        TextDrawSetString(Evacplayers,"5 Players that reached Evac:");
                        TextDrawSetString(Allevacplayers,"Player: 1 Player: 2 Player: 3 Player: 4 Player: 5");
 
                        for(new i = 0; i < 5; i++){
                              if(classifications[playerid][i] != 0)continue;
                              classifications[playerid][i] += 1;
                              new pname[MAX_PLAYER_NAME];
                              GetPlayerName(playerid,pname,sizeof(pname));
                              TextDrawSetString(text_classification[i],pname);
                              TextDrawSetString(Evacplayerl,"------------------------------------------");
                              break;
                       }
                       
                        TextDrawSetString(Evacnexus,"Nexus Apocalypse");
                }
        }
 
    return 1;
}
Reply
#8

Quote:
Originally Posted by Galletziz
Посмотреть сообщение
You don't haven't understand.. з_з

pawn Код:
//above OnGameModeInit()

new Text:Evacplayers;
new Text:Allevacplayers;
new Text:Evacplayerl;
new Text:Evacnexus;  

new text_classification[5]=
{
       Text:Evacplayer1,
       Text:Evacplayer2,
       Text:Evacplayer3,
       Text:Evacplayer4,
       Text:Evacplayer5
};  

new classifications[MAX_PLAYERS][5];

//OnGameModeInit()
new evac_cp_id = CreateDynamicCP(x,y,z,3.5,-1,-1,-1,100.0); // You must change coords where x,y,z.

//OnPlayerEnterDynamicCP(playerid, checkpointid)

        if(checkpointid == evac_cp_id){
                if(team[playerid] == TEAM_HUMAN)
                {
                        new string[256];
                        SetPlayerInterior(playerid,3);
                        SetPlayerPos(playerid,963.9642,-53.1761,1001.1246);
                        format(string,sizeof(string), ""chat""COL_YELLOW" %s made it to evacuation point and has received 3 Coins and 300 XP!",PlayerName(playerid));
                        SendClientMessageToAll(-1,string);
                        DisablePlayerCheckpoint(playerid);
                        CurePlayer(playerid);
                        GivePlayerXP(playerid,300);
                        pInfo[playerid][pEvac]++;
                        pInfo[playerid][pCoins] += 3;
                        SetPlayerColor(playerid,COLOR_YELLOW);

                        TextDrawSetString(Evacplayers,"5 Players that reached Evac:");
                        TextDrawSetString(Allevacplayers,"Player: 1 Player: 2 Player: 3 Player: 4 Player: 5");
 
                        for(new i = 0; i < 5; i++){
                              if(classifications[playerid][i] != 0)continue;
                              classifications[playerid][i] += 1;
                              new pname[MAX_PLAYER_NAME];
                              GetPlayerName(playerid,pname,sizeof(pname));
                              TextDrawSetString(text_classification[i],pname);
                              TextDrawSetString(Evacplayerl,"------------------------------------------");
                              break;
                       }
                       
                        TextDrawSetString(Evacnexus,"Nexus Apocalypse");
                }
        }
 
    return 1;
}
Done everything . still
error 008: must be a constant expression; assumed zero
the error is here:
PHP код:
new text_classification[5]=
{
       
Text:Evacplayer1,
       
Text:Evacplayer2,
       
Text:Evacplayer3,
       
Text:Evacplayer4,
       
Text:Evacplayer5
}; 
Reply
#9

sorry try with this...

pawn Код:
new Text:text_classification[5]=
{
       Text:Evacplayer1,
       Text:Evacplayer2,
       Text:Evacplayer3,
       Text:Evacplayer4,
       Text:Evacplayer5
};
Reply
#10

Quote:
Originally Posted by Galletziz
Посмотреть сообщение
sorry try with this...

pawn Код:
new Text:text_classification[5]=
{
       Text:Evacplayer1,
       Text:Evacplayer2,
       Text:Evacplayer3,
       Text:Evacplayer4,
       Text:Evacplayer5
};
Still :P
weird ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)