Raised This Month: $12 Target: $400
 3% 

WebLync 0.0.13 - A MOTD redirection service


Post New Thread Reply   
 
Thread Tools Display Modes
MithatGuner
Member
Join Date: Sep 2016
Location: Turkey
Old 06-22-2017 , 09:16   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #81

Thanks
MithatGuner is offline
Wulfy
Senior Member
Join Date: Apr 2015
Location: Belgium
Old 06-22-2017 , 19:07   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #82

I'm trying to write a third party plugin that sets the custom arg to the specified user's Steam64Id.

Getting the user's Steam64Id was the easy bit, but now I can't seem to figure out how to implement the WebLync_RegisterUrlParam native function. I've read the wiki references about natives but still can't figure out how to use them.

I suppose I should be posting about this issue on the scripting forums rather than here, but I hope you can still help me out.
__________________
be happy
Wulfy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-22-2017 , 20:10   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #83

Post here, could you show your code.

Btw: A clients 64bit SteamID is already translated as per the table below.

Code:
{SteamID}		SteamID of client issuing the command
{SteamID64}		64bit SteamID of client issuing the command
{Hostname}		Hostname of the server
{IpAddress}		The IP Address of the server
{Port}			The port of the server
{UserId}		The clients UserId
{Client}		The clients client index
{Args}			The arguments parsed to the command
__________________
Neuro Toxin is offline
dangerlord63
Senior Member
Join Date: Aug 2011
Old 06-22-2017 , 21:39   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #84

I Use the last version and i have issues;
http://prntscr.com/fn39sr (Link : https://ts3.center)
http://prntscr.com/fn3aiw (Link : https://i.hizliresim.com/vpR0Lm.jpg)
http://prntscr.com/fn3alg (Link : http://steamcommunity.com/groups/cscenterofficial)

if i try to open google it opens, but with other sites it has issues, please fix.

Last edited by dangerlord63; 06-23-2017 at 00:02.
dangerlord63 is offline
Wulfy
Senior Member
Join Date: Apr 2015
Location: Belgium
Old 06-23-2017 , 03:31   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #85

Quote:
Originally Posted by Neuro Toxin View Post
Post here, could you show your code.

Btw: A clients 64bit SteamID is already translated as per the table below.

Code:
{SteamID}		SteamID of client issuing the command
{SteamID64}		64bit SteamID of client issuing the command
{Hostname}		Hostname of the server
{IpAddress}		The IP Address of the server
{Port}			The port of the server
{UserId}		The clients UserId
{Client}		The clients client index
{Args}			The arguments parsed to the command
My code so far, I just need to add the native to handle the custom arg:
Code:
#include <sourcemod>
#define MAX_STEAMID_LENGTH 18

public OnPluginStart(){
	RegConsoleCmd("sm_profile", profile);
}

public Action:profile(client, args)
{
	if(args==0){
		PrintToChat(client,"Proper Usage: !profile <playername>");
		return Plugin_Handled;
	}
	decl String:arg[128];
	new String:SteamID[MAX_STEAMID_LENGTH];
	
	GetCmdArgString(arg,128);
	new Targ=FindTarget(client,arg,true,false);
	
	GetClientAuthId(Targ, AuthId_SteamID64, SteamID, sizeof(SteamID));
	PrintToChat(client,SteamID);
	//showmotd
	return Plugin_Handled;
}
I meant getting another user's SteamId so I can type !profile neuro and it'd open your profile in an motd window. A couple of these plugins have existed in the past but I can't seem to find any that still work.

I'm pretty much almost there because I can type !profile username and get their SteamId64 and I can type !weblync_profile [SteamId64] and it does what I need. I'd just like it to be 1 fluent action.
__________________
be happy

Last edited by Wulfy; 06-23-2017 at 06:56.
Wulfy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-24-2017 , 00:31   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #86

