Change this command with Dialog
#1

I want to change this command and make it usable through dialog.
Example have a list with all options "license plate, vehicle, person and so on." and if for example I choose "plaque" I get a dialog DIALOG_STYLE_INPUT but I can not understand how I can do.
Код:
COMMAND:mdc(playerid,params[])
{

	if((InCopCar(playerid) && duty[playerid]) || IsPlayerInRangeOfPoint(playerid,50.0,246.6959,118.3634,1003.2188) && duty[playerid])
	{

		new idx = 0;
	    new tmp[64];
	    tmp = strtok(params,idx);
	    if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_YELLOW2,"Usa: /mdc [azione] [valore]"); SendClientMessage(playerid,COLOR_YELLOW2,"[Azioni] persona, elimina, mandato, chiamate, callinfo, targa"); return 1; }
	    if(strcmp(tmp,"targa",true) == 0)
	    {

			new result[256];
			FetchParamText(result,params,idx);
	        if(!strlen(result)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Usa: /mdc targa [numero di targa]"); return 1; }
	        new slot = -1;
			for(new i = 0; i < MAX_RP_VEHICLES; i ++)
			{

			    if(VehicleInfo[i][vModel] > 0)
			    {

			        if(strlen(VehicleInfo[i][vPlate]))
			        {

				        if(strcmp(VehicleInfo[i][vPlate],result,true) == 0) { slot = i; }

				   	}

			    }

			}
			if(slot == -1) { SendClientMessage(playerid,COLOR_LIGHTRED,"Nessun veicolo corrispondente a questa targa."); return 1; }
			SendClientMessage(playerid,COLOR_YELLOW2,"|-----MDC-----|");
			new str[128];
			format(str,sizeof(str),"{808080}Veicolo registrato a: {FFFFFF}%s",VehicleInfo[slot][vOwnerName]);
			SendClientMessage(playerid,COLOR_WHITE,str);
			format(str,sizeof(str),"{808080}Assicurazioni: {FFFFFF}%d",VehicleInfo[slot][vInsurance]);
			SendClientMessage(playerid,COLOR_WHITE,str);
			return 1;

	    }
	    if(strcmp(tmp,"veicolo",true) == 0)
	    {

			new tmp2[64];
			tmp2 = strtok(params,idx);
			if(!strlen(tmp2)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Usa: /mdc veicolo [playerid/nome player]"); return 1; }
			new other = ReturnUser(tmp2);
			if(!IsPlayerConnectedEx(other)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Questo player non и connesso."); return 1; }
			if(!IsPlayerInAnyVehicle(other)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Questo player non и in un veicolo."); return 1; }
			new slot = GetVehicleSlot(GetPlayerVehicleID(other));
			if(slot > -1)
			{

				SendClientMessage(playerid,COLOR_YELLOW2,"|-----MDC-----|");
				new str[128];
				format(str,sizeof(str),"{808080}Veicolo registrato a: {FFFFFF}%s",VehicleInfo[slot][vOwnerName]);
				SendClientMessage(playerid,COLOR_WHITE,str);
				format(str,sizeof(str),"{808080}Assicurazioni: {FFFFFF}%d",VehicleInfo[slot][vInsurance]);
				SendClientMessage(playerid,COLOR_WHITE,str);
				return 1;

			}
			else
			{

				SendClientMessage(playerid,COLOR_LIGHTRED,"Questo и un veicolo pubblico e non puт essere controllato.");
				return 1;

			}

	    }
	    if(strcmp(tmp,"elimina",true) == 0)
	    {

			new tmp2[64];
			tmp2 = strtok(params,idx);
			if(!strlen(tmp2)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Usa: /mdc elimina [playerid/nome player]"); return 1; }
			new other = ReturnUser(tmp2);
			if(!IsPlayerConnectedEx(other)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Questo player non и connesso."); return 1; }
			new q[1024];
			new clean_name[MAX_PLAYER_NAME];
			mysql_real_escape_string(CharacterInfo[other][active_character[other]][cName],clean_name);
			format(q,sizeof(q),"DELETE FROM rp_crimes WHERE suspect = '%s'",clean_name);
			mysql_query(q,player_threads[playerid]);
			SendClientMessage(playerid,COLOR_YELLOW2,"Tutti i crimini e mandati su questa persona sono stati annullati.");
			return 1;

	    }
	    if(strcmp(tmp,"mandato",true) == 0)
	    {

	        new tmp2[64];
	        tmp2 = strtok(params,idx);
	        if(!strlen(tmp2)) { SendClientMessage(playerid,COLOR_YELLOW2,"Usa: /mdc [mandato] [playerid/nome player]"); return 1; }
			if(strcmp(tmp2,"warrant",true) == 0)
			{

				new tmp3[64];
				tmp3 = strtok(params,idx);
				if(!strlen(tmp3)) { SendClientMessage(playerid,COLOR_YELLOW2,"Usa: /mdc mandato [playerid/nome player] [crimine]"); return 1; }
				new other = ReturnUser(tmp3);
				if(!IsPlayerConnectedEx(other)) { SendErrorMsg(playerid,"Questo player non и connesso."); return 1; }
				new result[256];
				FetchParamText(result,params,idx);
				if(!strlen(result)) { SendClientMessage(playerid,COLOR_YELLOW2,"Usa: /mdc warrant [playerid/nome player] [crimine]"); return 1; }
				new clean_name[MAX_PLAYER_NAME];
				new clean_reason[128];
				mysql_real_escape_string(CharacterInfo[other][active_character[other]][cName],clean_name);
				mysql_real_escape_string(result,clean_reason);
				new q[1024];
				format(q,sizeof(q),"INSERT INTO rp_crimes (suspect,crime) VALUES ('%s','%s')",clean_name,clean_reason);
				mysql_query(q,player_threads[playerid]);
				SendClientMessage(playerid,COLOR_FACTION,"Crimine aggiunto alla persona specificata.");
				return 1;

			}

	    }
		if(strcmp(tmp,"callinfo",true) == 0)
		{

		    if(callreq_cooldown[playerid] == 0)
		    {
			    new tmp2[64];
			    tmp2 = strtok(params,idx);
				if(!strlen(tmp2)) { SendClientMessage(playerid,COLOR_LIGHTRED,"/mdc callinfo [ID chiamata]"); return 1; }
				new call = strval(tmp2);
				if(call < 1 || call > 9999999) { SendErrorMsg(playerid,"ID della chiamata invalido."); return 1; }
			    SendEmerDetails(playerid,call,CALL_TYPE_PD);
			    callreq_cooldown[playerid] = 10;
			    return 1;
			}
			else
			{

			    SendClientMessage(playerid,COLOR_LIGHTRED,"Aspetta 10 secondi prima di ricercare altri dettagli.");
				return 1;

			}

		}
	    if(strcmp(tmp,"chiamate",true) == 0)
		{

			SendEmerCalls(playerid,CALL_TYPE_PD);
			return 1;

	    }
	    if(strcmp(tmp,"persona",true) == 0)
  		{

			new tmp2[64];
			tmp2 = strtok(params,idx);
			if(!strlen(tmp2)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Usa: /mdc persona [playerid/nome player]"); return 1; }
			new other = ReturnUser(tmp2);
			if(!IsPlayerConnectedEx(other)) { SendClientMessage(playerid,COLOR_LIGHTRED,"Questo player non и connesso."); return 1; }
			SetPVarInt(playerid,"mdc_otherid",CharacterInfo[other][active_character[other]][cID]);
			new str[128];
			new name[MAX_PLAYER_NAME];
			GetCharacterName(other,name);
			SendClientMessage(playerid,COLOR_YELLOW2,"|-----MDC-----|");
			format(str,sizeof(str),"{808080}Informazioni di: {FFFFFF}%s",name);
			SendClientMessage(playerid,COLOR_WHITE,str);
			if(CharacterInfo[other][active_character[other]][cCarLic]) { format(str,sizeof(str),"Si"); } else { format(str,sizeof(str),"No"); }
			if(CharacterInfo[other][active_character[other]][cCarLicWarnings] > 0) { new wtmp[64]; format(wtmp,sizeof(wtmp)," {FF0033}Richiami/Avvisi: %d",CharacterInfo[other][active_character[other]][cCarLicWarnings]); strins(str,wtmp,strlen(str)); }
			format(str,sizeof(str),"{808080}Licenza di guida: {FFFFFF}%s",str);
			SendClientMessage(playerid,COLOR_WHITE,str);
			if(CharacterInfo[other][active_character[other]][cWepLic]) { format(str,sizeof(str),"Si"); } else { format(str,sizeof(str),"No"); }
			format(str,sizeof(str),"{808080}Porto d'armi: {FFFFFF}%s",str);
			SendClientMessage(playerid,COLOR_WHITE,str);
			if(CharacterInfo[other][active_character[other]][cFlyLic]) { format(str,sizeof(str),"Si"); } else { format(str,sizeof(str),"No"); }
			format(str,sizeof(str),"{808080}Licenza di volo: {FFFFFF}%s",str);
			SendClientMessage(playerid,COLOR_WHITE,str);
			new clean_name[MAX_PLAYER_NAME];
			mysql_real_escape_string(CharacterInfo[other][active_character[other]][cName],clean_name);
			new q[256];
			format(q,sizeof(q),"SELECT * FROM rp_crimes WHERE suspect = '%s' ORDER BY id DESC",clean_name);
			mysql_query(q,player_threads[playerid],QUERY_WARRANTS);
			return 1;

	    }
		SendErrorMsg(playerid,"Azione non trovata.");
		return 1;

	}
	else
	{

	    SendErrorMsg(playerid,"Non sei un poliziotto in servizio o non sei in un veicolo.");
	    return 1;

	}

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)