Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Map name fix in discord #16

Open
MasterWindowS opened this issue Jan 18, 2023 · 3 comments
Open

Map name fix in discord #16

MasterWindowS opened this issue Jan 18, 2023 · 3 comments

Comments

@MasterWindowS
Copy link

Hi, I have seen that in the discord it shows the name of the map that is currently being played and the link to the map that was already played.

Here is a solution that worked well for me.

Add new handle of array

new Handle:g_MapArray = INVALID_HANDLE;

In OnpluginStart, initiate arrangement

g_MapArray = CreateArray(32);

When the map is finished, save it in the array (with a maximum of 1 map)

public OnMapEnd(){
	new String:map[64];
	GetCurrentMap(map,sizeof(map));
	PushArrayString(g_MapArray,map);

	if (GetArraySize(g_MapArray) > 1)
		RemoveFromArray(g_MapArray,0);
}

and finally call the last map played

if(StrContains(sBuffer, "%map", false) != -1)
	{
		if (g_MapArray != INVALID_HANDLE)
		{
			new MapArray = GetArraySize(g_MapArray)-1;
			for (new i=0; i<=MapArray; i++)
			{
				new String:map[64];
				GetArrayString(g_MapArray,i,map,sizeof(map));
				ReplaceString(sBuffer, maxlength, "%map", map, false);
			}
		}
	}

With these modifications, the truth is that I am doing super well, I have not had any problems so far.

@MoritzLoewenstein
Copy link
Owner

I will include that fix asap, thanks.

@crashzk
Copy link

crashzk commented Jun 9, 2023

@MasterWindowS thanks for sharing this fix, I've been having the same problem you mentioned.{

Could you tell me in which plugin I need to make this modification? Could it be the tEasyFTP.sp plugin?

@crashzk
Copy link

crashzk commented Jun 10, 2023

ping @MoritzLoewenstein

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants