dialog tablist headers
#1

PHP код:
CMD:market(playeridparams[])
{
    
SendClientMessage(playerid, -1"{CECEF6}* You are viewing the market (shop) items.");
    
ShowPlayerDialog(playerid8DIALOG_STYLE_TABLIST_HEADERS"Market (Shop)",
    
"Slot\tItem \tPrice \tAmmo\n\
    1.\tDesert Eagle\t15 Points\t100\n\
    2.\tShotgun\t10 Points\t40\n\
    3.\tCombat - Shotgun\t40 Points\t100\n\
    4.\tM4\t10 Points\t90\n\
    5.\tSniper\t30 Points\t30\n\
    6.\tGrenades\t60 Points\t30\n\
    7.\tAK - 47\t150 Points\t30\n\
    8.\tCountry - Rifle\t30 Points\t30\n\
    9.\tSilenced - 9mm\t70 Point\t170\n\
    10.\tParachute\t30 Points\t-\n\
    11.\tJetpack\t30 Points\t-\n\
    12.\tTear - Gas\t60 Points\t5\n\
    13.\tMolotov - Cocktail    \t30 Points\t5\n\
    14.\tDildo\t1 Point\t-\n\
    15.\tPurple - Dildo\t1 Point\t-\n\
    16.\tVibrator\t1 Point\t-\n\
    17.\tSilver Vibrator\t1 Point\t-\n\
    18.\tFull Health\t150 Points\t-"
,
    
    
"Buy""Leave");
      return 
1;

Since it's kinda long, how do you break the code in strcat? i know the meaning, can i get an example on breaking in parts that code?
Reply
#2

I do it like this:
PHP код:
format(str,sizeof(str),"# %s\t%s\t%s\t%s\n",WarningInfo[i][WarningDate],WarningInfo[i][WarningName],WarningInfo[i][WarningBy],dini_Get(file"WarningReason"));
strcat(string2,str);
format(str,sizeof(str),"# %s\t%s\t%s\t%s\n",WarningInfo[i][WarningDate],WarningInfo[i][WarningName],WarningInfo[i][WarningBy],dini_Get(file"WarningReason"));
strcat(string2,str);
format(str,sizeof(str),"Date\tName\tWarned By\tReason\n%s"string2);
strcat(string,str);
ShowPlayerDialog(playeridDIALOG_ADMINPANEL_WARN+3DIALOG_STYLE_TABLIST_HEADERS"Warnings"string"Select""Back"); 
You will have to edit it to yours
Reply
#3

Oh, thanks appreciated
Reply
#4

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
I do it like this:
PHP код:
format(str,sizeof(str),"# %s\t%s\t%s\t%s\n",WarningInfo[i][WarningDate],WarningInfo[i][WarningName],WarningInfo[i][WarningBy],dini_Get(file"WarningReason"));
strcat(string2,str);
format(str,sizeof(str),"# %s\t%s\t%s\t%s\n",WarningInfo[i][WarningDate],WarningInfo[i][WarningName],WarningInfo[i][WarningBy],dini_Get(file"WarningReason"));
strcat(string2,str);
format(str,sizeof(str),"Date\tName\tWarned By\tReason\n%s"string2);
strcat(string,str);
ShowPlayerDialog(playeridDIALOG_ADMINPANEL_WARN+3DIALOG_STYLE_TABLIST_HEADERS"Warnings"string"Select""Back"); 
You will have to edit it to yours
Bad example.

This is only useful if you need to format values or other strings into the main string that need substitution or padding.

Furthermore in this example you don't even need strcat, since you can format the original string into the beginning of the next (so strcat can be left out completely).

In wallens case he can use only strcat:

Код:
strcat(string, "Line 1\n");
strcat(string, "Line 2\n");
// Etc..
Sorry if this is what you intended to suggest, but the format is really not neccessary here.
Reply
#5

PHP код:
    new string[1500];
    
strcat(string"Slot\tItem \tPrice \tAmmo\n\");
    strcat(string, "
1.\tDesert Eagle\t15 Points\t100\n\");
    strcat(string, "
2.\tShotgun\t10 Points\t40\n\");
    strcat(string, "
3.\tCombat Shotgun\t40 Points\t100\n\");
    strcat(string, "
4.\tM4\t10 Points\t90\n\");
    strcat(string, "
5.\tSniper\t30 Points\t30\n\");
    strcat(string, "
6.\tGrenades\t60 Points\t30\n\");
    strcat(string, "
7.\tAK 47\t150 Points\t30\n\");
    strcat(string, "
8.\tCountry Rifle\t30 Points\t30\n\");
    strcat(string, "
9.\tSilenced 9mm\t70 Point\t170\n\");
    strcat(string, "
10.\tParachute\t30 Points\t-\n\");
    strcat(string, "
11.\tJetpack\t30 Points\t-\n\");
    strcat(string, "
12.\tTear Gas\t60 Points\t5\n\");
    strcat(string, "
13.\tMolotov Cocktail    \t30 Points\t5\n\");
    strcat(string, "
14.\tDildo\t1 Point\t-\n\");
    strcat(string, "
15.\tPurple Dildo\t1 Point\t-\n\");
    strcat(string, "
16.\tVibrator\t1 Point\t-\n\");
    strcat(string, "
17.\tSilver Vibrator\t1 Point\t-\n\");
    strcat(string, "
18.\tFull Health\t150 Points\t-");
    
    ShowPlayerDialog(playerid,8, DIALOG_STYLE_TABLIST_HEADERS, "
Market (Shop)", string, "Buy", "Leave"); 
Код:
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(2809) : warning 217: loose indentation
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(2824) : warning 217: loose indentation
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(2929) : warning 217: loose indentation
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(4091) : error 075: input line too long (after substitutions)
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(4099) : error 037: invalid string (possibly non-terminated string)
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(4099) : warning 215: expression has no effect
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(4099) : error 001: expected token: ";", but found "\"
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(4099) : error 029: invalid expression, assumed zero
C:\Users\Wallen\Desktop\SA-MP\LS DM\gamemodes\DBv1.pwn(4099) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#6

remove \ at the last for every strcat
Reply
#7

Thanks works !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)