Dialog problem
#1

PHP код:
CMD:buyweapons(playerid,params[])
{
  new 
string[100+1000];
  
format(string,sizeof(string),"Deagle  Ammo: 100  Value: %d",Deagle);
  
format(string,sizeof(string),"Shotgun  Ammo: 200  Value: %d",Shotgun);
  
ShowPlayerDialog(playerid,100,DIALOG_STYLE_LIST,"Weapon system",string,"Select","Cancel");
  return 
1;

Only the Shotgun show not the both why?
Reply
#2

PHP код:
CMD:buyweapons(playerid,params[]) 

  new 
string[400];//ur wish 
  
format(string,sizeof(string),"Deagle  Ammo: 100  Value: %d\nShotgun  Ammo: 200  Value: %d",Deagle,Shotgun); 
  
ShowPlayerDialog(playerid,100,DIALOG_STYLE_LIST,"Weapon system",string,"Select","Cancel"); 
  return 
1

Reply
#3

Why are you using
PHP код:
string[100+1000
?
And you should use the method give above.
"Weapon1\nWeapon2"
Reply
#4

Use this.

PHP код:
new eString9999 // put this at your variables
CMD:buyweaponsplayeridparams[ ] )
{
    
eString] = EOS;
    
formateStringsizeofeString ),"Deagle  Ammo: 100  Value: %d\n"Deagle );
    
formateStringsizeofeString ),"%sShotgun  Ammo: 200  Value: %d"eStringShotgun );
    
ShowPlayerDialogplayerid100DIALOG_STYLE_LIST"Weapon system"eString"Select" "Cancel" );
    return 
1;

Reply
#5

@Shaheen and @FallenGirl, your codes can be optimized very heavily. You should never use format for copying strings and, something like weapon dialog can be done without doing the hard, long and time taking method.

@Loinal, You need to read AND UNDERSTAND about arrays and enumerators, and then try to make your code using them, You would be able to make your code in just a few lines. Also, it's better to use EasyDialogs by Emmet_.

P.S: I won't post the array version of the code just because this kid will copy it.
Reply
#6

Quote:
Originally Posted by Logic_
Посмотреть сообщение
@Shaheen and @FallenGirl, your codes can be optimized very heavily. You should never use format for copying strings and doing something like weapon dialog can be done without doing the hard, long and time taking method.

@Loinal, You need to read AND UNDERSTAND about arrays and enumerators, and then try to make your code using them, You would be able to make your code in just a few lines. Also, it's better to use EasyDialogs buy Emmet_.

P.S: I won't post the array version of the code just because this kid will copy it.
What do you mean by kid?
Reply
#7

You need strcat to show the Deagle & Shotgun :

PHP код:
CMD:buyweapons(playerid,params[]) 

  new 
string[256], tmp[256]; 
  
format(tmp,sizeof(tmp),"Deagle  Ammo: 100  Value: %d\n",Deagle); 
  
strcat(stringtmp);
  
format(tmp,sizeof(tmp),"Shotgun  Ammo: 200  Value: %d\n",Shotgun);
  
strcat(stringtmp);
  
ShowPlayerDialog(playerid,100,DIALOG_STYLE_LIST,"Weapon system",string,"Select","Cancel"); 
  return 
1

Try it, maybe it will working
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)