What's wrong with this code? -
Lilcuete - 10.06.2011
For some reason when i do /v buy i get unknown command for this part of my code
pawn Код:
new str1[1024];
new str2[1024];
new str3[1024];
new str4[1024];
new str5[1024];
new str6[1024];
new str7[1024];
if (PlayerInfo[playerid][pMember] == 1 && PlayerToPoint(30.0, playerid,2130.7195,-1147.0983,24.3918))
{
format(str1, sizeof str1, "Cop Car LS (42000) (596) Cop Car SF (43000) (597)\nCop Car LV (46000) (598) Ranger (48000) (599)\nFaggio (15000) (462), Freeway (28000) (463),PCJ-600 (55000) (461)\nMajestic (38000) (517), Tahoma (42000) (566)\nPicador (36000) (600), Voodoo (65000) (412)\nSabre (43000) (475), Buccaneer (36000) (518)");
format(str2, sizeof str2,"Bobcat (42000) (422), Mesa (45000) (500), Tornado (65000) (576)\nHuntley (89000) (579),Hermes (50000) (474), Greenwood (33000) (492), Blade (69000) (536), Merit (56000) (551) \n");
format(str3, sizeof str3,"Feltzer (89000) (533), Sentinel (69000) (405), Stratum (28000) (561),Washington (59000) (421)\n Broadway (75000) (575), Remmington (59000) (534) \n");
format(str4, sizeof str4, "Sunrise (35000) (550), Burrito (45000) (482), Glendale (35000) (466),Savanna (62000) (567)\nLandstalker (42000) (400), Slamvan (55000) (535), Yosemite (85000) (554) \n");
format(str5, sizeof str5, "Admiral (85000) (445), Virgo (34000) (491), Stafford (125000) (580)\nGlendale Shit (18000)(604), Camper (29000) (483), Super GT (250000) (506) \n");
format(str6, sizeof str6, "Hustler (125000) (545), Vincent (78000) (540), Blista Compact (38000) (496),Regina (26000) (479)\n Phoenix (310000) (603), Emperor (95000) (585), Tampa (58000) (549) \n");
format(str7, sizeof str7, "Primo (52000) (547), Intruder (45000) (546), Willard (36000) (529), Cadrona (48000) (527),Fortune (65000) (526)\nTaxi (50000) (420), Tow Truck (25000) (525), Nebula (59000) (516), Bike (1000) (509) \n");
format(string,sizeof(string),"%s\n%s\n%s\n%s\n%s\n%s\n%s",str1,str2,str3,str4,str5,str6,str7);
ShowPlayerDialog(playerid,1514,DIALOG_STYLE_MSGBOX,"Choose the type of the vehicles:",string,"Select","Leave");
}
}
but when i do change str1 and the other strings to new str1[256]; i don't get unknown command.In wiki.sa-mp.com
it says that max string length is 1024.
Please can someone tell me or show me how to fix this thanks.Sorry for my bad english.
Re: What's wrong with this code? -
Michael@Belgium - 10.06.2011
WTF XD 1024 is waaaaay to much !
pawn Код:
new string[128]; //128 is enough and use only 1 str(ing)
//And then after every 'format' you have to put
ShowPlayerDialog(playerid,1514,DIALOG_STYLE_MSGBOX,"Choose the type of the vehicles:",string,"Select","Leave");
AW: Re: What's wrong with this code? -
Lilcuete - 10.06.2011
Quote:
Originally Posted by Michael@Belgium
WTF XD 1024 is waaaaay to much ! And after every 'format' you have to put
pawn Код:
ShowPlayerDialog(playerid,1514,DIALOG_STYLE_MSGBOX,"Choose the type of the vehicles:",string,"Select","Leave");
|
No because as you see this
pawn Код:
format(string,sizeof(string),"%s\n%s\n%s\n%s\n%s\n%s\n%s",str1,str2,str3,str4,str5,str6,str7);
ShowPlayerDialog(playerid,1514,DIALOG_STYLE_MSGBOX,"Choose the type of the vehicles:",string,"Select","Leave");
Will make each line show just using one dialog box.I need to do 1024 because theres way too much words in the dialog.And some won't show when i do /v buy.
Re: What's wrong with this code? -
sleepysnowflake - 10.06.2011
Use strcat to combine strings ?
AW: What's wrong with this code? -
Lilcuete - 10.06.2011
Whats that and can you give me a example thanks
Re: What's wrong with this code? -
Sascha - 10.06.2011
btw... according to your text you are want the player to click onto the vehicle to select it eh?..
MSGBOX only shows a box with text..
use DIALOG_STYLE_LIST ^^
edit: oh and I guess this won't work out too well 'cause as far as I know the dialogs have limited lines (even the lists) and using all vehicles seems a bit too much lines to me..
may I suggest that you use another dialog to select the vehicle type and seperate them into types? like sports cars, etc..
AW: What's wrong with this code? -
Lilcuete - 10.06.2011
No im using that just to test it once they press ok it will come up with a DIALOG_INPUT so they will need to type in the vehicle id.
Re: What's wrong with this code? -
Sascha - 10.06.2011
ehm how much lines you have then? 50 or what? you think the screen is big enough to show them all? (I'm wondering how that would look.. epic :P) -- in case it works, can you make a screenshot and send me? (sgt@sapsgt.net)
AW: What's wrong with this code? -
Lilcuete - 10.06.2011
How much lines of what? the script or? and yea it would.
Re: What's wrong with this code? -
Mike Garber - 10.06.2011
The most characters you need is 301 (on the first string, (str1) 1024 on ALL these lines are way too much,
since EACH of them does NOT use 1024 cells, the longest one uses 301. So change the FIRST one to 301, the rest to around 200, since the second longest one is 200 cells.
Also you are trying to make a selection list, yet you are using DIALOG_STYLE_MSGBOX, and since you are making a new line on EVERY car model it will not work, as the dialog box cannot hold that many lines.
To make a list use DIALOG_STYLE_LIST, although it WILL NOT WORK still, as you are making it all combined.
I think ONE dialog list box can only hold 10 or 12 choices, for the rest you have to create new dialog lists.
Read the wiki, about dialog boxes and strings.