Add a static global array to store the target client to the client issuing the command
Code:
static int s_ProfileClientTargetIndex[MAXPLAYERS+1];
In your command callback store the target index into this array like so.
Code:
s_ProfileClientTargetIndex[client] = Targ;
Register the URL Parameter with callback OnAllPluginsStarted
Code:
public void OnAllPluginsLoaded()
{
	WebLync_RegisterUrlParam("{TargetSteamID64}", OnReplaceTargetSteamID64);
}
Create the callback and use your code with the static global array to get the target client index. Notice how we store the results in the buffer parameter.
Code:
public bool OnReplaceTargetSteamID64(int client, const char[] paramname, char[] buffer, int maxlength)
{
	int target = s_ProfileClientTargetIndex[client];
	GetClientAuthId(target, AuthId_SteamID64, buffer, maxlength);
	return true;
}
Here is a full working version that I've done up based on your code.

Code:
#include <sourcemod>
#include <weblync>
#pragma newdecls required
#pragma semicolon 1

public Plugin myinfo =
{
	name = "WebLync Steam Profile",
	author = "Wulfy and Neuro Toxin",
	description = "Opens a targets steam profile page using WebLync",
	version = "0.0.1",
	url = "https://forums.alliedmods.net/showthread.php?t=298458"
}

static int s_ProfileClientTargetIndex[MAXPLAYERS+1];

public void OnPluginStart()
{
	RegConsoleCmd("sm_steamprofile", OnProfileCommand);
}

public void OnAllPluginsLoaded()
{
	WebLync_RegisterUrlParam("{TargetSteamID64}", OnReplaceTargetSteamID64);
}

public Action OnProfileCommand(int client, int args)
{
	if (args == 0)
	{
		PrintToChat(client, "Usage: !profile <playername>");
		return Plugin_Handled;
	}
	
	char arg[128];
	GetCmdArgString(arg,128);
	
	int target = FindTarget(client,arg,true,false);
	s_ProfileClientTargetIndex[client] = target;
	
	WebLync_OpenUrl(client, "http://steamcommunity.com/profiles/{TargetSteamID64}/");
	return Plugin_Handled;
}

public bool OnReplaceTargetSteamID64(int client, const char[] paramname, char[] buffer, int maxlength)
{
	int target = s_ProfileClientTargetIndex[client];
	if (target == 0)
		return false;
	
	GetClientAuthId(target, AuthId_SteamID64, buffer, maxlength);
	s_ProfileClientTargetIndex[client] = 0;
	return true;
}
__________________

Last edited by Neuro Toxin; 06-24-2017 at 00:33.
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-24-2017 , 00:38   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #87

Quote:
Originally Posted by dangerlord63 View Post
I Use the last version and i have issues;
http://prntscr.com/fn39sr (Link : https://ts3.center)
http://prntscr.com/fn3aiw (Link : https://i.hizliresim.com/vpR0Lm.jpg)
http://prntscr.com/fn3alg (Link : http://steamcommunity.com/groups/cscenterofficial)

if i try to open google it opens, but with other sites it has issues, please fix.
They all work fine for me (your site takes ages to load)...

__________________

Last edited by Neuro Toxin; 06-24-2017 at 00:39.
Neuro Toxin is offline
TrappaTroopa
Senior Member
Join Date: Feb 2016
Old 06-24-2017 , 04:01   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #88

This is amazing. I was upset that my MOTDs broke. My servers rely on them heavily.

I have an issue however on my Surf Server. The motd does not show when you first load into the server like my other servers.

Also my soundcloud and jukebox plugins which relies on MOTDs to play music will not work until you run a command like !motd to open the scorebord web page (configured through webshortcuts). After that they work fine. This a problem for players that do not know this.

You also have to do !motd to activate weblync after each song plays to be able to hear the next song.

Is there a fix for this? Thanks.

Last edited by TrappaTroopa; 06-24-2017 at 04:05.
TrappaTroopa is offline
dangerlord63
Senior Member
Join Date: Aug 2011
Old 06-24-2017 , 04:16   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #89

Quote:
Originally Posted by Neuro Toxin View Post
They all work fine for me (your site takes ages to load)...

With your web site yes it works, but i use web shortcuts plugin and weblync, when that two gets togeter gives errors, likes pages not shows.
dangerlord63 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-24-2017 , 04:16   Re: WebLync 0.0.8 - A MOTD redirection service
Reply With Quote #90

Can you provide some example URL(s) so I can add some test commands and try get them working how you like.
__________________
Neuro Toxin is offline
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

Forum Jump


All times are GMT -4. The time now is 02:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode