move enterable shamal code to module

This commit is contained in:
Lorenc Pekaj 2019-01-02 01:11:47 +11:00
parent 692f58a1f5
commit 0ccc26dbe4
5 changed files with 126 additions and 89 deletions

View File

@ -60,6 +60,7 @@
#include "irresistible\cnr\features\random_hits.pwn"
#include "irresistible\cnr\features\c4.pwn"
#include "irresistible\cnr\features\tax.pwn"
#include "irresistible\cnr\features\shamal.pwn"
// pool
#include "irresistible\cnr\features\pool.pwn"

View File

@ -0,0 +1,118 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc
* Module: cnr\features\shamal.pwn
* Purpose: feature to allow passengers into shamals
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Definitions ** */
#define VW_SHAMAL 220
/* ** Macros ** */
#define IsPlayerInShamal(%0) ( GetPlayerInterior( %0 ) == VW_SHAMAL )
#define GetPlayerShamalVehicle(%0) ( GetPlayerVirtualWorld( %0 ) - VW_SHAMAL )
/* ** Hooks ** */
hook OnScriptInit( )
{
// Shamal Interior
CreateDynamicObject( 14404, 1320.00000, 2000.00000, 1201.00000, 0.00000, 0.00000, 0.00000 );
CreateDynamicObject( 1562, 1321.13000, 2000.05005, 1199.90002, 0.00000, 0.00000, 0.00000 );
CreateDynamicObject( 1562, 1321.13000, 1997.65002, 1199.90002, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 1562, 1321.13000, 1995.34998, 1199.90002, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 1562, 1318.87000, 1998.94995, 1199.90002, 0.00000, 0.00000, 0.00000 );
CreateDynamicObject( 1562, 1318.87000, 1996.55005, 1199.90002, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 1562, 1318.87000, 1994.15002, 1199.90002, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 1563, 1321.13000, 2000.39001, 1200.43994, 0.00000, 0.00000, 0.00000 );
CreateDynamicObject( 1563, 1321.13000, 1997.31006, 1200.43994, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 1563, 1321.13000, 1995.01001, 1200.43994, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 1563, 1318.87000, 1999.29004, 1200.43994, 0.00000, 0.00000, 0.00000 );
CreateDynamicObject( 1563, 1318.87000, 1996.20996, 1200.43994, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 1563, 1318.87000, 1993.81006, 1200.43994, 0.00000, 0.00000, 180.00000 );
CreateDynamicObject( 14405, 1320.00000, 1999.69995, 1199.90002, 0.00000, 0.00000, 0.00000 );
// Parachute Shamal Interior
CreateDynamicPickup( 371, 2, 1318.92200, 2002.7311, 1200.250 );
return 1;
}
hook OnVehicleSpawn( vehicleid ) {
KillEveryoneInShamal( vehicleid );
return 1;
}
hook OnVehicleDeath( vehicleid, killerid ) {
KillEveryoneInShamal( vehicleid );
return 1;
}
hook OnPlayerEnterVehicle( playerid, vehicleid, ispassenger )
{
if ( ispassenger )
{
if ( GetVehicleModel( vehicleid ) == 519 )
{
SetPlayerPos( playerid, 1322.6577, 1992.5508, 1200.2574 );
SetPlayerVirtualWorld( playerid, vehicleid + VW_SHAMAL );
SetPlayerInterior( playerid, VW_SHAMAL );
pauseToLoad( playerid );
}
}
return 1;
}
hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
static
Float: X, Float: Y, Float: Z, Float: Angle;
if ( PRESSED( KEY_SECONDARY_ATTACK ) )
{
// Enter Shamal Interior
if ( ! IsPlayerTied( playerid ) && IsPlayerInShamal( playerid ) )
{
if ( IsPlayerInRangeOfPoint( playerid, 10.0, 1322.6577, 1992.5508, 1200.2574 ) )
{
new
vehicleid = GetPlayerVirtualWorld( playerid ) - VW_SHAMAL;
if ( IsValidVehicle( vehicleid ) )
{
GetVehiclePos( vehicleid, X, Y, Z );
GetVehicleZAngle( vehicleid, Angle );
X += ( 3.2 * floatsin( -( Angle - 45.0 ), degrees ) );
Y += ( 3.2 * floatcos( -( Angle - 45.0 ), degrees ) );
SetPlayerInterior( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
SetPlayerFacingAngle( playerid, Angle );
SetPlayerPos( playerid, X, Y, Z - 1 );
pauseToLoad( playerid );
}
}
}
}
return 1;
}
/* ** Functions ** */
static stock KillEveryoneInShamal( vehicleid )
{
static
Float: X, Float: Y, Float: Z;
foreach(new i : Player) {
if ( IsPlayerInShamal( i ) && ( GetPlayerVirtualWorld( i ) - VW_SHAMAL ) == vehicleid ) {
if ( IsValidVehicle( vehicleid ) ) {
GetPlayerPos( i, X, Y, Z );
CreateExplosionForPlayer( i, X, Y, Z - 0.75, 0, 10.0 );
SetPlayerHealth( i, -1 );
}
}
}
}

