twitter command moved to /commands folder

This commit is contained in:
Lorenc Pekaj 2018-12-23 10:24:17 +11:00
parent 02ac789629
commit f9c6250764
4 changed files with 42 additions and 19 deletions

View File

@ -10,3 +10,4 @@
/* ** Files ** */
#include "irresistible\cnr\commands\cmd_changes.pwn"
#include "irresistible\cnr\commands\cmd_twitter.pwn"

View File

@ -0,0 +1,37 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc
* Module: cnr\commands\cmd_twitter.pwn
* Purpose: twitter feed displayer (requires php script)
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Error Checking ** */
#if !defined SERVER_TWITTER_FEED_URL
#endinput
#endif
/* ** Forwards ** */
forward OnTwitterHTTPResponse( index, response_code, data[ ] );
/* ** Commands ** */
CMD:tweets( playerid, params[ ] ) return cmd_twitter( playerid, params );
CMD:twitter( playerid, params[ ] )
{
SendServerMessage( playerid, "Reading latest tweets from {00CCFF}www.twitter.com/IrresistibleDev{FFFFFF}, please wait!" );
HTTP( playerid, HTTP_GET, SERVER_TWITTER_FEED_URL, "", "OnTwitterHTTPResponse" );
return 1;
}
/* ** Callbacks ** */
public OnTwitterHTTPResponse( index, response_code, data[ ] )
{
if ( response_code == 200 ) {
ShowPlayerDialog( index, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{00CCFF}@" # SERVER_TWITTER ""COL_WHITE" - Twitter", data, "Okay", "" );
} else {
ShowPlayerDialog( index, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{00CCFF}@" # SERVER_TWITTER ""COL_WHITE" - Twitter", ""COL_WHITE"An error has occurred, try again later.", "Okay", "" );
}
return 1;
}

View File

@ -19,8 +19,11 @@
#define SERVER_WEBSITE "www.sfcnr.com"
#define SERVER_IP "54.36.127.43:7777"
#define SERVER_TWITTER "IrresistibleDev"
/* ** Comment line to disable feature ** */
#define SERVER_RULES_URL "files.sfcnr.com/en_rules.txt"
#define SERVER_TWITTER_FEED_URL "files.sfcnr.com/cnr_twitter.php"
#define SERVER_CHANGES_FILE "updates.txt"
/* ** Hooks ** */

View File

@ -87,7 +87,6 @@ public OnPlayerDriveVehicle( playerid, vehicleid );
public OnServerUpdateTimer( );
public OnServerSecondTick( );
public OnHelpHTTPResponse( index, response_code, data[ ] );
public OnTwitterHTTPResponse( index, response_code, data[ ] );
public OnPlayerAccessEntrance( playerid, entranceid, worldid, interiorid );
main()
@ -550,15 +549,6 @@ public OnServerSecondTick( )
return 1;
}
public OnTwitterHTTPResponse( index, response_code, data[ ] )
{
if ( response_code == 200 ) //Did the request succeed?
ShowPlayerDialog( index, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{00CCFF}@IrresistibleDev"COL_WHITE" - Twitter", data, "Okay", "" );
else
ShowPlayerDialog( index, DIALOG_NULL, DIALOG_STYLE_MSGBOX, "{00CCFF}@IrresistibleDev"COL_WHITE" - Twitter", ""COL_WHITE"An error has occurred, try again later.", "Okay", "" );
return 1;
}
public OnPlayerRequestClass( playerid, classid )
{
p_Spawned{ playerid } = false;
@ -2977,14 +2967,6 @@ CMD:vipjob( playerid, params[ ] )
return 1;
}
CMD:tweets( playerid, params[ ] ) return cmd_twitter( playerid, params );
CMD:twitter( playerid, params[ ] )
{
SendServerMessage( playerid, "Reading latest tweets from {00CCFF}www.twitter.com/IrresistibleDev{FFFFFF}, please wait!" );
HTTP( playerid, HTTP_GET, "files.sfcnr.com/cnr_twitter.php", "", "OnTwitterHTTPResponse" );
return 1;
}
CMD:mechanic( playerid, params[ ] ) return cmd_mech( playerid, params );
CMD:mech( playerid, params[ ] )
{