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

Quite strange question.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 08-17-2010 , 08:28   Quite strange question.
Reply With Quote #1

Hi there, i wanted to ask, is it possible to use sourcepawn to get image size from a web page. Here is the story: I want to make a plugin, which would show the status of the administrator skype (online offline etc.) were is only one way which i found to do this in php (with cURL) by getting the size of the image, and this way deciding whether image is showing online (more bytes) or offline (less). Example of the image here. I think i would be able to do this with php and sql, by updating sql database once in a while, but retrieving this info from database with sourcemod would lag the game, wouldn't it (like saving one bit, either 1 (online) or 0 (offline))? (I am newbie @ sourcepawn and the last plugin i made lags the game then inserting table into database)

Last edited by Zylius; 08-17-2010 at 08:57.
Zylius is offline
atom0s
Senior Member
Join Date: Jul 2009
Old 08-17-2010 , 10:45   Re: Quite strange question.
Reply With Quote #2

Quote:
Originally Posted by Zylius View Post
Hi there, i wanted to ask, is it possible to use sourcepawn to get image size from a web page. Here is the story: I want to make a plugin, which would show the status of the administrator skype (online offline etc.) were is only one way which i found to do this in php (with cURL) by getting the size of the image, and this way deciding whether image is showing online (more bytes) or offline (less). Example of the image here. I think i would be able to do this with php and sql, by updating sql database once in a while, but retrieving this info from database with sourcemod would lag the game, wouldn't it (like saving one bit, either 1 (online) or 0 (offline))? (I am newbie @ sourcepawn and the last plugin i made lags the game then inserting table into database)
You can use the built in SQL functions to manage doing this.

As for lagging the game, no. You can use the threaded methods to prevent the game from locking up while you await for callback returns and such.

Quote:
SourceMod supports threaded SQL querying. That is, SQL operations can be completed in a separate thread from main gameplay. If your database server is remote or requires a network connection, queries can cause noticeable gameplay lag, and supporting threading is often a good idea if your queries occur in the middle of gameplay.



Threaded queries are asynchronous. That is, they are dispatched and you can only find the results through a callback. Although the callback is guaranteed to fire eventually, it may not fire in any specific given timeframe. Certain drivers may not support threading; if this is the case, an RTE will be thrown. If the threader cannot start or the threader is currently disabled, SourceMod will transparently execute the query in the main thread as a fallback.



Overall whats the end goal of what you plan to do with this? A little more info could help with what answers you will get, and possibly some help with the code.
atom0s is offline
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 08-17-2010 , 12:48   Re: Quite strange question.
Reply With Quote #3

Quote:
Originally Posted by atom0s View Post
You can use the built in SQL functions to manage doing this.

As for lagging the game, no. You can use the threaded methods to prevent the game from locking up while you await for callback returns and such.






Overall whats the end goal of what you plan to do with this? A little more info could help with what answers you will get, and possibly some help with the code.
Said in short, i want to post a message once in a while if Administrator's skype is online.
Now all i have to figure out is how to use the SQL functions in sourcepawn without the lag.
Zylius is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 08-17-2010 , 16:14   Re: Quite strange question.
Reply With Quote #4

I would use sockets and send a HTTP request to: http://mystatus.skype.com/username.xml then read the response.
__________________
pheadxdll is offline
atom0s
Senior Member
Join Date: Jul 2009
Old 08-17-2010 , 16:21   Re: Quite strange question.
Reply With Quote #5

Quote:
Originally Posted by pheadxdll View Post
I would use sockets and send a HTTP request to: http://mystatus.skype.com/username.xml then read the response.
Ah nice, didn't notice Skype had that. I would agree, this would be much more efficient then.
atom0s is offline
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 08-18-2010 , 02:47   Re: Quite strange question.
Reply With Quote #6

Quote:
Originally Posted by pheadxdll View Post
I would use sockets and send a HTTP request to: http://mystatus.skype.com/username.xml then read the response.
Oh, never knew about this site, thank you. It will make both of my scripts much more efficient!
________
Made the plugin, works like a charm. Thank you guys!

Last edited by Zylius; 08-18-2010 at 06:10.
Zylius is offline
Reply



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 15:30.


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