Conquer Club

How to get player id in a greasemonkey script.

Discuss developing tools and get details on Conquer Club's API.

Moderator: Tech Team

Forum rules
Please read the Community Guidelines before posting.

How to get player id in a greasemonkey script.

Postby Woltato on Thu Oct 31, 2013 12:43 pm

Please does anyone know the easiest way to obtain the player id. ie player currently logged in. Wanting to do this programmatically in a greasemonkey script. Is there a predefined variable or function that will return it?

I've written a script and was going to put it onto userscripts.org. however at the moment it's got my userid hardcoded into it so it will only work for me.
User avatar
Corporal 1st Class Woltato
 
Posts: 192
Joined: Sat Jan 17, 2009 8:09 pm
Location: Bingley, UK

Re: How to get player id in a greasemonkey script.

Postby Woltato on Fri Nov 01, 2013 11:37 am

Figured this out now.

this is how in case anyone's interested

function getPlayerID()
{
var playerid = document.cookie;
playerid = playerid.split("phpbb3_jer7c_u=")[1]
playerid = playerid.split(";")[0];
return playerid;
}

if playerid is returned as "1" then it means not logged in
User avatar
Corporal 1st Class Woltato
 
Posts: 192
Joined: Sat Jan 17, 2009 8:09 pm
Location: Bingley, UK


Return to Tools Development

Who is online

Users browsing this forum: No registered users