Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   onRCPlayerLogin and onRCPlayerLogout (https://forums.graalonline.com/forums/showthread.php?t=134265868)

Gunderak 03-01-2012 11:39 AM

onRCPlayerLogin and onRCPlayerLogout
 
We already have onPlayerLogin and onPlayerLogout.
It would be really handy to have these functions.

Skyld 03-01-2012 08:29 PM

Is this really necessary? You can already pretty much reproduce this behaviour when RCs log on by checking if the player.level.name == "", and I don't really know why your scripts should care if an RC logs off.

Gunderak 03-02-2012 12:06 AM

I have one which exports the servers playercount to a external server and would like to be able to check when an RC logs off.
Checking onPlayerLogoff doesn't work for RC's as far as I'm aware.

Emera 03-02-2012 12:40 AM

Quote:

Originally Posted by Gunderak (Post 1686588)
I have one which exports the servers playercount to a external server and would like to be able to check when an RC logs off.
Checking onPlayerLogoff doesn't work for RC's as far as I'm aware.

What's wrong with making your own function? It's easily done.

Skyld 03-02-2012 01:04 AM

Quote:

Originally Posted by Gunderak (Post 1686588)
I have one which exports the servers playercount to a external server and would like to be able to check when an RC logs off.
Checking onPlayerLogoff doesn't work for RC's as far as I'm aware.

If that's the case, why doesn't your external site report the number of players instead of the number of RCs? :v

Gunderak 03-02-2012 06:18 AM

It shows both.
But it updates when players log on or off but not when RC's log on or off.
And Emera did you even read my post -.-?

cbk1994 03-02-2012 06:21 AM

Why not just have a timeout update the count every few minutes? You don't need an exact count on your website.

fowlplay4 03-02-2012 06:34 AM

You could also GET the xml file from statistic.graal.us and not have to setup a system at all.

Gunderak 03-02-2012 04:36 PM

I know I could do that, but I wanted to make this as a challenge for myself.
Not just use an already existing system.

fowlplay4 03-02-2012 04:41 PM

PHP Code:

function onCreated() {
  
onTimeout(true);
}

function 
onTimeout(force_update) {
  for (
temp.aallplayers) {
    if (
temp.a.level == NULLtemp.count_rc++;
    else 
temp.count_players++;
  }
  if (
this.last_rc != temp.count_rc || this.last_players != temp.count_players || force_update) {
    
requesturl("http://yourhost.com/api.php?rc=" temp.count_rc "&players=" temp.count_players);
    
this.last_rc temp.count_rc;
    
this.last_players temp.count_players;
  }
  
setTimer(5);


some challenge huh?

Emera 03-02-2012 06:46 PM

Quote:

And Emera did you even read my post -.-?
From what has been posted by CBK and FowlPlay4, it is possible to script this. And yes, I read your post.

Gunderak 03-03-2012 04:31 AM

Jerret just because you are better than someone at something doesn't mean you should be a smart arse.
It was a challenge to make the PHP script to do it.
The GS2 was easy.
:P

cbk1994 03-03-2012 04:44 AM

Quote:

Originally Posted by Gunderak (Post 1686690)
Jerret just because you are better than someone at something doesn't mean you should be a smart arse.
It was a challenge to make the PHP script to do it.
The GS2 was easy.
:P

PHP Code:

<?php
$playerCount 
$_GET['players'];
file_put_contents("players.txt"$playerCount);
?>

?

Gunderak 03-03-2012 05:27 AM

Why would I want to save it in a text file?
I chose to write text to a template image and save it as an image so I can just display it in a signature or anything.

Emera 03-03-2012 01:25 PM

Quote:

Originally Posted by Gunderak (Post 1686690)
Jerret just because you are better than someone at something doesn't mean you should be a smart arse.
It was a challenge to make the PHP script to do it.
The GS2 was easy.
:P

There's really no need to start raging, and there was really no need for childish negative reputation either. You're not going to get answers if you're flaring at people.

Crow 03-03-2012 04:17 PM

Quote:

Originally Posted by Gunderak (Post 1686700)
Why would I want to save it in a text file?
I chose to write text to a template image and save it as an image so I can just display it in a signature or anything.

Using the GD library to throw some stuff onto a base image isn't exactly difficult either, you know..

Gunderak 03-04-2012 09:40 AM

For someone who has never experimented with it before it is.

Crow 03-04-2012 09:55 AM

Quote:

Originally Posted by Gunderak (Post 1686855)
For someone who has never experimented with it before it is.

Yes, I know. Starting off with something you never did before might not seem easy. But it's not a challenge. If you end up with just a couple lines of easy to understand code, it's not a challenge, no matter how long it took for you to understand it. And in this case, you could just use it elsewhere or write some dummy code to get familiar with that kind of stuff.

Gunderak 03-04-2012 12:16 PM

It was a challenge to me to make this whole system is what I meant.
I'm starting to ease off of GS2 as it will not help my career.
I would like to get into web development that's why I'm learning PHP.
Well some may consider it a project idk but it was fun making it.

BlueMelon 03-04-2012 03:58 PM

Quote:

Originally Posted by Gunderak (Post 1686875)
It was a challenge to me to make this whole system is what I meant.
I'm starting to ease off of GS2 as it will not help my career.
I would like to get into web development that's why I'm learning PHP.
Well some may consider it a project idk but it was fun making it.

If you want to get into web development, stop GS2 completely and make basic systems if PHP...

When I learnt PHP I challenged myself to make basic shop scripts and a basic CMS blog system.


All times are GMT +2. The time now is 08:43 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.