help Dialog list
#1

hello i' tryed to make dialog list compile fine but IG dosent send the text and ID's'

apparently the problem is here

PHP код:
 cPMRec[playerid] ] ++;
aPMRec[playerid] ] [ cPMRec[playerid] ]  ] [PMID]  = cPMRec[playerid] ];
format(aPMRec[playerid] ]  [ cPMRec[playerid] ]  ] [FromName], 10GetName(playerid));
aPMRec[playerid] ]  [ cPMRec[playerid] ]  ] [FromID] = playerid;
format(aPMRec[playerid] ]  [ cPMRec[playerid] ]  ] [Text] ,200inputtext); 
the PMID and player id work but Text,playerName dont work

recuperate info code

PHP код:
for(new MAX_PMi++) {
        
format(text,sizeof text"{FCF80B}azPM ID : {FC0B2F}%i {FCF80B}from {FC0B2F}'%s' ID: {FC0B2F}[%i] {FF2EE1}TEXT : %s\n "
        
,aPMRec[playerid] ] [i] [PMID] , aPMRec[playerid] ]  [i] [FromName],aPMRec[playerid] ]  [i] [FromID],aPMRec[playerid] ]  [i] [Text]);
    }
    
strcat(s,text);
    
ShowPlayerDialog(playerid22DIALOG_STYLE_LIST"{FF2EE1}[Az-Pm] PMS :"s"Reply""Close"); 
help me plz and
Thanks !

Edit : i tryed this
PHP код:
          cPMRec[playerid] ] ++;
               for(new 
i=0iMAX_PMi++)
            {
                
aPMRec[playerid]][i][PMID]  = cPMRec[playerid] ];
                
format(aPMRec[playerid]][i] [FromName], 10GetName(playerid));
                
aPMRec[playerid]][i][FromID] = playerid;
                
format(aPMRec[playerid]][i][Text] ,200inputtext);
            } 
result it give me just the last message i'woulde like make it to give me all messages


how to made that and thanks again
Reply
#2

Show us aPM , cPM and other codes..
Reply
#3

You used strcat outside of the loop so it actually shows the last item. No need of using strcat though, format is just fine:
PHP код:
s[0] = EOS;
for(new 
MAX_PMi++) 
{
    
format(s,sizeof s"%s{FCF80B}azPM ID : {FC0B2F}%i {FCF80B}from {FC0B2F}'%s' ID: {FC0B2F}[%i] {FF2EE1}TEXT : %s\n",
    
saPMRec[playerid] ] [i] [PMID] , aPMRec[playerid] ]  [i] [FromName],aPMRec[playerid] ]  [i] [FromID],aPMRec[playerid] ]  [i] [Text]);
}
ShowPlayerDialog(playerid22DIALOG_STYLE_LIST"{FF2EE1}[Az-Pm] PMS :"s"Reply""Close"); 
Reply
#4

PHP код:
enum AzPmInfo
{
    
PMID,
    
FromName[10],
    
FromID,
    
Text[200],
}
new 
aPM[MAX_PLAYERS][MAX_PM][AzPmInfo]; 
PHP код:
new Rec[MAX_PLAYERS],PlayerText:Az[3][MAX_PLAYERS],
    
cPM[MAX_PLAYERS]

PHP код:
Rec[playerid] = clickedplayerid// the id of Rec[playerid] 
EDIT :

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You used strcat outside of the loop so it actually shows the last item. No need of using strcat though, format is just fine:
PHP код:
s[0] = EOS;
for(new 
MAX_PMi++) 
{
    
format(s,sizeof s"%s{FCF80B}azPM ID : {FC0B2F}%i {FCF80B}from {FC0B2F}'%s' ID: {FC0B2F}[%i] {FF2EE1}TEXT : %s\n",
    
saPMRec[playerid] ] [i] [PMID] , aPMRec[playerid] ]  [i] [FromName],aPMRec[playerid] ]  [i] [FromID],aPMRec[playerid] ]  [i] [Text]);
}
ShowPlayerDialog(playerid22DIALOG_STYLE_LIST"{FF2EE1}[Az-Pm] PMS :"s"Reply""Close"); 
thank you but now i have a lot off message lol

Reply
#5

On player connecting you reset variables (to INVALID_PLAYER_ID, -1 or whatever you have written). Check inside the loop if the other's playerid is valid and use format, otherwise skip the loop with continue;

About the same messages, it'd print what you've stored to those arrays so make sure you reset and you set them correctly.
Reply
#6

Reset varaibles like this ?

PHP код:
public OnPlayerConnect(playerid)
{
    for(new 
i=0iMAX_PMi++)
    {
        
aPMplayerid ][i][PMID]  = -1;
        
aPMplayerid ][i][FromID] = -1;
    }
    
Rec[playerid] = -1;
    
cPM[playerid]= 0;
    return 
1;

Reply
#7

Yes and you need to reset the strings too.

You can then check if PMID is not -1 and continue formatting the text.
Reply
#8

thank you now i have just the first msg

PHP код:
for(new i=0iMAX_PMi++)
            {
                if(
aPMRec[playerid]][i][PMID] != -) continue;
                if(
aPMRec[playerid]][i][FromName] != -) continue;
                if(
aPMRec[playerid]][i][FromID] != -) continue;
                if(
aPMRec[playerid]][i][Text] != -) continue;
                
aPMRec[playerid]][i][PMID]  = cPMRec[playerid] ];
                
format(aPMRec[playerid]][i] [FromName], 10GetName(playerid));
                
aPMRec[playerid]][i][FromID] = playerid;
                
format(aPMRec[playerid]][i][Text] ,200inputtext);
            } 
Reply
#9

MAX_PM = how many?
Reply
#10

You set the data for the first free slot and then you have to stop the loop using break; at the end of it (in the loop though). You just need to check if PMID is not -1 and skip it, the rest are not necessary so remove them (plus, strings cannot be checked as integeres - you'd need to check if it's null).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)