SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/11/2019, 08:59 PM   #1
SecretB
Little Clucker
 
Join Date: Jul 2015
Posts: 24
Reputation: 0
Default Dialog Error

Hey, so i have that code which gives no output error yet doesn't works. The only thing that appears when i executive the command is "Switch To Roleplay" inside the dialog, i don't know why it doesn't works. If anyone could help, i'd be very thankful.


Code:
CMD:secretacp(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2)
	{
	    return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	if(PlayerInfo[playerid][pAdmin] == 9)
	{
	    return ShowPlayerDialog(playerid, DIALOG_OEDACPIG, DIALOG_STYLE_LIST, "OED Control Panel", "Dispatch RCON \n Disable Anticheat\n Enable Anticheat\n Restart Server\n Reset a System\n Mass Unban\n Change Mode", "Select", "Cancel");
	}
	if(PlayerInfo[playerid][pAdmin] == 10)
	{
		new oedDialog[196];
		format(oedDialog, sizeof(oedDialog), "Dispatch RCON\n");
		if(gAnticheat == 1)
		{
			format(oedDialog, sizeof(oedDialog), "Disable Anticheat\n");
		}
		else
		{
			format(oedDialog, sizeof(oedDialog), "Enable Anticheat\n");
		}
		format(oedDialog, sizeof(oedDialog), "Restart Server\n");
		format(oedDialog, sizeof(oedDialog), "Reset a System\n");
		format(oedDialog, sizeof(oedDialog), "Mass Unban\n");
		//format(oedDialog, sizeof(oedDialog), "Welcome back to our server, %s!\n", pName);
		if(hServerMode == 0)
		{
			format(oedDialog, sizeof(oedDialog), "Switch to RPG\n");
		}
		if(hServerMode == 1)
		{
			format(oedDialog, sizeof(oedDialog), "Switch to Roleplay\n");
		}
		ShowPlayerDialog(playerid, DIALOG_OEDACPIG, DIALOG_STYLE_LIST, "OED Control Panel", oedDialog, "Select", "Cancel");
	}
    return 1;
}
__________________
SecretB is offline   Reply With Quote
Old 08/11/2019, 10:08 PM   #2
Vizi10
Huge Clucker
 
Join Date: May 2017
Location: Iran
Posts: 215
Reputation: 7
Default Re: Dialog Error

You should use https://wiki.sa-mp.com/wiki/Strcat

pawn Code:
new DIALOG[800], oedDialog[128];
strcat(DIALOG, "Dispatch RCON\n");

format(oedDialog, sizeof(oedDialog), "%s Anticheat\n", gAnticheat == 1 ? ("Disable") : ("Enable"));
strcat(DIALOG, oedDialog);

strcat(DIALOG, "Restart Server\n");
strcat(DIALOG, "Reset a System\n");
strcat(DIALOG, "Mass Unban\n");

format(oedDialog, sizeof(oedDialog), "Switch to %s\n", hServerMode == 0 ? ("RPG") : ("Roleplay"));
strcat(DIALOG, oedDialog);

ShowPlayerDialog(playerid, DIALOG_OEDACPIG, DIALOG_STYLE_LIST, "OED Control Panel", DIALOG, "Select", "Cancel");
Vizi10 is offline   Reply With Quote
Old 08/11/2019, 10:53 PM   #3
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,449
Reputation: 1628
Default Re: Dialog Error

That is terrible advice. Not the strcat part but the fact you created an extra variable, you format it and then you join that formatted string to another array.
One variable is enough. You can fornat a string and then format it again, including itself in the format.

Code:
new myArray[32];
strcat(myArray, "Hello world!);
format(myArray, 32, "%s- that's %d", myArray, strlen(myArray));
strcat(myArray, " chars!");
print(myArray);
This would print: Hello world!- that's 12 chars!
Kwarde is offline   Reply With Quote
Old 10/11/2019, 03:18 PM   #4
SecretB
Little Clucker
 
Join Date: Jul 2015
Posts: 24
Reputation: 0
Default Re: Dialog Error

Ty for the help from both of you, Rep ++
__________________
SecretB is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PM error dialog kosa451 Scripting Help 4 18/06/2014 06:53 PM
dialog help when run get error Aloushi Scripting Help 2 17/01/2012 05:58 PM
Dialog error, dialog does'nt show up. MathijsS Scripting Help 11 27/11/2011 07:28 PM
Trafipax error, crash te pawn, Dialog error? Finging Help Archive 1 21/06/2011 11:21 AM
Error with dialog. iLcke Help Archive 5 06/10/2010 04:12 AM


All times are GMT. The time now is 04:45 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.