SA-MP Forums Archive
Can anyone help me? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can anyone help me? (/showthread.php?tid=333877)



Can anyone help me? - Tass007 - 13.04.2012

I'm trying to input this script
Код:
	    if(dialogid == DIALOGCLAN)
		{
		    if(response)
		    {
		        if(!strlen(inputtext))
				{
				    new nome[24];
		        	GetPlayerName(playerid, nome, 24);
					format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the clan password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the clan password and confirm.", nome);
					ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
					return 0;
				}
		        if(!strcmp(inputtext, PASSWORDCLAN, false))
		        {
		            new nome[24];
		        	GetPlayerName(playerid, nome, 24);
					format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has confirmed to be part of the clan.", nome);
					SendClientMessageToAll(BLU_CHIARO, stringa);
					SendClientMessage(playerid, BLU_CHIARO, "You have confirmed to be part of the clan!");
	   				PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
					return 1;
				}
				else
				{
	   				new nome[24];
		        	GetPlayerName(playerid, nome, 24);
					format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
	 				SendClientMessageToAll(BLU_CHIARO, stringa);
	 				SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
	  				Kick(playerid);
	       		}
			}
			else if(!response)
			{
			    new nome[24];
	     		GetPlayerName(playerid, nome, 24);
			    SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
	            format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
				SendClientMessageToAll(BLU_CHIARO, stringa);
				Kick(playerid);
				PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
			}
		}
	}
Into This Dialog Script
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
	new len=strlen(inputtext);
	for(new i=0;i<len;i++)
	    if(inputtext[i]=='%')
	        inputtext[i]='#';
	if(IsPlayerAdmin(playerid)){
		if(dialogid==DIALOG_CFG){
		    if(response){
			    switch(listitem){
			        case 0:
			            ShowPlayerVarlistDialog(playerid);
			        case 1:{
			            ConfigJunkBuster();
			    		SendClientMessage(playerid,GREEN,"JunkBuster: Configuration has been loaded from file.");
			    		ShowPlayerConfigDialog(playerid);}
			        case 2:{
			            SaveJunkBusterVars();
			    		SendClientMessage(playerid,GREEN,"JunkBuster: Configuration has been saved to file.");
			    		ShowPlayerConfigDialog(playerid);}}}
        	return 1;}
	    if(dialogid==DIALOG_VARLIST){
		    if(response)
		    	ShowPlayerSetvarDialog(playerid,listitem);
		    else
		        ShowPlayerConfigDialog(playerid);
			return 1;}
		if(dialogid>=DIALOG_SETVAR && dialogid<(DIALOG_SETVAR+MAX_JB_VARIABLES-1)){
		    if(response){
		        new var=dialogid-DIALOG_SETVAR,setvar=strval(inputtext);
		        if(!inputtext[0] || !JB_IsNumeric(inputtext) || setvar<0)
			        ShowPlayerSetvarDialog(playerid,var);
				else{
                    JB_Variables[var]=setvar;
		            JB_SendFormattedMessage(playerid,GREEN,"JunkBuster: JunkBuster variable '%s' has successfully been set to %d.",JB_VariableNames[var],JB_Variables[var]);
					JB_LogEx("%s has set variable '%s' to %d.",ReturnPlayerName(playerid),JB_VariableNames[var],JB_Variables[var]);
					ShowPlayerVarlistDialog(playerid);}}
		    else
			    ShowPlayerVarlistDialog(playerid);
		    return 1;}}
	if(!len)
		return CallLocalFunction("JB_OnDialogResponse","iiiis",playerid, dialogid, response, listitem, "#");
    return CallLocalFunction("JB_OnDialogResponse","iiiis",playerid, dialogid, response, listitem, inputtext);}
Can anyone help me please?


Re: Can anyone help me? - Faisal_khan - 13.04.2012

