modulize vending machines and thrown into anticheat package
This commit is contained in:
parent
d5a9c7f8a3
commit
4df1a7561d
@ -280,15 +280,6 @@ hook OnPlayerConnect( playerid )
|
|||||||
{
|
{
|
||||||
if ( 0 <= playerid < MAX_PLAYERS )
|
if ( 0 <= playerid < MAX_PLAYERS )
|
||||||
{
|
{
|
||||||
// Remove Vending Machines
|
|
||||||
RemoveBuildingForPlayer( playerid, 1302, 0.0, 0.0, 0.0, 6000.0 );
|
|
||||||
RemoveBuildingForPlayer( playerid, 1209, 0.0, 0.0, 0.0, 6000.0 );
|
|
||||||
RemoveBuildingForPlayer( playerid, 955, 0.0, 0.0, 0.0, 6000.00 );
|
|
||||||
RemoveBuildingForPlayer( playerid, 956, 0.0, 0.0, 0.0, 6000.00 );
|
|
||||||
RemoveBuildingForPlayer( playerid, 1775, 0.0, 0.0, 0.0, 6000.0 );
|
|
||||||
RemoveBuildingForPlayer( playerid, 1776, 0.0, 0.0, 0.0, 6000.0 );
|
|
||||||
RemoveBuildingForPlayer( playerid, 1977, 0.0, 0.0, 0.0, 6000.0 );
|
|
||||||
|
|
||||||
// Reset variables
|
// Reset variables
|
||||||
p_PlayerHealth[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
p_PlayerHealth[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
||||||
p_PlayerArmour[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
p_PlayerArmour[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
||||||
@ -599,3 +590,8 @@ stock ForcePlayerKill( playerid, killerid, weaponid )
|
|||||||
|
|
||||||
SetPlayerHealth( playerid, -1 );
|
SetPlayerHealth( playerid, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ** Modules ** */
|
||||||
|
#if defined __ac__money
|
||||||
|
#include "irresistible\anticheat\vending_machines.pwn"
|
||||||
|
#endif
|
||||||
|
@ -5,6 +5,13 @@
|
|||||||
* Purpose: server-sided money
|
* Purpose: server-sided money
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* ** Error checking ** */
|
||||||
|
#if !defined __ac__money
|
||||||
|
#define __ac__money
|
||||||
|
#else
|
||||||
|
#endinput
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
static stock
|
static stock
|
||||||
p_Cash [ MAX_PLAYERS ];
|
p_Cash [ MAX_PLAYERS ];
|
||||||
|
@ -1,17 +1,229 @@
|
|||||||
/*
|
/*
|
||||||
* Irresistible Gaming (c) 2018
|
* Irresistible Gaming (c) 2018
|
||||||
* Developed by Lorenc Pekaj
|
* Developed by Lorenc Pekaj
|
||||||
* Module:
|
* Module: anticheat\vending_machines.pwn
|
||||||
* Purpose:
|
* Purpose: server-sided vending machines placed around san andreas
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* ** Error Checking ** */
|
||||||
|
#if !defined __ac__money
|
||||||
|
#error "Server-sided vending machines is not using server-sided money"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ** Includes ** */
|
/* ** Includes ** */
|
||||||
#include < YSI\y_hooks >
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
/* ** Definitions ** */
|
/* ** Definitions ** */
|
||||||
|
#define AC_VENDING_MACHINE_COST ( 500 )
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
|
enum E_VENDING_MACHINE
|
||||||
|
{
|
||||||
|
E_MODEL,
|
||||||
|
E_INTERIOR,
|
||||||
|
Float: E_X,
|
||||||
|
Float: E_Y,
|
||||||
|
Float: E_Z,
|
||||||
|
Float: E_RX,
|
||||||
|
Float: E_RY,
|
||||||
|
Float: E_RZ,
|
||||||
|
Float: E_FX,
|
||||||
|
Float: E_FY
|
||||||
|
};
|
||||||
|
|
||||||
|
static const
|
||||||
|
g_VendingMachines[ ] [ E_VENDING_MACHINE ] =
|
||||||
|
{
|
||||||
|
{ 955, 0, -862.82, 1536.60, 21.98, 0.00, 0.00, 180.00, -862.84, 1537.60 }, { 1775, 16, -35.72, -140.22, 1003.63, 0.00, 0.00, 180.00, -35.74, -139.22 },
|
||||||
|
{ 956, 0, 2271.72, -76.46, 25.96, 0.00, 0.00, 0.00, 2271.72, -77.46 }, { 955, 0, 1277.83, 372.51, 18.95, 0.00, 0.00, 64.00, 1278.73, 372.07 },
|
||||||
|
{ 956, 0, 662.42, -552.16, 15.71, 0.00, 0.00, 180.00, 662.41, -551.16 }, { 955, 0, 201.01, -107.61, 0.89, 0.00, 0.00, 270.00, 200.01, -107.63 },
|
||||||
|
{ 955, 0, -253.74, 2597.95, 62.24, 0.00, 0.00, 90.00, -252.74, 2597.95 }, { 956, 0, -253.74, 2599.75, 62.24, 0.00, 0.00, 90.00, -252.74, 2599.75 },
|
||||||
|
{ 956, 0, -76.03, 1227.99, 19.12, 0.00, 0.00, 90.00, -75.03, 1227.99 }, { 955, 0, -14.70, 1175.35, 18.95, 0.00, 0.00, 180.00, -14.72, 1176.35 },
|
||||||
|
{ 1977, 7, 316.87, -140.35, 998.58, 0.00, 0.00, 270.00, 315.87, -140.36 }, { 1775, 17, 373.82, -178.14, 1000.73, 0.00, 0.00, 0.00, 373.82, -179.14 },
|
||||||
|
{ 1776, 17, 379.03, -178.88, 1000.73, 0.00, 0.00, 270.00, 378.03, -178.90 }, { 1775, 17, 495.96, -24.32, 1000.73, 0.00, 0.00, 180.00, 495.95, -23.32 },
|
||||||
|
{ 1776, 17, 500.56, -1.36, 1000.73, 0.00, 0.00, 0.00, 500.56, -2.36 }, { 1775, 17, 501.82, -1.42, 1000.73, 0.00, 0.00, 0.00, 501.82, -2.42 },
|
||||||
|
{ 956, 0, -1455.11, 2591.66, 55.23, 0.00, 0.00, 180.00, -1455.13, 2592.66 }, { 955, 0, 2352.17, -1357.15, 23.77, 0.00, 0.00, 90.00, 2353.17, -1357.15 },
|
||||||
|
{ 955, 0, 2325.97, -1645.13, 14.21, 0.00, 0.00, 0.00, 2325.97, -1646.13 }, { 956, 0, 2139.51, -1161.48, 23.35, 0.00, 0.00, 87.00, 2140.51, -1161.53 },
|
||||||
|
{ 956, 0, 2153.23, -1016.14, 62.23, 0.00, 0.00, 127.00, 2154.03, -1015.54 }, { 955, 0, 1928.73, -1772.44, 12.94, 0.00, 0.00, 90.00, 1929.73, -1772.44 },
|
||||||
|
{ 1776, 1, 2222.36, 1602.64, 1000.06, 0.00, 0.00, 90.00, 2223.36, 1602.64 }, { 1775, 1, 2222.20, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2223.20, 1606.77 },
|
||||||
|
{ 1775, 1, 2155.90, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2156.90, 1606.77 }, { 1775, 1, 2209.90, 1607.19, 1000.05, 0.00, 0.00, 270.00, 2208.90, 1607.17 },
|
||||||
|
{ 1776, 1, 2155.84, 1607.87, 1000.06, 0.00, 0.00, 90.00, 2156.84, 1607.87 }, { 1776, 1, 2202.45, 1617.00, 1000.06, 0.00, 0.00, 180.00, 2202.43, 1618.00 },
|
||||||
|
{ 1776, 1, 2209.24, 1621.21, 1000.06, 0.00, 0.00, 0.00, 2209.24, 1620.21 }, { 1776, 3, 330.67, 178.50, 1020.07, 0.00, 0.00, 0.00, 330.67, 177.50 },
|
||||||
|
{ 1776, 3, 331.92, 178.50, 1020.07, 0.00, 0.00, 0.00, 331.92, 177.50 }, { 1776, 3, 350.90, 206.08, 1008.47, 0.00, 0.00, 90.00, 351.90, 206.08 },
|
||||||
|
{ 1776, 3, 361.56, 158.61, 1008.47, 0.00, 0.00, 180.00, 361.54, 159.61 }, { 1776, 3, 371.59, 178.45, 1020.07, 0.00, 0.00, 0.00, 371.59, 177.45 },
|
||||||
|
{ 1776, 3, 374.89, 188.97, 1008.47, 0.00, 0.00, 0.00, 374.89, 187.97 }, { 1775, 2, 2576.70, -1284.43, 1061.09, 0.00, 0.00, 270.00, 2575.70, -1284.44 },
|
||||||
|
{ 1775, 15, 2225.20, -1153.42, 1025.90, 0.00, 0.00, 270.00, 2224.20, -1153.43 }, { 955, 0, 1154.72, -1460.89, 15.15, 0.00, 0.00, 270.00, 1153.72, -1460.90 },
|
||||||
|
{ 956, 0, 2480.85, -1959.27, 12.96, 0.00, 0.00, 180.00, 2480.84, -1958.27 }, { 955, 0, 2060.11, -1897.64, 12.92, 0.00, 0.00, 0.00, 2060.11, -1898.64 },
|
||||||
|
{ 955, 0, 1729.78, -1943.04, 12.94, 0.00, 0.00, 0.00, 1729.78, -1944.04 }, { 956, 0, 1634.10, -2237.53, 12.89, 0.00, 0.00, 0.00, 1634.10, -2238.53 },
|
||||||
|
{ 955, 0, 1789.21, -1369.26, 15.16, 0.00, 0.00, 270.00, 1788.21, -1369.28 }, { 956, 0, -2229.18, 286.41, 34.70, 0.00, 0.00, 180.00, -2229.20, 287.41 },
|
||||||
|
{ 955, 256, -1980.78, 142.66, 27.07, 0.00, 0.00, 270.00, -1981.78, 142.64 }, { 955, 256, -2118.96, -423.64, 34.72, 0.00, 0.00, 255.00, -2119.93, -423.40 },
|
||||||
|
{ 955, 256, -2118.61, -422.41, 34.72, 0.00, 0.00, 255.00, -2119.58, -422.17 }, { 955, 256, -2097.27, -398.33, 34.72, 0.00, 0.00, 180.00, -2097.29, -397.33 },
|
||||||
|
{ 955, 256, -2092.08, -490.05, 34.72, 0.00, 0.00, 0.00, -2092.08, -491.05 }, { 955, 256, -2063.27, -490.05, 34.72, 0.00, 0.00, 0.00, -2063.27, -491.05 },
|
||||||
|
{ 955, 256, -2005.64, -490.05, 34.72, 0.00, 0.00, 0.00, -2005.64, -491.05 }, { 955, 256, -2034.46, -490.05, 34.72, 0.00, 0.00, 0.00, -2034.46, -491.05 },
|
||||||
|
{ 955, 256, -2068.56, -398.33, 34.72, 0.00, 0.00, 180.00, -2068.58, -397.33 }, { 955, 256, -2039.85, -398.33, 34.72, 0.00, 0.00, 180.00, -2039.86, -397.33 },
|
||||||
|
{ 955, 256, -2011.14, -398.33, 34.72, 0.00, 0.00, 180.00, -2011.15, -397.33 }, { 955, 2048, -1350.11, 492.28, 10.58, 0.00, 0.00, 90.00, -1349.11, 492.28 },
|
||||||
|
{ 956, 2048, -1350.11, 493.85, 10.58, 0.00, 0.00, 90.00, -1349.11, 493.85 }, { 955, 0, 2319.99, 2532.85, 10.21, 0.00, 0.00, 0.00, 2319.99, 2531.85 },
|
||||||
|
{ 956, 0, 2845.72, 1295.04, 10.78, 0.00, 0.00, 0.00, 2845.72, 1294.04 }, { 955, 0, 2503.14, 1243.69, 10.21, 0.00, 0.00, 180.00, 2503.12, 1244.69 },
|
||||||
|
{ 956, 0, 2647.69, 1129.66, 10.21, 0.00, 0.00, 0.00, 2647.69, 1128.66 }, { 1209, 0, -2420.21, 984.57, 44.29, 0.00, 0.00, 90.00, -2419.21, 984.57 },
|
||||||
|
{ 1302, 0, -2420.17, 985.94, 44.29, 0.00, 0.00, 90.00, -2419.17, 985.94 }, { 955, 0, 2085.77, 2071.35, 10.45, 0.00, 0.00, 90.00, 2086.77, 2071.35 },
|
||||||
|
{ 956, 0, 1398.84, 2222.60, 10.42, 0.00, 0.00, 180.00, 1398.82, 2223.60 }, { 956, 0, 1659.46, 1722.85, 10.21, 0.00, 0.00, 0.00, 1659.46, 1721.85 },
|
||||||
|
{ 955, 0, 1520.14, 1055.26, 10.00, 0.00, 0.00, 270.00, 1519.14, 1055.24 }, { 1775, 6, -19.03, -57.83, 1003.63, 0.00, 0.00, 180.00, -19.05, -56.83 },
|
||||||
|
{ 1775, 18, -16.11, -91.64, 1003.63, 0.00, 0.00, 180.00, -16.13, -90.64 }, { 1775, 16, -15.10, -140.22, 1003.63, 0.00, 0.00, 180.00, -15.11, -139.22 },
|
||||||
|
{ 1775, 17, -32.44, -186.69, 1003.63, 0.00, 0.00, 180.00, -32.46, -185.69 }, { 1775, 16, -35.72, -140.22, 1003.63, 0.00, 0.00, 180.00, -35.74, -139.22 },
|
||||||
|
{ 1776, 6, -36.14, -57.87, 1003.63, 0.00, 0.00, 180.00, -36.16, -56.87 }, { 1776, 18, -17.54, -91.71, 1003.63, 0.00, 0.00, 180.00, -17.56, -90.71 },
|
||||||
|
{ 1776, 16, -16.53, -140.29, 1003.63, 0.00, 0.00, 180.00, -16.54, -139.29 }, { 1776, 17, -33.87, -186.76, 1003.63, 0.00, 0.00, 180.00, -33.89, -185.76 },
|
||||||
|
{ 1775, 6, -19.03, -57.83, 1003.63, 0.00, 0.00, 180.00, -19.05, -56.83 }, { 1776, 6, -36.14, -57.87, 1003.63, 0.00, 0.00, 180.00, -36.16, -56.87 },
|
||||||
|
{ 1775, 18, -16.11, -91.64, 1003.63, 0.00, 0.00, 180.00, -16.13, -90.64 }, { 1776, 18, -17.54, -91.71, 1003.63, 0.00, 0.00, 180.00, -17.56, -90.71 },
|
||||||
|
{ 1776, 16, -16.53, -140.29, 1003.63, 0.00, 0.00, 180.00, -16.54, -139.29 }, { 1775, 16, -15.10, -140.22, 1003.63, 0.00, 0.00, 180.00, -15.11, -139.22 },
|
||||||
|
{ 1776, 17, -33.87, -186.76, 1003.63, 0.00, 0.00, 180.00, -33.89, -185.76 }, { 1775, 17, -32.44, -186.69, 1003.63, 0.00, 0.00, 180.00, -32.46, -185.69 }
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
static stock
|
||||||
|
g_VendingMachineObject [ sizeof( g_VendingMachines ) ] = { -1, ... },
|
||||||
|
p_VendingUseTimer [ MAX_PLAYERS ] = { -1, ... }
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Forwarding ** */
|
||||||
|
public VendingMachineUsed( playerid, Float: fHealthGiven );
|
||||||
|
|
||||||
/* ** Hooks ** */
|
/* ** Hooks ** */
|
||||||
|
hook OnScriptInit( )
|
||||||
|
{
|
||||||
|
for( new i = 0; i < sizeof( g_VendingMachineObject ); i++ )
|
||||||
|
{
|
||||||
|
g_VendingMachineObject[ i ] = CreateDynamicObject(
|
||||||
|
g_VendingMachines[ i ] [ E_MODEL ],
|
||||||
|
g_VendingMachines[ i ] [ E_X ],
|
||||||
|
g_VendingMachines[ i ] [ E_Y ],
|
||||||
|
g_VendingMachines[ i ] [ E_Z ],
|
||||||
|
g_VendingMachines[ i ] [ E_RX ],
|
||||||
|
g_VendingMachines[ i ] [ E_RY ],
|
||||||
|
g_VendingMachines[ i ] [ E_RZ ],
|
||||||
|
-1, -1
|
||||||
|
//-1, g_VendingMachines[ i ] [ E_INTERIOR ]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerConnect( playerid )
|
||||||
|
{
|
||||||
|
// Remove Vending Machines
|
||||||
|
RemoveBuildingForPlayer( playerid, 1302, 0.0, 0.0, 0.0, 6000.0 );
|
||||||
|
RemoveBuildingForPlayer( playerid, 1209, 0.0, 0.0, 0.0, 6000.0 );
|
||||||
|
RemoveBuildingForPlayer( playerid, 955, 0.0, 0.0, 0.0, 6000.00 );
|
||||||
|
RemoveBuildingForPlayer( playerid, 956, 0.0, 0.0, 0.0, 6000.00 );
|
||||||
|
RemoveBuildingForPlayer( playerid, 1775, 0.0, 0.0, 0.0, 6000.0 );
|
||||||
|
RemoveBuildingForPlayer( playerid, 1776, 0.0, 0.0, 0.0, 6000.0 );
|
||||||
|
RemoveBuildingForPlayer( playerid, 1977, 0.0, 0.0, 0.0, 6000.0 );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
||||||
|
{
|
||||||
|
if ( ( ( ( newkeys & KEY_SECONDARY_ATTACK ) == KEY_SECONDARY_ATTACK ) && ( ( oldkeys & KEY_SECONDARY_ATTACK ) != KEY_SECONDARY_ATTACK ) ) ) // pressed ENTER
|
||||||
|
{
|
||||||
|
if ( GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT && p_VendingUseTimer[ playerid ] == -1 && GetPlayerAnimationIndex( playerid ) != 1660 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
bool: bFailed,
|
||||||
|
Float: fHealth
|
||||||
|
;
|
||||||
|
|
||||||
|
GetPlayerHealth( playerid, fHealth );
|
||||||
|
|
||||||
|
if ( GetPlayerCash( playerid ) <= 0 || fHealth >= 100.0 )
|
||||||
|
bFailed = true;
|
||||||
|
|
||||||
|
for ( new i = 0; i < sizeof( g_VendingMachines ); i++ )
|
||||||
|
{
|
||||||
|
if ( IsPlayerInRangeOfPoint( playerid, 1.0, g_VendingMachines[ i ] [ E_FX ], g_VendingMachines[ i ] [ E_FY ], g_VendingMachines[ i ] [ E_Z ] ) )
|
||||||
|
{
|
||||||
|
if ( bFailed )
|
||||||
|
{
|
||||||
|
PlayerPlaySound( playerid, 1055, 0.0, 0.0, 0.0 );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new Float: health_given = 35.0;
|
||||||
|
new Float: Z;
|
||||||
|
|
||||||
|
if ( GetPlayerPos( playerid, Z, Z, Z ) )
|
||||||
|
{
|
||||||
|
GivePlayerCash( playerid, -AC_VENDING_MACHINE_COST );
|
||||||
|
|
||||||
|
p_VendingUseTimer[ playerid ] = SetTimerEx( "VendingMachineUsed", 2500, false, "if", playerid, health_given );
|
||||||
|
|
||||||
|
SetPlayerFacingAngle( playerid, g_VendingMachines[ i ] [ E_RZ ] );
|
||||||
|
SetPlayerPos( playerid, g_VendingMachines[ i ] [ E_FX ], g_VendingMachines[ i ] [ E_FY ], Z );
|
||||||
|
|
||||||
|
ApplyAnimation( playerid, "VENDING", "VEND_USE", 4.1, 0, 0, 1, 0, 0, 1 );
|
||||||
|
PlayerPlaySound( playerid, 42600, 0.0, 0.0, 0.0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayerPlaySound( playerid, 1055, 0.0, 0.0, 0.0 );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ )
|
||||||
|
{
|
||||||
|
ResetPlayerVendingMachineData( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerDisconnect( playerid, reason )
|
||||||
|
{
|
||||||
|
ResetPlayerVendingMachineData( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerEnterVehicle( playerid, vehicleid, ispassenger )
|
||||||
|
{
|
||||||
|
ResetPlayerVendingMachineData( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerStateChange( playerid, newstate, oldstate )
|
||||||
|
{
|
||||||
|
ResetPlayerVendingMachineData( playerid );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Callbacks ** */
|
||||||
|
public VendingMachineUsed( playerid, Float: fHealthGiven )
|
||||||
|
{
|
||||||
|
p_VendingUseTimer[ playerid ] = -1;
|
||||||
|
|
||||||
|
if ( GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
Float: fHealth;
|
||||||
|
|
||||||
|
GetPlayerHealth( playerid, fHealth );
|
||||||
|
|
||||||
|
fHealth += fHealthGiven;
|
||||||
|
|
||||||
|
if ( fHealth > 100.0 )
|
||||||
|
fHealth = 100.0;
|
||||||
|
|
||||||
|
SetPlayerHealth( playerid, fHealth );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ** Functions ** */
|
/* ** Functions ** */
|
||||||
|
stock ResetPlayerVendingMachineData( playerid )
|
||||||
|
{
|
||||||
|
if ( p_VendingUseTimer[ playerid ] != -1 )
|
||||||
|
{
|
||||||
|
KillTimer( p_VendingUseTimer[ playerid ] );
|
||||||
|
p_VendingUseTimer[ playerid ] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1750,74 +1750,6 @@ new
|
|||||||
Iterator:garages<MAX_GARAGES>
|
Iterator:garages<MAX_GARAGES>
|
||||||
;
|
;
|
||||||
|
|
||||||
/* ** Sprunk ** */
|
|
||||||
enum E_VENDING_MACHINE
|
|
||||||
{
|
|
||||||
E_MODEL,
|
|
||||||
E_INTERIOR,
|
|
||||||
Float: E_X,
|
|
||||||
Float: E_Y,
|
|
||||||
Float: E_Z,
|
|
||||||
Float: E_RX,
|
|
||||||
Float: E_RY,
|
|
||||||
Float: E_RZ,
|
|
||||||
Float: E_FX,
|
|
||||||
Float: E_FY
|
|
||||||
};
|
|
||||||
|
|
||||||
stock const
|
|
||||||
g_VendingMachines[ ] [ E_VENDING_MACHINE ] =
|
|
||||||
{
|
|
||||||
{ 955, 0, -862.82, 1536.60, 21.98, 0.00, 0.00, 180.00, -862.84, 1537.60 }, { 1775, 16, -35.72, -140.22, 1003.63, 0.00, 0.00, 180.00, -35.74, -139.22 },
|
|
||||||
{ 956, 0, 2271.72, -76.46, 25.96, 0.00, 0.00, 0.00, 2271.72, -77.46 }, { 955, 0, 1277.83, 372.51, 18.95, 0.00, 0.00, 64.00, 1278.73, 372.07 },
|
|
||||||
{ 956, 0, 662.42, -552.16, 15.71, 0.00, 0.00, 180.00, 662.41, -551.16 }, { 955, 0, 201.01, -107.61, 0.89, 0.00, 0.00, 270.00, 200.01, -107.63 },
|
|
||||||
{ 955, 0, -253.74, 2597.95, 62.24, 0.00, 0.00, 90.00, -252.74, 2597.95 }, { 956, 0, -253.74, 2599.75, 62.24, 0.00, 0.00, 90.00, -252.74, 2599.75 },
|
|
||||||
{ 956, 0, -76.03, 1227.99, 19.12, 0.00, 0.00, 90.00, -75.03, 1227.99 }, { 955, 0, -14.70, 1175.35, 18.95, 0.00, 0.00, 180.00, -14.72, 1176.35 },
|
|
||||||
{ 1977, 7, 316.87, -140.35, 998.58, 0.00, 0.00, 270.00, 315.87, -140.36 }, { 1775, 17, 373.82, -178.14, 1000.73, 0.00, 0.00, 0.00, 373.82, -179.14 },
|
|
||||||
{ 1776, 17, 379.03, -178.88, 1000.73, 0.00, 0.00, 270.00, 378.03, -178.90 }, { 1775, 17, 495.96, -24.32, 1000.73, 0.00, 0.00, 180.00, 495.95, -23.32 },
|
|
||||||
{ 1776, 17, 500.56, -1.36, 1000.73, 0.00, 0.00, 0.00, 500.56, -2.36 }, { 1775, 17, 501.82, -1.42, 1000.73, 0.00, 0.00, 0.00, 501.82, -2.42 },
|
|
||||||
{ 956, 0, -1455.11, 2591.66, 55.23, 0.00, 0.00, 180.00, -1455.13, 2592.66 }, { 955, 0, 2352.17, -1357.15, 23.77, 0.00, 0.00, 90.00, 2353.17, -1357.15 },
|
|
||||||
{ 955, 0, 2325.97, -1645.13, 14.21, 0.00, 0.00, 0.00, 2325.97, -1646.13 }, { 956, 0, 2139.51, -1161.48, 23.35, 0.00, 0.00, 87.00, 2140.51, -1161.53 },
|
|
||||||
{ 956, 0, 2153.23, -1016.14, 62.23, 0.00, 0.00, 127.00, 2154.03, -1015.54 }, { 955, 0, 1928.73, -1772.44, 12.94, 0.00, 0.00, 90.00, 1929.73, -1772.44 },
|
|
||||||
{ 1776, 1, 2222.36, 1602.64, 1000.06, 0.00, 0.00, 90.00, 2223.36, 1602.64 }, { 1775, 1, 2222.20, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2223.20, 1606.77 },
|
|
||||||
{ 1775, 1, 2155.90, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2156.90, 1606.77 }, { 1775, 1, 2209.90, 1607.19, 1000.05, 0.00, 0.00, 270.00, 2208.90, 1607.17 },
|
|
||||||
{ 1776, 1, 2155.84, 1607.87, 1000.06, 0.00, 0.00, 90.00, 2156.84, 1607.87 }, { 1776, 1, 2202.45, 1617.00, 1000.06, 0.00, 0.00, 180.00, 2202.43, 1618.00 },
|
|
||||||
{ 1776, 1, 2209.24, 1621.21, 1000.06, 0.00, 0.00, 0.00, 2209.24, 1620.21 }, { 1776, 3, 330.67, 178.50, 1020.07, 0.00, 0.00, 0.00, 330.67, 177.50 },
|
|
||||||
{ 1776, 3, 331.92, 178.50, 1020.07, 0.00, 0.00, 0.00, 331.92, 177.50 }, { 1776, 3, 350.90, 206.08, 1008.47, 0.00, 0.00, 90.00, 351.90, 206.08 },
|
|
||||||
{ 1776, 3, 361.56, 158.61, 1008.47, 0.00, 0.00, 180.00, 361.54, 159.61 }, { 1776, 3, 371.59, 178.45, 1020.07, 0.00, 0.00, 0.00, 371.59, 177.45 },
|
|
||||||
{ 1776, 3, 374.89, 188.97, 1008.47, 0.00, 0.00, 0.00, 374.89, 187.97 }, { 1775, 2, 2576.70, -1284.43, 1061.09, 0.00, 0.00, 270.00, 2575.70, -1284.44 },
|
|
||||||
{ 1775, 15, 2225.20, -1153.42, 1025.90, 0.00, 0.00, 270.00, 2224.20, -1153.43 }, { 955, 0, 1154.72, -1460.89, 15.15, 0.00, 0.00, 270.00, 1153.72, -1460.90 },
|
|
||||||
{ 956, 0, 2480.85, -1959.27, 12.96, 0.00, 0.00, 180.00, 2480.84, -1958.27 }, { 955, 0, 2060.11, -1897.64, 12.92, 0.00, 0.00, 0.00, 2060.11, -1898.64 },
|
|
||||||
{ 955, 0, 1729.78, -1943.04, 12.94, 0.00, 0.00, 0.00, 1729.78, -1944.04 }, { 956, 0, 1634.10, -2237.53, 12.89, 0.00, 0.00, 0.00, 1634.10, -2238.53 },
|
|
||||||
{ 955, 0, 1789.21, -1369.26, 15.16, 0.00, 0.00, 270.00, 1788.21, -1369.28 }, { 956, 0, -2229.18, 286.41, 34.70, 0.00, 0.00, 180.00, -2229.20, 287.41 },
|
|
||||||
{ 955, 256, -1980.78, 142.66, 27.07, 0.00, 0.00, 270.00, -1981.78, 142.64 }, { 955, 256, -2118.96, -423.64, 34.72, 0.00, 0.00, 255.00, -2119.93, -423.40 },
|
|
||||||
{ 955, 256, -2118.61, -422.41, 34.72, 0.00, 0.00, 255.00, -2119.58, -422.17 }, { 955, 256, -2097.27, -398.33, 34.72, 0.00, 0.00, 180.00, -2097.29, -397.33 },
|
|
||||||
{ 955, 256, -2092.08, -490.05, 34.72, 0.00, 0.00, 0.00, -2092.08, -491.05 }, { 955, 256, -2063.27, -490.05, 34.72, 0.00, 0.00, 0.00, -2063.27, -491.05 },
|
|
||||||
{ 955, 256, -2005.64, -490.05, 34.72, 0.00, 0.00, 0.00, -2005.64, -491.05 }, { 955, 256, -2034.46, -490.05, 34.72, 0.00, 0.00, 0.00, -2034.46, -491.05 },
|
|
||||||
{ 955, 256, -2068.56, -398.33, 34.72, 0.00, 0.00, 180.00, -2068.58, -397.33 }, { 955, 256, -2039.85, -398.33, 34.72, 0.00, 0.00, 180.00, -2039.86, -397.33 },
|
|
||||||
{ 955, 256, -2011.14, -398.33, 34.72, 0.00, 0.00, 180.00, -2011.15, -397.33 }, { 955, 2048, -1350.11, 492.28, 10.58, 0.00, 0.00, 90.00, -1349.11, 492.28 },
|
|
||||||
{ 956, 2048, -1350.11, 493.85, 10.58, 0.00, 0.00, 90.00, -1349.11, 493.85 }, { 955, 0, 2319.99, 2532.85, 10.21, 0.00, 0.00, 0.00, 2319.99, 2531.85 },
|
|
||||||
{ 956, 0, 2845.72, 1295.04, 10.78, 0.00, 0.00, 0.00, 2845.72, 1294.04 }, { 955, 0, 2503.14, 1243.69, 10.21, 0.00, 0.00, 180.00, 2503.12, 1244.69 },
|
|
||||||
{ 956, 0, 2647.69, 1129.66, 10.21, 0.00, 0.00, 0.00, 2647.69, 1128.66 }, { 1209, 0, -2420.21, 984.57, 44.29, 0.00, 0.00, 90.00, -2419.21, 984.57 },
|
|
||||||
{ 1302, 0, -2420.17, 985.94, 44.29, 0.00, 0.00, 90.00, -2419.17, 985.94 }, { 955, 0, 2085.77, 2071.35, 10.45, 0.00, 0.00, 90.00, 2086.77, 2071.35 },
|
|
||||||
{ 956, 0, 1398.84, 2222.60, 10.42, 0.00, 0.00, 180.00, 1398.82, 2223.60 }, { 956, 0, 1659.46, 1722.85, 10.21, 0.00, 0.00, 0.00, 1659.46, 1721.85 },
|
|
||||||
{ 955, 0, 1520.14, 1055.26, 10.00, 0.00, 0.00, 270.00, 1519.14, 1055.24 }, { 1775, 6, -19.03, -57.83, 1003.63, 0.00, 0.00, 180.00, -19.05, -56.83 },
|
|
||||||
{ 1775, 18, -16.11, -91.64, 1003.63, 0.00, 0.00, 180.00, -16.13, -90.64 }, { 1775, 16, -15.10, -140.22, 1003.63, 0.00, 0.00, 180.00, -15.11, -139.22 },
|
|
||||||
{ 1775, 17, -32.44, -186.69, 1003.63, 0.00, 0.00, 180.00, -32.46, -185.69 }, { 1775, 16, -35.72, -140.22, 1003.63, 0.00, 0.00, 180.00, -35.74, -139.22 },
|
|
||||||
{ 1776, 6, -36.14, -57.87, 1003.63, 0.00, 0.00, 180.00, -36.16, -56.87 }, { 1776, 18, -17.54, -91.71, 1003.63, 0.00, 0.00, 180.00, -17.56, -90.71 },
|
|
||||||
{ 1776, 16, -16.53, -140.29, 1003.63, 0.00, 0.00, 180.00, -16.54, -139.29 }, { 1776, 17, -33.87, -186.76, 1003.63, 0.00, 0.00, 180.00, -33.89, -185.76 },
|
|
||||||
{ 1775, 6, -19.03, -57.83, 1003.63, 0.00, 0.00, 180.00, -19.05, -56.83 }, { 1776, 6, -36.14, -57.87, 1003.63, 0.00, 0.00, 180.00, -36.16, -56.87 },
|
|
||||||
{ 1775, 18, -16.11, -91.64, 1003.63, 0.00, 0.00, 180.00, -16.13, -90.64 }, { 1776, 18, -17.54, -91.71, 1003.63, 0.00, 0.00, 180.00, -17.56, -90.71 },
|
|
||||||
{ 1776, 16, -16.53, -140.29, 1003.63, 0.00, 0.00, 180.00, -16.54, -139.29 }, { 1775, 16, -15.10, -140.22, 1003.63, 0.00, 0.00, 180.00, -15.11, -139.22 },
|
|
||||||
{ 1776, 17, -33.87, -186.76, 1003.63, 0.00, 0.00, 180.00, -33.89, -185.76 }, { 1775, 17, -32.44, -186.69, 1003.63, 0.00, 0.00, 180.00, -32.46, -185.69 }
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
new
|
|
||||||
g_VendingMachineObject [ sizeof( g_VendingMachines ) ] = { -1, ... },
|
|
||||||
p_VendingUseTimer [ MAX_PLAYERS ] = { -1, ... }
|
|
||||||
;
|
|
||||||
|
|
||||||
/* ** Rank System ** */
|
/* ** Rank System ** */
|
||||||
enum E_RANK_DATA
|
enum E_RANK_DATA
|
||||||
{
|
{
|
||||||
@ -2166,7 +2098,6 @@ public OnProgressCompleted( playerid, progressid, params );
|
|||||||
public OnPlayerUnjailed( playerid, reasonid );
|
public OnPlayerUnjailed( playerid, reasonid );
|
||||||
public onSafeBust( playerid, robberyid, type, index );
|
public onSafeBust( playerid, robberyid, type, index );
|
||||||
public OnMethamphetamineCooking( playerid, vehicleid, last_chemical );
|
public OnMethamphetamineCooking( playerid, vehicleid, last_chemical );
|
||||||
public VendingMachineUsed( playerid, Float: fHealthGiven );
|
|
||||||
public OnPlayerHoldupStore( playerid, clerkid, step );
|
public OnPlayerHoldupStore( playerid, clerkid, step );
|
||||||
public OnPlayerAccessEntrance( playerid, entranceid );
|
public OnPlayerAccessEntrance( playerid, entranceid );
|
||||||
|
|
||||||
@ -2215,7 +2146,6 @@ public OnGameModeInit()
|
|||||||
initializeCheckpoints( );
|
initializeCheckpoints( );
|
||||||
initializeServerObjects( );
|
initializeServerObjects( );
|
||||||
initializeObjects( );
|
initializeObjects( );
|
||||||
initializeVendingMachines( );
|
|
||||||
initializeActors( );
|
initializeActors( );
|
||||||
|
|
||||||
/* ** Loading default string values - Makes it efficient. ** */
|
/* ** Loading default string values - Makes it efficient. ** */
|
||||||
@ -5191,7 +5121,6 @@ public OnPlayerDisconnect( playerid, reason )
|
|||||||
p_DamageSpamCount{ playerid } = 0;
|
p_DamageSpamCount{ playerid } = 0;
|
||||||
p_AntiTextSpamCount{ playerid } = 0;
|
p_AntiTextSpamCount{ playerid } = 0;
|
||||||
p_treeExportLocation[ playerid ] = 0xFF;
|
p_treeExportLocation[ playerid ] = 0xFF;
|
||||||
ResetPlayerVendingMachineData( playerid );
|
|
||||||
Delete3DTextLabel( p_SpawnKillLabel[ playerid ] );
|
Delete3DTextLabel( p_SpawnKillLabel[ playerid ] );
|
||||||
p_SpawnKillLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID;
|
p_SpawnKillLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID;
|
||||||
Delete3DTextLabel( p_AdminLabel[ playerid ] );
|
Delete3DTextLabel( p_AdminLabel[ playerid ] );
|
||||||
@ -5556,8 +5485,6 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:f
|
|||||||
;
|
;
|
||||||
GetPlayerKeys( playerid, keys, ud, lr );
|
GetPlayerKeys( playerid, keys, ud, lr );
|
||||||
|
|
||||||
ResetPlayerVendingMachineData( playerid );
|
|
||||||
|
|
||||||
// Simple. But effective. Anti-Shooting Hacks.
|
// Simple. But effective. Anti-Shooting Hacks.
|
||||||
if ( !( keys & KEY_FIRE ) ) {
|
if ( !( keys & KEY_FIRE ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -13551,7 +13478,6 @@ public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
|
|||||||
driverid = GetVehicleDriver( vehicleid )
|
driverid = GetVehicleDriver( vehicleid )
|
||||||
;
|
;
|
||||||
|
|
||||||
ResetPlayerVendingMachineData( playerid );
|
|
||||||
|
|
||||||
if ( !ispassenger )
|
if ( !ispassenger )
|
||||||
{
|
{
|
||||||
@ -13914,8 +13840,6 @@ public OnPlayerStateChange(playerid, newstate, oldstate)
|
|||||||
|
|
||||||
p_LastPlayerState{ playerid } = oldstate;
|
p_LastPlayerState{ playerid } = oldstate;
|
||||||
|
|
||||||
ResetPlayerVendingMachineData( playerid );
|
|
||||||
|
|
||||||
if ( newstate == PLAYER_STATE_DRIVER && p_AdminLevel[ playerid ] <= 0 )
|
if ( newstate == PLAYER_STATE_DRIVER && p_AdminLevel[ playerid ] <= 0 )
|
||||||
{
|
{
|
||||||
if ( GetPlayerVehicleID( playerid ) != p_CarWarpVehicleID[ playerid ] )
|
if ( GetPlayerVehicleID( playerid ) != p_CarWarpVehicleID[ playerid ] )
|
||||||
@ -15325,25 +15249,6 @@ public OnPlayerArrested( playerid, victimid, totalarrests, totalpeople )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VendingMachineUsed( playerid, Float: fHealthGiven )
|
|
||||||
{
|
|
||||||
p_VendingUseTimer[ playerid ] = -1;
|
|
||||||
|
|
||||||
if ( GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
Float: fHealth;
|
|
||||||
|
|
||||||
GetPlayerHealth( playerid, fHealth );
|
|
||||||
|
|
||||||
fHealth += fHealthGiven;
|
|
||||||
|
|
||||||
if ( fHealth > 100.0 )
|
|
||||||
fHealth = 100.0;
|
|
||||||
|
|
||||||
SetPlayerHealth( playerid, fHealth );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
||||||
{
|
{
|
||||||
@ -15673,52 +15578,6 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
|||||||
|
|
||||||
else if ( PRESSED( KEY_SECONDARY_ATTACK ) )
|
else if ( PRESSED( KEY_SECONDARY_ATTACK ) )
|
||||||
{
|
{
|
||||||
if ( GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT && p_VendingUseTimer[ playerid ] == -1 && GetPlayerAnimationIndex( playerid ) != 1660 )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
bool: bFailed,
|
|
||||||
Float: fHealth
|
|
||||||
;
|
|
||||||
|
|
||||||
GetPlayerHealth( playerid, fHealth );
|
|
||||||
|
|
||||||
if ( GetPlayerCash( playerid ) <= 0 || fHealth >= 100.0 )
|
|
||||||
bFailed = true;
|
|
||||||
|
|
||||||
for ( new i = 0; i < sizeof( g_VendingMachines ); i++ )
|
|
||||||
{
|
|
||||||
if ( IsPlayerInRangeOfPoint( playerid, 1.0, g_VendingMachines[ i ] [ E_FX ], g_VendingMachines[ i ] [ E_FY ], g_VendingMachines[ i ] [ E_Z ] ) )
|
|
||||||
{
|
|
||||||
if ( bFailed )
|
|
||||||
{
|
|
||||||
PlayerPlaySound( playerid, 1055, 0.0, 0.0, 0.0 );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
new
|
|
||||||
Float: health_given = 35.0;
|
|
||||||
|
|
||||||
if ( GetPlayerPos( playerid, Z, Z, Z ) )
|
|
||||||
{
|
|
||||||
GivePlayerCash( playerid, -500 );
|
|
||||||
|
|
||||||
p_VendingUseTimer[ playerid ] = SetTimerEx( "VendingMachineUsed", 2500, false, "if", playerid, health_given );
|
|
||||||
|
|
||||||
SetPlayerFacingAngle( playerid, g_VendingMachines[ i ] [ E_RZ ] );
|
|
||||||
SetPlayerPos( playerid, g_VendingMachines[ i ] [ E_FX ], g_VendingMachines[ i ] [ E_FY ], Z );
|
|
||||||
|
|
||||||
ApplyAnimation( playerid, "VENDING", "VEND_USE", 4.1, 0, 0, 1, 0, 0, 1 );
|
|
||||||
PlayerPlaySound( playerid, 42600, 0.0, 0.0, 0.0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlayerPlaySound( playerid, 1055, 0.0, 0.0, 0.0 );
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetPVarInt( playerid, "viewing_houseints" ) == 1 )
|
if ( GetPVarInt( playerid, "viewing_houseints" ) == 1 )
|
||||||
{
|
{
|
||||||
new id = p_InHouse[ playerid ];
|
new id = p_InHouse[ playerid ];
|
||||||
@ -26875,24 +26734,6 @@ stock GetOnlineGangMembers( gangid, &afk_members = 0 )
|
|||||||
return iPlayers;
|
return iPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock initializeVendingMachines( )
|
|
||||||
{
|
|
||||||
for( new i = 0; i < sizeof( g_VendingMachineObject ); i++ )
|
|
||||||
{
|
|
||||||
g_VendingMachineObject[ i ] = CreateDynamicObject(
|
|
||||||
g_VendingMachines[ i ] [ E_MODEL ],
|
|
||||||
g_VendingMachines[ i ] [ E_X ],
|
|
||||||
g_VendingMachines[ i ] [ E_Y ],
|
|
||||||
g_VendingMachines[ i ] [ E_Z ],
|
|
||||||
g_VendingMachines[ i ] [ E_RX ],
|
|
||||||
g_VendingMachines[ i ] [ E_RY ],
|
|
||||||
g_VendingMachines[ i ] [ E_RZ ],
|
|
||||||
-1, -1
|
|
||||||
//-1, g_VendingMachines[ i ] [ E_INTERIOR ]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stock SplitPlayerCashForGang( playerid, Float: cashRobbed )
|
stock SplitPlayerCashForGang( playerid, Float: cashRobbed )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
@ -26936,15 +26777,6 @@ stock SplitPlayerCashForGang( playerid, Float: cashRobbed )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock ResetPlayerVendingMachineData( playerid )
|
|
||||||
{
|
|
||||||
if ( p_VendingUseTimer[ playerid ] != -1 )
|
|
||||||
{
|
|
||||||
KillTimer( p_VendingUseTimer[ playerid ] );
|
|
||||||
p_VendingUseTimer[ playerid ] = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stock GetPlayerRank( playerid )
|
stock GetPlayerRank( playerid )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
|
Loading…
Reference in New Issue
Block a user