From 9e699d8f9e7cfaa003e0510533b7da63d89930f4 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Wed, 2 Jan 2019 03:09:36 +1100 Subject: [PATCH] move billboards and trolley vehicles into its own modules --- .../cnr/commands/admin/admin_two.pwn | 8 +++- .../irresistible/cnr/features/_features.pwn | 2 + .../irresistible/cnr/features/billboards.pwn | 27 ++++++++++++ .../irresistible/cnr/features/trolley_car.pwn | 43 +++++++++++++++++++ gamemodes/irresistible/cnr/global.pwn | 1 - gamemodes/sf-cnr.pwn | 22 ---------- 6 files changed, 78 insertions(+), 25 deletions(-) create mode 100644 gamemodes/irresistible/cnr/features/billboards.pwn create mode 100644 gamemodes/irresistible/cnr/features/trolley_car.pwn diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn index 32c2ec9..5921793 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn @@ -133,7 +133,9 @@ CMD:vdestroy( playerid, params[ ] ) #if defined __cnr__chuffsec if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." ); #endif - if ( g_TrolleyVehicles[ 0 ] == vID || g_TrolleyVehicles[ 1 ] == vID || g_TrolleyVehicles[ 2 ] == vID || g_TrolleyVehicles[ 3 ] == vID || g_TrolleyVehicles[ 4 ] == vID ) return SendError( playerid, "This vehicle is prohibited." ); + #if defined __cnr__trolley_car + if ( IsTrolleyVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." ); + #endif DestroyVehicle( vID ); if ( g_adminSpawnedCar{ vID } ) g_adminSpawnedCar{ vID } = false; SendClientMessage( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have destroyed the vehicle you were using." ); @@ -144,7 +146,9 @@ CMD:vdestroy( playerid, params[ ] ) #if defined __cnr__chuffsec else if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." ); #endif - else if ( g_TrolleyVehicles[ 0 ] == vID || g_TrolleyVehicles[ 1 ] == vID || g_TrolleyVehicles[ 2 ] == vID || g_TrolleyVehicles[ 3 ] == vID || g_TrolleyVehicles[ 4 ] == vID ) return SendError( playerid, "This vehicle is prohibited." ); +#if defined __cnr__trolley_car + else if ( IsTrolleyVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." ); +#endif else { DestroyVehicle( vID ); diff --git a/gamemodes/irresistible/cnr/features/_features.pwn b/gamemodes/irresistible/cnr/features/_features.pwn index a9375fe..50c9768 100644 --- a/gamemodes/irresistible/cnr/features/_features.pwn +++ b/gamemodes/irresistible/cnr/features/_features.pwn @@ -62,6 +62,8 @@ #include "irresistible\cnr\features\c4.pwn" #include "irresistible\cnr\features\tax.pwn" #include "irresistible\cnr\features\shamal.pwn" +#include "irresistible\cnr\features\billboards.pwn" +#include "irresistible\cnr\features\trolley_car.pwn" // pool #include "irresistible\cnr\features\pool.pwn" diff --git a/gamemodes/irresistible/cnr/features/billboards.pwn b/gamemodes/irresistible/cnr/features/billboards.pwn new file mode 100644 index 0000000..012c533 --- /dev/null +++ b/gamemodes/irresistible/cnr/features/billboards.pwn @@ -0,0 +1,27 @@ +/* + * Irresistible Gaming (c) 2018 + * Developed by Lorenc + * Module: cnr\features\billboards.pwn + * Purpose: specially placed billboards to help user experience in the cities + */ + +/* ** Includes ** */ +#include < YSI\y_hooks > + +/* ** Macros ** */ +#define CreateBillboard(%0,%1,%2,%3,%4) \ + SetDynamicObjectMaterialText( CreateDynamicObject( 7246, %1, %2, %3, 0, 0, %4 ), 0, (%0), 120, "Arial", 24, 0, -1, -16777216, 1 ) + +/* ** Hooks ** */ +hook OnScriptInit( ) +{ + CreateBillboard( "Want V.I.P? Consider Donating!\n"COL_GREY"donate.sfcnr.com", -2016.22, 326.580, 37.950, 48.9000 ); + CreateBillboard( "Save us on your favourites!\n"#SERVER_IP"", -1809.64, -590.29, 19.360, -147.30 ); + CreateBillboard( "You can catch updates on our website!\n"COL_GREY""#SERVER_WEBSITE"", -1571.11, 939.860, 10.030, 45.9600 ); + CreateBillboard( "Remember to check the "COL_GREY"/rules"COL_WHITE"!\nDisobeying the rules can lead to punishment!", -1911.05, 858.870, 36.290, 44.5200 ); + CreateBillboard( "Want to view the commands?\n Use "COL_GREY"/commands{FFFFFF}!", -2423.40, -621.18, 135.46, -195.90 ); + CreateBillboard( "Need help with something?\nUse "COL_GREY"/ask"COL_WHITE" to contact an admin!", -2659.78, 1277.70, 9.8600, 125.100 ); + CreateBillboard( "Saw a cheater? Report him by typing "COL_GREY"/report{FFFFFF}!", -2443.63, 719.970, 37.900, 0.00000 ); + CreateBillboard( "You can use "COL_GREY"/vipcmds"COL_WHITE" to view your\nV.I.P commands!", -1958.975830, 841.130798, 1208.881469, -43.700046 ); + return 1; +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/features/trolley_car.pwn b/gamemodes/irresistible/cnr/features/trolley_car.pwn new file mode 100644 index 0000000..ef92c04 --- /dev/null +++ b/gamemodes/irresistible/cnr/features/trolley_car.pwn @@ -0,0 +1,43 @@ +/* + * Irresistible Gaming (c) 2018 + * Developed by Lorenc + * Module: cnr\features\trolley_car.pwn + * Purpose: cool feature where there are drivable trolleys at supa-save ... o.g feature since 2012 + */ + +/* ** Includes ** */ +#include < YSI\y_hooks > + +/* ** Error Checking ** */ +#if !defined __cnr__trolley_car + #define __cnr__trolley_car +#endif + +/* ** Variables ** */ +static stock + g_TrolleyVehicles [ 5 ] = { INVALID_VEHICLE_ID, ... }; + +/* ** Hooks ** */ +hook OnScriptInit( ) +{ + // create gold cart + g_TrolleyVehicles[ 0 ] = AddStaticVehicle( 457, -2511.7935, 760.5610, 34.8990, 90.6223, 123, 1 ); // trolley + g_TrolleyVehicles[ 1 ] = AddStaticVehicle( 457, -2511.5742, 766.5329, 34.8990, 91.5108, 112, 1 ); // trolley + g_TrolleyVehicles[ 2 ] = AddStaticVehicle( 457, -2511.8782, 763.1669, 34.8990, 89.6839, 116, 1 ); // trolley + g_TrolleyVehicles[ 3 ] = AddStaticVehicle( 457, -2511.4871, 769.7538, 34.8990, 91.3486, 116, 1 ); // trolley + g_TrolleyVehicles[ 4 ] = AddStaticVehicle( 457, -2512.2607, 772.9983, 34.9006, 91.2577, 116, 1 ); // trolley + + // set the golf cart to a trolley! + for ( new i = 0; i < sizeof( g_TrolleyVehicles ); i ++ ) { + ChangeVehicleModel( g_TrolleyVehicles[ i ], 1349, 270.0 + 180.0 ); + } + return 1; +} + +/* ** Functions ** */ +stock IsTrolleyVehicle( vehicleid ) { + for ( new i = 0; i < sizeof( g_TrolleyVehicles ); i ++ ) if ( g_TrolleyVehicles[ i ] == vehicleid ) { + return true; + } + return false; +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/global.pwn b/gamemodes/irresistible/cnr/global.pwn index 8f9f682..8114006 100644 --- a/gamemodes/irresistible/cnr/global.pwn +++ b/gamemodes/irresistible/cnr/global.pwn @@ -7,7 +7,6 @@ /* ** Variables ** */ new - g_TrolleyVehicles [ 5 ], engine, lights, doors, bonnet, boot, objective, alarm, panels, tires, g_ServerUptime = 0, rl_ServerUpdate = 0xFF, diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 8a10293..b6bdfff 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -58,7 +58,6 @@ native gpci ( playerid, serial[ ], len ); #define Ach_Unlock(%0,%1) (%0 >= %1 ?("{6EF83C}"):("{FFFFFF}")) #define Achievement:: ach_ -#define CreateBillboard(%0,%1,%2,%3,%4) SetDynamicObjectMaterialText(CreateDynamicObject(7246,%1,%2,%3,0,0,%4),0,(%0),120,"Arial",24,0,-1,-16777216,1) #define MAX_TIME_TIED 180 #define MAX_VEH_ATTACHED_OBJECTS 2 @@ -87,27 +86,6 @@ public OnGameModeInit() AddServerVariable( "connectsong", "http://files.sfcnr.com/game_sounds/Stevie%20Wonder%20-%20Skeletons.mp3", GLOBAL_VARTYPE_STRING ); AddServerVariable( "discordurl", "http://sfcnr.com/discord", GLOBAL_VARTYPE_STRING ); - /* ** Custom Vehicles ** */ - g_TrolleyVehicles[ 0 ] = AddStaticVehicle( 457, -2511.7935, 760.5610, 34.8990, 90.6223, 123, 1 ); // trolley - g_TrolleyVehicles[ 1 ] = AddStaticVehicle( 457, -2511.5742, 766.5329, 34.8990, 91.5108, 112, 1 ); // trolley - g_TrolleyVehicles[ 2 ] = AddStaticVehicle( 457, -2511.8782, 763.1669, 34.8990, 89.6839, 116, 1 ); // trolley - g_TrolleyVehicles[ 3 ] = AddStaticVehicle( 457, -2511.4871, 769.7538, 34.8990, 91.3486, 116, 1 ); // trolley - g_TrolleyVehicles[ 4 ] = AddStaticVehicle( 457, -2512.2607, 772.9983, 34.9006, 91.2577, 116, 1 ); // trolley - - for( new i; i < sizeof( g_TrolleyVehicles ); i++ ) - ChangeVehicleModel( g_TrolleyVehicles[ i ], 1349, 270.0 + 180.0 ); - - /* ** Objects ** */ - // Billboards - CreateBillboard( "Want V.I.P? Consider Donating!\n"COL_GREY"donate.sfcnr.com", -2016.22, 326.580, 37.950, 48.9000 ); - CreateBillboard( "Save us on your favourites!\n"#SERVER_IP"", -1809.64, -590.29, 19.360, -147.30 ); - CreateBillboard( "You can catch updates on our website!\n"COL_GREY""#SERVER_WEBSITE"", -1571.11, 939.860, 10.030, 45.9600 ); - CreateBillboard( "Remember to check the "COL_GREY"/rules"COL_WHITE"!\nDisobeying the rules can lead to punishment!", -1911.05, 858.870, 36.290, 44.5200 ); - CreateBillboard( "Want to view the commands?\n Use "COL_GREY"/commands{FFFFFF}!", -2423.40, -621.18, 135.46, -195.90 ); - CreateBillboard( "Need help with something?\nUse "COL_GREY"/ask"COL_WHITE" to contact an admin!", -2659.78, 1277.70, 9.8600, 125.100 ); - CreateBillboard( "Saw a cheater? Report him by typing "COL_GREY"/report{FFFFFF}!", -2443.63, 719.970, 37.900, 0.00000 ); - CreateBillboard( "You can use "COL_GREY"/vipcmds"COL_WHITE" to view your\nV.I.P commands!", -1958.975830, 841.130798, 1208.881469, -43.700046 ); - /* ** Set everyone offline ** */ mysql_single_query( "UPDATE `USERS` SET `ONLINE` = 0" );