SA-MP Forums Archive
Need Y_hooks help. - 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: Need Y_hooks help. (/showthread.php?tid=610963)



Need Y_hooks help. - danielpalade - 30.06.2016

I've recently tried to use Y_hooks for my gamemode.
My script is written in different includes.
For some reason, I get the following errors:

Код:
../withal/clans/w_clan.inc(144) : error 021: symbol already defined: "@yH_DialogResponse2"
../withal/clans/w_clan.inc(145) : error 021: symbol already defined: "@yH_DialogResponse2"
I'm getting the same errors for other callbacks in other includes.


Код:
Hook:OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case DIALOG_CLAN:
		{
			if(!response)
			{
				hidePlayerDialog(playerid);
			}
			else
			{
				if(playerVariables[playerid][pClan] >= 1)
				{
					new str[256];
					format(str, sizeof(str), "%s", clanVariables[playerVariables[playerid][pClan]][cClanName]);
					switch(listitem)
					{
						case 0:
						{
							if(playerVariables[playerid][pClan] >= 1)
							{
								new aim[1500];
								new last[256];
								format(aim, 256,"Rank - Name\tLast Login\tDays\n");
								new memid;
								new stringg[256];
								mysql_format(handle, stringg, sizeof(stringg), "SELECT * FROM `playeraccounts` WHERE `playerClan` = %d ORDER BY playerClanRank DESC",playerVariables[playerid][pClan]);
								new test[256], query[256], test3[256], days[256];
								new Cache: result12 = mysql_query (handle, stringg);
								for ( new i, j = cache_get_row_count ( ); i != j; ++i )
								{
									cache_get_field_content(i, "playerName", query);
									format(Selected[memid][snume],24, query);
									cache_get_field_content(i, "playerClanRank", test);

									cache_get_field_content(i, "playerLastLogin", test3);
									format(last,256, test3);

									cache_get_field_content(i, "playerClanDays", days);
									new id = GetPlayerID(query);
									if(id != INVALID_PLAYER_ID)
									{
										format(aim, sizeof(aim), "%s[%s]  %s\tonline right now\t%s\n",aim, test, query, days);
									}
									else
									{
							            format(aim, sizeof(aim), "%s[%s]  %s\t%s\t%s\n",aim,test, query, test3, days);
									}
									memid ++;
								}
								cache_delete(result12);
								ShowPlayerDialog(playerid,DIALOG_CMEMBERS,DIALOG_STYLE_TABLIST_HEADERS,str,aim,"Select","Cancel");
							}
						}
						case 1:
						{
							new t1[256], t2[256], t3[256], end[256];
							format(t1, sizeof(t1), "Remove The Tag: %s", playerVariables[playerid][pNormalName]);
							format(t2, sizeof(t2), "Use Clan Tag Style #1: %s%s", playerVariables[playerid][pNormalName], clanVariables[playerVariables[playerid][pClan]][cClanTag]);
							format(t3, sizeof(t3), "Use Clan Tag Style #2: %s%s", clanVariables[playerVariables[playerid][pClan]][cClanTag], playerVariables[playerid][pNormalName]);
							format(end, sizeof(end), "%s\n%s\n%s", t1, t3, t2);
							ShowPlayerDialog(playerid, DIALOG_CLAN_TAG, DIALOG_STYLE_LIST, str,end, "Select", "Cancel");
						}
						case 2:
						{
							SCM(playerid, COLOR_TEAL, "Clan Commands:");
							SCM(playerid, COLOR_TEAL, "/clan, /c, /cmembers, /cinvite, /cmotd");
						}
						case 3:
						{
							if(playerVariables[playerid][pClanRank] >= 6)
							{
								ShowPlayerDialog(playerid, 5716, DIALOG_STYLE_LIST, str, "Change Clan Color\nChange Clan Ranks", "Select", "Close");
							}
							else return SCM(playerid, COLOR_ORANGERED, "Doar liderul si sub-liderul au acces la comanda asta.");
						}
						case 4:
						{
							SCM(playerid, COLOR_ORANGERED, "Comanda a fost scoasa.");
						}
						case 5:
						{
							SCM(playerid, COLOR_ORANGERED, "Pentru a invita un jucator in clan, puteti folosi comanda /cinvite.");
						}
					}
				}
				else
				{
					hidePlayerDialog(playerid);
				}
			}
		}
		case 5716:
		{
			if(response)
			{
				new str[256];
				format(str, sizeof(str), "%s", clanVariables[playerVariables[playerid][pClan]][cClanName]);
				switch(listitem)
				{
					case 0:
					{
						ShowPlayerDialog(playerid, 5717, DIALOG_STYLE_INPUT, str, "Enter the color code in hexadecimal code. Ex: FF0000.\nYou can use the website www.colorpicker.com.", "Finish", "Close");
					}
					case 1:
					{
						new strmsg[512];
						format(strmsg, sizeof(strmsg), "1. %s\n2. %s\n3. %s\n4. %s\n5. %s\n6. %s\n7. %s", clanVariables[playerVariables[playerid][pClan]][cClanRankName1], 
						clanVariables[playerVariables[playerid][pClan]][cClanRankName2], clanVariables[playerVariables[playerid][pClan]][cClanRankName3], clanVariables[playerVariables[playerid][pClan]][cClanRankName4], clanVariables[playerVariables[playerid][pClan]][cClanRankName5], clanVariables[playerVariables[playerid][pClan]][cClanRankName6], clanVariables[playerVariables[playerid][pClan]][cClanRankName7]);
						ShowPlayerDialog(playerid, 5721, DIALOG_STYLE_LIST, str, strmsg, "Select", "Close");
					}
				}
			}
		}
		case 5717:
		{
			if(response)
			{
				new str[256];
				format(str, sizeof(str), "%s", clanVariables[playerVariables[playerid][pClan]][cClanName]);
				if(strlen(inputtext) == 6)
				{
					format(clanVariables[playerVariables[playerid][pClan]][cClanColor], 256, inputtext);
					new mz[256];
					format(mz, sizeof(mz), "{%s}[CLAN] %s has changed the color to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, mz);
					saveClan(playerVariables[playerid][pClan]);
				}
				else
				{
					ShowPlayerDialog(playerid, 5717, DIALOG_STYLE_INPUT, str, "Invalid colorcode!\nEnter the color code in hexadecimal code. Ex: FF0000.\nYou can use the website www.colorpicker.com.", "Finish", "Close");
				}
			}
		}
		case 5721:
		{
			if(response)
			{
				switch(listitem)
				{
					case 0: ShowPlayerDialog(playerid, 5722, DIALOG_STYLE_INPUT, "Change Rank", "Enter the new rank name for your clan.", "Done", "Close");
					case 1: ShowPlayerDialog(playerid, 5723, DIALOG_STYLE_INPUT, "Change Rank", "Enter the new rank name for your clan.", "Done", "Close");
					case 2: ShowPlayerDialog(playerid, 5724, DIALOG_STYLE_INPUT, "Change Rank", "Enter the new rank name for your clan.", "Done", "Close");
					case 3: ShowPlayerDialog(playerid, 5725, DIALOG_STYLE_INPUT, "Change Rank", "Enter the new rank name for your clan.", "Done", "Close");
					case 4: ShowPlayerDialog(playerid, 5726, DIALOG_STYLE_INPUT, "Change Rank", "Enter the new rank name for your clan.", "Done", "Close");
					case 5: ShowPlayerDialog(playerid, 5727, DIALOG_STYLE_INPUT, "Change Rank", "Enter the new rank name for your clan.", "Done", "Close");
					case 6: ShowPlayerDialog(playerid, 5728, DIALOG_STYLE_INPUT, "Change Rank", "Enter the new rank name for your clan.", "Done", "Close");
				}
			}
		}
		case 5722:
		{
			if(response)
			{
				if(strlen(inputtext) > 0)
				{
					new string[256];
					format(string, sizeof(string), "{%s}[CLAN] %s has changed the rank %s to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), clanVariables[playerVariables[playerid][pClan]][cClanRankName1], inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
					format(clanVariables[playerVariables[playerid][pClan]][cClanRankName1], 256, inputtext);
					saveClan(playerVariables[playerid][pClan]);
				}
			}
		}
		case 5723:
		{
			if(response)
			{
				if(strlen(inputtext) > 0)
				{
					new string[256];
					format(string, sizeof(string), "{%s}[CLAN] %s has changed the rank %s to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), clanVariables[playerVariables[playerid][pClan]][cClanRankName2], inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
					format(clanVariables[playerVariables[playerid][pClan]][cClanRankName2], 256, inputtext);
					saveClan(playerVariables[playerid][pClan]);
				}
			}
		}
		case 5724:
		{
			if(response)
			{
				if(strlen(inputtext) > 0)
				{
					new string[256];
					format(string, sizeof(string), "{%s}[CLAN] %s has changed the rank %s to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), clanVariables[playerVariables[playerid][pClan]][cClanRankName3], inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
					format(clanVariables[playerVariables[playerid][pClan]][cClanRankName3], 256, inputtext);
					saveClan(playerVariables[playerid][pClan]);
				}
			}
		}
		case 5725:
		{
			if(response)
			{
				if(strlen(inputtext) > 0)
				{
					new string[256];
					format(string, sizeof(string), "{%s}[CLAN] %s has changed the rank %s to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), clanVariables[playerVariables[playerid][pClan]][cClanRankName4], inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
					format(clanVariables[playerVariables[playerid][pClan]][cClanRankName4], 256, inputtext);
					saveClan(playerVariables[playerid][pClan]);
				}
			}
		}
		case 5726:
		{
			if(response)
			{
				if(strlen(inputtext) > 0)
				{
					new string[256];
					format(string, sizeof(string), "{%s}[CLAN] %s has changed the rank %s to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), clanVariables[playerVariables[playerid][pClan]][cClanRankName5], inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
					format(clanVariables[playerVariables[playerid][pClan]][cClanRankName5], 256, inputtext);
					saveClan(playerVariables[playerid][pClan]);
				}
			}
		}
		case 5727:
		{
			if(response)
			{
				if(strlen(inputtext) > 0)
				{
					new string[256];
					format(string, sizeof(string), "{%s}[CLAN] %s has changed the rank %s to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), clanVariables[playerVariables[playerid][pClan]][cClanRankName6], inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
					format(clanVariables[playerVariables[playerid][pClan]][cClanRankName6], 256, inputtext);
					saveClan(playerVariables[playerid][pClan]);
				}
			}
		}
		case 5728:
		{
			if(response)
			{
				if(strlen(inputtext) > 0)
				{
					new string[256];
					format(string, sizeof(string), "{%s}[CLAN] %s has changed the rank %s to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), clanVariables[playerVariables[playerid][pClan]][cClanRankName7], inputtext);
					SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
					format(clanVariables[playerVariables[playerid][pClan]][cClanRankName7], 256, inputtext);
					saveClan(playerVariables[playerid][pClan]);
				}
			}
		}
		case DIALOG_CMEMBERS:
		{
			if(response)
			{
				if(listitem >= 1)
				{
					new item = listitem;
					format(playerVariables[playerid][pSelected], MAX_PLAYER_NAME, "%s",Selected[item][snume]);
					ShowPlayerDialog(playerid, 5718, DIALOG_STYLE_LIST, "Select an action", "Uninvite From Clan\nChange Rank", "Select", "Cancel");
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You can't click on this item.");
				}
			}
		}
		case 5718:
		{
			if(response)
			{
				if(listitem == 0)
				{
					if(playerVariables[playerid][pClanRank] >= 6)
					{
						new str[256];
						format(str, sizeof(str), "Are you sure you want to uninvite %s from your clan?", playerVariables[playerid][pSelected]);
						ShowPlayerDialog(playerid, 5719, DIALOG_STYLE_MSGBOX, "Uninvite From Clan:", str, "Yes", "Cancel");
					}
					else SCM(playerid,-1,"You are not the clan leader or sub-leader.");
				}
				if(listitem == 1)
				{
					if(playerVariables[playerid][pClanRank] >= 6)
					{
						new crstring[256];
						format(crstring, sizeof(crstring), "1. %s\n2. %s\n3. %s\n4. %s\n5. %s\n6. %s", clanVariables[playerVariables[playerid][pClan]][cClanRankName1], clanVariables[playerVariables[playerid][pClan]][cClanRankName2], clanVariables[playerVariables[playerid][pClan]][cClanRankName3], clanVariables[playerVariables[playerid][pClan]][cClanRankName4], clanVariables[playerVariables[playerid][pClan]][cClanRankName5], clanVariables[playerVariables[playerid][pClan]][cClanRankName6]);
						ShowPlayerDialog(playerid, 5720, DIALOG_STYLE_LIST, "Select a rank", crstring, "Select", "Cancel");
					}
					else SCM(playerid,-1,"You are not the clan leader or sub-leader.");
				}
			}
		}
		case 5719:
		{
			if(response)
			{	
				new id = GetPlayerID(playerVariables[playerid][pSelected]);
				new str[256];
				format(str, sizeof(str), "{%s}[CLAN] %s has uninvited %s from the clan.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), GetName(id));
				SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, str);
				playerVariables[id][pClan] = 0;
				playerVariables[id][pClanRank] = 0;
				playerVariables[id][pClanDays] = 0;
				SetPlayerName(id, playerVariables[id][pNormalName]);
				savePlayerData(id);
			}	
			else return SCM(playerid, COLOR_GRAD2, "Action canceled.");
		}
		case 5720: 
		{
			if(response)
			{
				new rank = listitem+1;
				new id = GetPlayerID(playerVariables[playerid][pSelected]);
				playerVariables[id][pClanRank] = rank;
				
				new string[256];
				
				switch(rank)
				{
					case 1: format(string, sizeof(string), "{%s}[CLAN] %s has changed %s's rank to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), GetName(id), clanVariables[playerVariables[playerid][pClan]][cClanRankName1]);
					case 2: format(string, sizeof(string), "{%s}[CLAN] %s has changed %s's rank to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), GetName(id), clanVariables[playerVariables[playerid][pClan]][cClanRankName2]);
					case 3: format(string, sizeof(string), "{%s}[CLAN] %s has changed %s's rank to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), GetName(id), clanVariables[playerVariables[playerid][pClan]][cClanRankName3]);
					case 4: format(string, sizeof(string), "{%s}[CLAN] %s has changed %s's rank to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), GetName(id), clanVariables[playerVariables[playerid][pClan]][cClanRankName4]);
					case 5: format(string, sizeof(string), "{%s}[CLAN] %s has changed %s's rank to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), GetName(id), clanVariables[playerVariables[playerid][pClan]][cClanRankName5]);
					case 6: format(string, sizeof(string), "{%s}[CLAN] %s has changed %s's rank to %s.", clanVariables[playerVariables[playerid][pClan]][cClanColor], GetName(playerid), GetName(id), clanVariables[playerVariables[playerid][pClan]][cClanRankName6]);
				}
				
				SendToClan(playerVariables[playerid][pClan], COLOR_WHITE, string);
				savePlayerData(id);
			}
		}
		case DIALOG_CLAN_TAG:
		{
			if(!response)
			{
				hidePlayerDialog(playerid);
			}
			else
			{
				if(playerVariables[playerid][pClan] >= 1)
				{
					new string2[256];
					new string[256];
					switch(listitem)
					{
						case 0:
						{
							format(string2,256,"%s",playerVariables[playerid][pNormalName]);
							SetPlayerName(playerid, string2);
							format(string,256,"Nickname changed to: %s",string2);
							SCM(playerid,COLOR_WHITE,string);
							playerVariables[playerid][pClanTagType] = 0;
						}
						case 1:
						{
							format(string2,256,"%s%s",clanVariables[playerVariables[playerid][pClan]][cClanTag],playerVariables[playerid][pNormalName]);
							SetPlayerName(playerid, string2);
							format(string,256,"Nickname changed to: %s",string2);
							SCM(playerid,COLOR_WHITE,string);
							playerVariables[playerid][pClanTagType] = 1;
						}
						case 2:
						{
							format(string2,256,"%s%s",playerVariables[playerid][pNormalName],clanVariables[playerVariables[playerid][pClan]][cClanTag]);
							SetPlayerName(playerid, string2);
							format(string,256,"Nickname changed to: %s",string2);
							SCM(playerid,COLOR_WHITE,string);
							playerVariables[playerid][pClanTagType] = 2;
						}
					}
				}
				else
				{
					hidePlayerDialog(playerid);
				}
			}
		}
	}
	if(dialogid == 1700)
	{
		new string[256];
		if(response)
		{
			switch(listitem)
			{
				case 0:
				{
					format(string,256,"%s%s",clanVariables[playerVariables[playerid][pClan]][cClanTag],playerVariables[playerid][pNormalName]);
					SetPlayerName(playerid, string);
					format(string,256,"Nickname changed to: %s",string);
					SCM(playerid,COLOR_WHITE,string);
				}
				case 1:
				{
					format(string,256,"%s%s",playerVariables[playerid][pNormalName],clanVariables[playerVariables[playerid][pClan]][cClanTag]);
					SetPlayerName(playerid, string);
					format(string,256,"Nickname changed to: %s",string);
					SCM(playerid,COLOR_WHITE,string);
				}
				case 2:
				{
					format(string,256,"%s",playerVariables[playerid][pNormalName]);
					SetPlayerName(playerid, string);
					format(string,256,"Nickname changed to: %s",string);
					SCM(playerid,COLOR_WHITE,string);
				}
			}
		}
	}
	if(dialogid == 32)
    {
		if(response)
		{
			switch(listitem)
			{
				case 0:
				{
					if(playerVariables[playerid][pClan] >= 1 && playerVariables[playerid][pClanRank] >= 1)
					{
						ShowPlayerDialog(playerid, 1700, DIALOG_STYLE_LIST, "SERVER: Clan Tag", "Tag 1\nTag 2\nNo tag","Select","Cancel");
					}
				}
			}
		}
	}
	return 1;
}
I only have one DialogResponse in this include, so I don't know why I'm getting this.


Re: Need Y_hooks help. - Runn3R - 30.06.2016

Try the ALS hook method instead.