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
Captain Woltato
 
Posts: 185
Joined: Sat Jan 17, 2009 8:09 pm
Location: Bingley, UK
Medals: 44
Monthly Leader Silver (1) Standard Achievement (4) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (2)
Terminator Achievement (1) Assassin Achievement (1) Manual Troops Achievement (1) Freestyle Achievement (1) Polymorphic Achievement (2)
Fog of War Achievement (4) Speed Achievement (2) Teammate Achievement (2) Random Map Achievement (2) Cross-Map Achievement (3)
Beta Map Achievement (1) Ratings Achievement (3) Clan Achievement (10)

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
Captain Woltato
 
Posts: 185
Joined: Sat Jan 17, 2009 8:09 pm
Location: Bingley, UK
Medals: 44
Monthly Leader Silver (1) Standard Achievement (4) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (2)
Terminator Achievement (1) Assassin Achievement (1) Manual Troops Achievement (1) Freestyle Achievement (1) Polymorphic Achievement (2)
Fog of War Achievement (4) Speed Achievement (2) Teammate Achievement (2) Random Map Achievement (2) Cross-Map Achievement (3)
Beta Map Achievement (1) Ratings Achievement (3) Clan Achievement (10)


Return to Tools Development

Who is online

Users browsing this forum: No registered users

cron