Here:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
{
    if(dialogid == DIALOGCLAN)
        {
            if(response)
            {
                if(!strlen(inputtext))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the clan password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the clan password and confirm.", nome);
                    ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
                    return 0;
                }
                if(!strcmp(inputtext, PASSWORDCLAN, false))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has confirmed to be part of the clan.", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, BLU_CHIARO, "You have confirmed to be part of the clan!");
                    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                    return 1;
                }
                else
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
                    Kick(playerid);
                }
            }
            else if(!response)
            {
                new nome[24];
                GetPlayerName(playerid, nome, 24);
                SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
                format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
                SendClientMessageToAll(BLU_CHIARO, stringa);
                Kick(playerid);
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
        }
    }

    new len=strlen(inputtext);
    for(new i=0;i<len;i++)
        if(inputtext[i]=='%')
            inputtext[i]='#';
    if(IsPlayerAdmin(playerid)){
        if(dialogid==DIALOG_CFG){
            if(response){
                switch(listitem){
                    case 0:
                        ShowPlayerVarlistDialog(playerid);
                    case 1:{
                        ConfigJunkBuster();
                        SendClientMessage(playerid,GREEN,"JunkBuster: Configuration has been loaded from file.");
                        ShowPlayerConfigDialog(playerid);}
                    case 2:{
                        SaveJunkBusterVars();
                        SendClientMessage(playerid,GREEN,"JunkBuster: Configuration has been saved to file.");
                        ShowPlayerConfigDialog(playerid);}}}
            return 1;}
        if(dialogid==DIALOG_VARLIST){
            if(response)
                ShowPlayerSetvarDialog(playerid,listitem);
            else
                ShowPlayerConfigDialog(playerid);
            return 1;}
        if(dialogid>=DIALOG_SETVAR && dialogid<(DIALOG_SETVAR+MAX_JB_VARIABLES-1)){
            if(response){
                new var=dialogid-DIALOG_SETVAR,setvar=strval(inputtext);
                if(!inputtext[0] || !JB_IsNumeric(inputtext) || setvar<0)
                    ShowPlayerSetvarDialog(playerid,var);
                else{
                    JB_Variables[var]=setvar;
                    JB_SendFormattedMessage(playerid,GREEN,"JunkBuster: JunkBuster variable '%s' has successfully been set to %d.",JB_VariableNames[var],JB_Variables[var]);
                    JB_LogEx("%s has set variable '%s' to %d.",ReturnPlayerName(playerid),JB_VariableNames[var],JB_Variables[var]);
                    ShowPlayerVarlistDialog(playerid);}}
            else
                ShowPlayerVarlistDialog(playerid);
            return 1;}}
    if(!len)
        return CallLocalFunction("JB_OnDialogResponse","iiiis",playerid, dialogid, response, listitem, "#");
    return CallLocalFunction("JB_OnDialogResponse","iiiis",playerid, dialogid, response, listitem, inputtext);}
}



Re: Can anyone help me? - Tass007 - 13.04.2012

I get warning 217: loose indentation warning with this code
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
{
    new stringa[500];
    if(dialogid == DIALOGCLAN)
        {
            if(response)
            {
                if(!strlen(inputtext))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the clan password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the clan password and confirm.", nome);
                    ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
                    return 0;
                }
                if(!strcmp(inputtext, PASSWORDCLAN, false))
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has confirmed to be part of the clan.", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, BLU_CHIARO, "You have confirmed to be part of the clan!");
                    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                    return 1;
                }
                else
                {
                    new nome[24];
                    GetPlayerName(playerid, nome, 24);
                    format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
                    SendClientMessageToAll(BLU_CHIARO, stringa);
                    SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
                    Kick(playerid);
                }
            }
            else if(!response)
            {
                new nome[24];
                GetPlayerName(playerid, nome, 24);
                SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
                format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
                SendClientMessageToAll(BLU_CHIARO, stringa);
                Kick(playerid);
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
        }
    }
The Warning is at this line the new len= ect..
pawn Код:
new len=strlen(inputtext);
    for(new i=0;i<len;i++)
        if(inputtext[i]=='%')
            inputtext[i]='#';
    if(IsPlayerAdmin(playerid)){
        if(dialogid==DIALOG_CFG){
            if(response){
                switch(listitem){
                    case 0:
                        ShowPlayerVarlistDialog(playerid);
                    case 1:{
                        ConfigJunkBuster();
                        SendClientMessage(playerid,GREEN,"JunkBuster: Configuration has been loaded from file.");
                        ShowPlayerConfigDialog(playerid);}
                    case 2:{
                        SaveJunkBusterVars();
                        SendClientMessage(playerid,GREEN,"JunkBuster: Configuration has been saved to file.");
                        ShowPlayerConfigDialog(playerid);}}}
            return 1;}
        if(dialogid==DIALOG_VARLIST){
            if(response)
                ShowPlayerSetvarDialog(playerid,listitem);
            else
                ShowPlayerConfigDialog(playerid);
            return 1;}
        if(dialogid>=DIALOG_SETVAR && dialogid<(DIALOG_SETVAR+MAX_JB_VARIABLES-1)){
            if(response){
                new var=dialogid-DIALOG_SETVAR,setvar=strval(inputtext);
                if(!inputtext[0] || !JB_IsNumeric(inputtext) || setvar<0)
                    ShowPlayerSetvarDialog(playerid,var);
                else{
                    JB_Variables[var]=setvar;
                    JB_SendFormattedMessage(playerid,GREEN,"JunkBuster: JunkBuster variable '%s' has successfully been set to %d.",JB_VariableNames[var],JB_Variables[var]);
                    JB_LogEx("%s has set variable '%s' to %d.",ReturnPlayerName(playerid),JB_VariableNames[var],JB_Variables[var]);
                    ShowPlayerVarlistDialog(playerid);}}
            else
                ShowPlayerVarlistDialog(playerid);
            return 1;}}
    if(!len)
        return CallLocalFunction("JB_OnDialogResponse","iiiis",playerid, dialogid, response, listitem, "#");
    return CallLocalFunction("JB_OnDialogResponse","iiiis",playerid, dialogid, response, listitem, inputtext);}



Re: Can anyone help me? - Sphex - 13.04.2012

Either use tabs properly or add this in the top of your code:
PHP код:
#pragma tabsize 0 



Re: Can anyone help me? - Tass007 - 13.04.2012

Thank you both, both REP +