View File

@ -37,7 +37,6 @@ new
bool: p_Kidnapped [ MAX_PLAYERS char ],
bool: p_ToggledViewPM [ MAX_PLAYERS char ],
bool: p_ToggleCopChat [ MAX_PLAYERS char ],
p_CheckpointEnterTick [ MAX_PLAYERS ],
bool: p_pausedToLoad [ MAX_PLAYERS char ],
bool: p_CantUseReport [ MAX_PLAYERS char ],
p_pausedToLoadTimer [ MAX_PLAYERS ],

View File

@ -3727,22 +3727,6 @@ hook OnScriptInit( )
CreateDynamicObject(11392, -2047.75781, 168.14063, 27.88281, 0.00000, 0.00000, 0.00000);
CreateDynamicObject(11388, -2048.17969, 166.71875, 34.51563, 0.00000, 0.00000, 0.00000);
// Shamal Interior
CreateDynamicObject(14404, 1320.00000, 2000.00000, 1201.00000, 0.00000, 0.00000, 0.00000);
CreateDynamicObject(1562, 1321.13000, 2000.05005, 1199.90002, 0.00000, 0.00000, 0.00000);
CreateDynamicObject(1562, 1321.13000, 1997.65002, 1199.90002, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(1562, 1321.13000, 1995.34998, 1199.90002, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(1562, 1318.87000, 1998.94995, 1199.90002, 0.00000, 0.00000, 0.00000);
CreateDynamicObject(1562, 1318.87000, 1996.55005, 1199.90002, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(1562, 1318.87000, 1994.15002, 1199.90002, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(1563, 1321.13000, 2000.39001, 1200.43994, 0.00000, 0.00000, 0.00000);
CreateDynamicObject(1563, 1321.13000, 1997.31006, 1200.43994, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(1563, 1321.13000, 1995.01001, 1200.43994, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(1563, 1318.87000, 1999.29004, 1200.43994, 0.00000, 0.00000, 0.00000);
CreateDynamicObject(1563, 1318.87000, 1996.20996, 1200.43994, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(1563, 1318.87000, 1993.81006, 1200.43994, 0.00000, 0.00000, 180.00000);
CreateDynamicObject(14405, 1320.00000, 1999.69995, 1199.90002, 0.00000, 0.00000, 0.00000);
// Studio
SetDynamicObjectMaterial( CreateDynamicObject( 18981, 2328.617187, 914.297790, 1055.000000, 0.000000, 90.000000, 0.000000 ), 0, 13694, "lahillstxd1a", "Bow_Abattoir_Floor_Clean", -1 );
SetDynamicObjectMaterial( CreateDynamicObject( 18981, 2340.614013, 914.297790, 1055.000000, 0.000000, 0.000000, 0.000000 ), 0, 16150, "ufo_bar", "GEwhite1_64", -1 );

View File

@ -59,7 +59,6 @@ new bool: False = false;
/* ** Useful macros ** */
#define DQCMD:%1(%2) forward discord_%1(%2); public discord_%1(%2)
#define IsPlayerRobbing(%0) IsPlayerAttachedObjectSlotUsed(%0,0)
#define IsPlayerInShamal(%0) (GetPlayerInterior(%0)==VW_SHAMAL)
#define hasTickcountPassed(%1,%2) ((GetTickCount()-%1)>(%2))
#define Ach_Unlock(%0,%1) (%0 >= %1 ?("{6EF83C}"):("{FFFFFF}"))
#define UpdatePlayerTime(%0) SetPlayerTime(%0,floatround(g_WorldClockSeconds/60),g_WorldClockSeconds-floatround((g_WorldClockSeconds/60)*60))
@ -79,7 +78,6 @@ new bool: False = false;
#define MAX_TIME_TIED 180
#define MAX_VEH_ATTACHED_OBJECTS 2
#define VW_SHAMAL 220
/* ** Forwards ** */
public OnPlayerDriveVehicle( playerid, vehicleid );
@ -141,7 +139,6 @@ public OnGameModeInit()
g_AlcatrazArea = CreateDynamicRectangle( -1921.6816, 1661.7448, -2172.4653, 1876.0469 );
/* ** Pickups ** */
CreateDynamicPickup( 371, 2, 1318.92200, 2002.7311, 1200.250 ); // Parachute @Shamal
CreateDynamicPickup( 371, 2, -1745.2754, 59.301500, 866.4556 ); // Parachute @Veloxity
/* ** Set everyone offline ** */
@ -1530,8 +1527,6 @@ public OnPlayerDeath( playerid, killerid, reason )
public OnVehicleSpawn( vehicleid )
{
KillEveryoneInShamal( vehicleid );
if ( g_buyableVehicle{ vehicleid } == true ) {
RespawnBuyableVehicle( vehicleid );
}
@ -1540,7 +1535,6 @@ public OnVehicleSpawn( vehicleid )
public OnVehicleDeath( vehicleid, killerid )
{
KillEveryoneInShamal( vehicleid );
return 1;
}
@ -4135,17 +4129,6 @@ public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
}
else
{
switch( iModel )
{
case 519: // Shamal
{
SetPlayerPos( playerid, 1322.6577, 1992.5508, 1200.2574 );
SetPlayerVirtualWorld( playerid, vehicleid + VW_SHAMAL );
SetPlayerInterior( playerid, VW_SHAMAL );
pauseToLoad( playerid );
}
}
// Enter a wanted players vehicle?
if ( driverid != INVALID_PLAYER_ID && !p_WantedLevel[ playerid ] && p_Class[ playerid ] != CLASS_POLICE )
{
@ -4717,38 +4700,6 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
SetCameraBehindPlayer( playerid );
return 1;
}
if ( g_iTime > p_CheckpointEnterTick[ playerid ] && !p_pausedToLoad{ playerid } && !IsPlayerTied( playerid ) )
{
p_CheckpointEnterTick[ playerid ] = g_iTime + 2;
// Enter Shamal Interior
if ( IsPlayerInShamal( playerid ) )
{
if ( IsPlayerInRangeOfPoint( playerid, 10.0, 1322.6577, 1992.5508, 1200.2574 ) )
{
new
vehicleid = GetPlayerVirtualWorld( playerid ) - VW_SHAMAL
;
if ( IsValidVehicle( vehicleid ) )
{
GetVehiclePos( vehicleid, X, Y, Z );
GetVehicleZAngle( vehicleid, Angle );
X += ( 3.2 * floatsin( -( Angle - 45.0 ), degrees ) );
Y += ( 3.2 * floatcos( -( Angle - 45.0 ), degrees ) );
SetPlayerInterior( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
SetPlayerFacingAngle( playerid, Angle );
SetPlayerPos( playerid, X, Y, Z - 1 );
pauseToLoad( playerid );
}
}
}
}
}
else if ( HOLDING( KEY_AIM ) )
@ -5009,12 +4960,12 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
if ( ! response )
return ShowPlayerSpawnMenu( playerid );
#if VIP_ALLOW_OVER_LIMIT == false
if ( ! p_VIPLevel[ playerid ] && p_OwnedHouses[ playerid ] > GetPlayerHouseSlots( playerid ) ) {
ResetSpawnLocation( playerid );
return SendError( playerid, "Please renew your V.I.P or sell this home to match your house allocated limit (/h sell)." );
}
#endif
#if VIP_ALLOW_OVER_LIMIT == false
if ( ! p_VIPLevel[ playerid ] && p_OwnedHouses[ playerid ] > GetPlayerHouseSlots( playerid ) ) {
ResetSpawnLocation( playerid );
return SendError( playerid, "Please renew your V.I.P or sell this home to match your house allocated limit (/h sell)." );
}
#endif
new x = 0;
@ -6868,7 +6819,7 @@ stock IsVehicleOccupied( vehicleid, bool: include_vehicle_interior = false )
if ( GetPlayerVehicleID( i ) == vehicleid )
return i;
if ( include_vehicle_interior && IsPlayerSpawned( i ) && ( GetPlayerMethLabVehicle( i ) == vehicleid && iModel == 508 ) || ( ( GetPlayerVirtualWorld( i ) - VW_SHAMAL ) == vehicleid && iModel == 519 ) )
if ( include_vehicle_interior && IsPlayerSpawned( i ) && ( GetPlayerMethLabVehicle( i ) == vehicleid && iModel == 508 ) || ( GetPlayerShamalVehicle( i ) == vehicleid && iModel == 519 ) )
return i;
}
return -1;
@ -7033,22 +6984,6 @@ stock CensoreString( query[ ], characters = 5 )
return szString;
}
stock KillEveryoneInShamal( vehicleid )
{
static
Float: X, Float: Y, Float: Z;
foreach(new i : Player) {
if ( IsPlayerInShamal( i ) && ( GetPlayerVirtualWorld( i ) - VW_SHAMAL ) == vehicleid ) {
if ( IsValidVehicle( vehicleid ) ) {
GetPlayerPos( i, X, Y, Z );
CreateExplosionForPlayer( i, X, Y, Z - 0.75, 0, 10.0 );
SetPlayerHealth( i, -1 );
}
}
}
}
stock CreateExplosionEx( Float: X, Float: Y, Float: Z, type, Float: radius, world, interior, issuerid = INVALID_PLAYER_ID )
{
foreach(new i : Player) {