twitter command moved to /commands folder
This commit is contained in:
parent
02ac789629
commit
f9c6250764
@ -9,4 +9,5 @@
|
|||||||
#include "irresistible\cnr\commands\admin\_admin.pwn"
|
#include "irresistible\cnr\commands\admin\_admin.pwn"
|
||||||
|
|
||||||
/* ** Files ** */
|
/* ** Files ** */
|
||||||
#include "irresistible\cnr\commands\cmd_changes.pwn"
|
#include "irresistible\cnr\commands\cmd_changes.pwn"
|
||||||
|
#include "irresistible\cnr\commands\cmd_twitter.pwn"
|
37
gamemodes/irresistible/cnr/commands/cmd_twitter.pwn
Normal file
37
gamemodes/irresistible/cnr/commands/cmd_twitter.pwn
Normal 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;
|
||||||
|
}
|
@ -19,8 +19,11 @@
|
|||||||
#define SERVER_WEBSITE "www.sfcnr.com"
|
#define SERVER_WEBSITE "www.sfcnr.com"
|
||||||
#define SERVER_IP "54.36.127.43:7777"
|
#define SERVER_IP "54.36.127.43:7777"
|
||||||
|
|
||||||
|
#define SERVER_TWITTER "IrresistibleDev"
|
||||||
|
|
||||||
/* ** Comment line to disable feature ** */
|
/* ** Comment line to disable feature ** */
|
||||||
#define SERVER_RULES_URL "files.sfcnr.com/en_rules.txt"
|
#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"
|
#define SERVER_CHANGES_FILE "updates.txt"
|
||||||
|
|
||||||
/* ** Hooks ** */
|
/* ** Hooks ** */
|
||||||
|
@ -87,7 +87,6 @@ public OnPlayerDriveVehicle( playerid, vehicleid );
|
|||||||
public OnServerUpdateTimer( );
|
public OnServerUpdateTimer( );
|
||||||
public OnServerSecondTick( );
|
public OnServerSecondTick( );
|
||||||
public OnHelpHTTPResponse( index, response_code, data[ ] );
|
public OnHelpHTTPResponse( index, response_code, data[ ] );
|
||||||
public OnTwitterHTTPResponse( index, response_code, data[ ] );
|
|
||||||
public OnPlayerAccessEntrance( playerid, entranceid, worldid, interiorid );
|
public OnPlayerAccessEntrance( playerid, entranceid, worldid, interiorid );
|
||||||
|
|
||||||
main()
|
main()
|
||||||
@ -550,15 +549,6 @@ public OnServerSecondTick( )
|
|||||||
return 1;
|
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 )
|
public OnPlayerRequestClass( playerid, classid )
|
||||||
{
|
{
|
||||||
p_Spawned{ playerid } = false;
|
p_Spawned{ playerid } = false;
|
||||||
@ -2977,14 +2967,6 @@ CMD:vipjob( playerid, params[ ] )
|
|||||||
return 1;
|
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:mechanic( playerid, params[ ] ) return cmd_mech( playerid, params );
|
||||||
CMD:mech( playerid, params[ ] )
|
CMD:mech( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user