Long MSGBOX Help
#1

Okay so I have tried to make a longer messagebox
Код:
if(strcmp(cmd, "/help", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        strcat(HELP1, 	"General  : /rules /doorbell /time /enter /exit /fish /describe /lamp /inv\n");
    		strcat(HELP1, 	"General  : /doorshout /createnote /shownotes /putgun /takegun /pickreward\n");
    		strcat(HELP1, 	"General  : /pay /putbeer /takebeer /putwine /takewine /putciggy /takeciggy\n");
    		strcat(HELP1, 	"General  : /gateopen /gateclose /calc /tog /hidemenu /factionon /robbiz\n");
    		strcat(HELP1, 	"CarHelp  : /engine /fill /wi(ndows) /seatbelt /trunk /fuel /gascan /payticket /payimpound\n");
    		strcat(HELP1, 	"AnimHelp : /animlist /taunt /walkstyle /eat /drink /sunglasses\n");
    		strcat(HELP1, 	"Account  : /stats /changepass /upgrade /resetupgrades /dropmoney /dropgun /dropmats /dropdrugs\n");
    		strcat(HELP1, 	"Char     : /skills /clothes /usedrugs /appearance /myage /skinids /pickitem\n");
    		strcat(HELP1, 	"Requests : /admins /helpers /report \n");
    		ShowPlayerDialog(playerid,DIALOG_HELPGEN,DIALOG_STYLE_MSGBOX, "Command Help", HELP1,"Okay","");
            }
            return 1;
        }
is this right? I also added the new function at the top of my script...
Код:
new HELP1[1024];
Reply
#2

1) How can a player, who enters a command, be disconnected? The IsPlayerConnected check is not necessary - there's no way OnPlayerCommandText gets called with an unconnected player. Also the SA-MP server doesn't have more than one thread for script execution, so things do not get messed up like that.
2) The first strcat(HELP1, ...) can be replaced by a simple assignment like HELP1 = "General : ...";
3) I really hope that you don't declare arrays like HELP1[1024], COMMANDS[1024], COMMANDS2[1024] at the top of your script. If you are, you're wasting space (and your .amx gets huge) and making your compilation slow. One string, perhaps string[1024] will do.
4) You could try lessening the amount of strcat calls you have. I can't remember the line length limit from the top of my head, but perhaps it is 512 characters? There are some compiler mods that allow it to go up to 4096, but if you're not willing to do that, I can tell that you could fit a few more lines into one strcat call.
Reply
#3

Quote:
Originally Posted by AndreT
Посмотреть сообщение
1) How can a player, who enters a command, be disconnected? The IsPlayerConnected check is not necessary - there's no way OnPlayerCommandText gets called with an unconnected player.
LOL I only needed help with the inside of the code,not the stupid copy and paste I did XD,I know you cant use a command if your not connected :L am using zcmd anyway too....

Quote:
Originally Posted by AndreT
Посмотреть сообщение
1)
Also the SA-MP server doesn't have more than one thread for script execution, so things do not get messed up like that.
Okay...

Quote:
Originally Posted by AndreT
Посмотреть сообщение
1)
2) The first strcat(HELP1, ...) can be replaced by a simple assignment like HELP1 = "General : ...";
I know that :P it just looks more better this way :P

Quote:
Originally Posted by AndreT
Посмотреть сообщение
1)
3) I really hope that you don't declare arrays like HELP1[1024], COMMANDS[1024], COMMANDS2[1024] at the top of your script. If you are, you're wasting space (and your .amx gets huge) and making your compilation slow. One string, perhaps string[1024] will do.
Why not? I am gonna be making this for more than 1 rank,I need to do it for alot of different dialogs,not just this one,I am making the command vary on its outcome depending on what admin level,vip level,helper level,job,faction they are O.o if you know what I mean by that.

Quote:
Originally Posted by AndreT
Посмотреть сообщение
1)
4) You could try lessening the amount of strcat calls you have. I can't remember the line length limit from the top of my head, but perhaps it is 512 characters? There are some compiler mods that allow it to go up to 4096, but if you're not willing to do that, I can tell that you could fit a few more lines into one strcat call.
I need them like that because they are categorized.... :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)