From bd8b584cb3253d987056ac3de1e34a488f3069df Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 16 Sep 2018 16:06:12 +1000 Subject: [PATCH] bug fixes --- gamemodes/irresistible/cnr/features/pilot.pwn | 213 ------------------ gamemodes/irresistible/cnr/features/pool.pwn | 3 + gamemodes/sf-cnr.pwn | 19 +- scriptfiles/updates.txt | 5 +- 4 files changed, 10 insertions(+), 230 deletions(-) delete mode 100644 gamemodes/irresistible/cnr/features/pilot.pwn diff --git a/gamemodes/irresistible/cnr/features/pilot.pwn b/gamemodes/irresistible/cnr/features/pilot.pwn deleted file mode 100644 index 86ab39b..0000000 --- a/gamemodes/irresistible/cnr/features/pilot.pwn +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Irresistible Gaming (c) 2018 - * Developed by Stev - * Module: pilot.pwn - * Purpose: Pilot mini-job -*/ - -#include - -// ** ENUMS - -enum taskEnum -{ - taskName[64], - Float:taskStart[3], - Float:taskFinish[3], - taskReward[2], -}; - -// ** VARIABLES - -new bool:playerWorking[MAX_PLAYERS char] = false; -new playerTaskCheckpoint[MAX_PLAYERS]; -new playerTaskMapIcon[MAX_PLAYERS]; -new playerTaskProgress[MAX_PLAYERS]; -new playerTask[MAX_PLAYERS]; -new playerTaskDistance[MAX_PLAYERS char]; - -new playerPilotTasks[MAX_PLAYERS char]; // DATABASE FOR HIGHEST SCORE - -new taskInfo[][taskEnum] = -{ - {"Weapons", {324.0082, 2501.9749, 17.2114}, {1773.6418, -2492.8054, 14.2744}, {2250, 6000}}, - {"Weapons", {324.0082, 2501.9749, 17.2114}, {-1452.0604, 40.2788, 14.8709}, {2000, 6000}}, - {"Passengers", {324.0082, 2501.9749, 17.2114}, {1478.1902, 1653.5984, 11.5396}, {2000, 6000}}, - {"Drugs", {1478.1902, 1653.5984, 11.5396}, {-1452.0604, 40.2788, 14.8709}, {2000, 6000}}, - {"Weapons", {1478.1902, 1653.5984, 11.5396}, {1773.6418, -2492.8054, 14.2744}, {2250, 6000}}, - {"Drinks", {1478.1902, 1653.5984, 11.5396}, {324.0082, 2501.9749, 17.2114}, {1500, 6000}}, - {"Passengers", {-1452.0604, 40.2788, 14.8709}, {1773.6418, -2492.8054, 14.2744}, {1500, 6000}}, - {"Passengers", {-1452.0604, 40.2788, 14.8709}, {324.0082, 2501.9749, 17.2114}, {2000, 6000}}, - {"Passengers", {-1452.0604, 40.2788, 14.8709}, {1478.1902, 1653.5984, 11.5396}, {2250, 6000}}, - {"Drugs", {1773.6418, -2492.8054, 14.2744}, {324.0082, 2501.9749, 17.2114}, {2000, 6000}}, - {"Ammo", {1773.6418, -2492.8054, 14.2744}, {-1452.0604, 40.2788, 14.8709}, {2000, 6000}}, - {"Food", {1773.6418, -2492.8054, 14.2744}, {1478.1902, 1653.5984, 11.5396}, {2250, 6000}} -}; - -// ** HOOKS - -hook OnPlayerStateChange(playerid, newstate, oldstate) -{ - if (newstate == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(playerid)) - { - new vehicleid = GetPlayerVehicleID(playerid); - if (GetVehicleModel(vehicleid) == 519 && !playerWorking{playerid}) - { - ShowPlayerHelpDialog(playerid, 3000, "You can begin a pilot job by typing ~g~/work"); - } - } -} - -hook OnPlayerExitVehicle(playerid, vehicleid) -{ - if (playerWorking{playerid} && playerTask[playerid] > 0) - { - SendServerMessage(playerid, "Your pilot mission has been stopped."); - - playerTask[playerid] = -1; - playerTaskProgress[playerid] = 0; - pTaskDistance{playerid} = 0; - playerWorking{playerid} = false; - - DestroyDynamicRaceCP(playerTaskCheckpoint[playerid]); - DestroyDynamicMapIcon(playerTaskMapIcon[playerid]); - } -} - -hook OnPlayerUpdate(playerid) -{ - UpdatePilotTask(playerid); -} - -hook OnPlayerEnterDynamicRaceCP(playerid, checkpointid) -{ - if (playerWorking{playerid} && playerTask[playerid] > 0) - { - new index = playerTask[playerid]; - switch (playerTaskProgress[playerid]) - { - case 0: - { - if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) - return SendError(playerid, "You must be the driver of the vehicle to continue this mission."); - - playerTaskProgress[playerid] ++; - - DestroyDynamicRaceCP(playerTaskCheckpoint[playerid]); - DestroyDynamicMapIcon(playerTaskMapIcon[playerid]); - - playerTaskCheckpoint[playerid] = CreateDynamicRaceCP(1, taskInfo[index][taskFinish][0], taskInfo[index][taskFinish][2], taskInfo[index][taskFinish][2], 0.0, 0.0, 0.0, 5.0, 0, 0, playerid); - playerTaskMapIcon[playerid] = CreateDynamicMapIcon(taskInfo[index][taskFinish][0], taskInfo[index][taskFinish][1], taskInfo[index][taskFinish][2], 5, -1, 0, 0, playerid); - } - case 1: - { - if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) - return SendError(playerid, "You must be the driver of the vehicle to complete this mission."); - - new reward = RandomEx(taskInfo[index][taskReward][0], taskInfo[index][taskReward][1]); - - ShowPlayerHelpDialog(playerid, 5000, "You have earned ~y~$%s ~w~for transporting %s!", taskInfo[index][taskName], number_format(reward)); - - GivePlayerMoney(playerid, reward); - // GIVE THE XP - // GIVE THE SCORE ASWELL (IF YOU WANT) - - playerTask[playerid] = -1; - playerTaskProgress[playerid] = 0; - pTaskDistance{playerid} = 0; - playerWorking{playerid} = false; - - DestroyDynamicRaceCP(playerTaskCheckpoint[playerid]); - DestroyDynamicMapIcon(playerTaskMapIcon[playerid]); - - playerPilotTasks{playerid} ++; - } - } - } -} - -// ** COMMANDS - -CMD:work(playerid, params[]) -{ - if (playerWorking{playerid}) - return SendError(playerid, "You are already doing a task."); - - if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) - return SendError(playerid, "You must be the driver of the vehicle to start a task."); - - if (GetVehicleModel(GetPlayerVehicleID(playerid)) != 519) - return SendError(playerid, "There are currently no jobs for this particular vehicle."); - - new index = RandomEx(0, sizeof(taskInfo)); - - playerTaskProgress[playerid] = 0; - pTaskDistance{playerid} = 0; - playerTask[playerid] = index; - playerWorking{playerid} = true; - - ShowPlayerHelpDialog(playerid, 5000, "A ~g~air blip~w~ has been shown on your radar. Go to where the air blip is pick up the %s.", taskInfo[index][taskName]); - - playerTaskCheckpoint[playerid] = CreateDynamicRaceCP(1, taskInfo[index][taskStart][0], taskInfo[index][taskStart][1], taskInfo[index][taskStart][2], taskInfo[index][taskFinish][0], taskInfo[index][taskFinish][1], taskInfo[index][taskFinish][2], 5.0, 0, 0, playerid, 100.0); - playerTaskMapIcon[playerid] = CreateDynamicMapIcon(taskInfo[index][taskStart][0], taskInfo[index][taskStart][1], taskInfo[index][taskStart][2], 5, -1, 0, 0, playerid); - return 1; -} - -// ** FUNCTIONS - -ShowAirportLocation(Float:fX, Float:fY, Float:fZ) -{ - enum e_ZoneData - { - e_ZoneName[32 char], - Float:e_ZoneArea[6] - }; - new const g_arrZoneData[][e_ZoneData] = - { - {!"SF Airport", {-1499.80, -50.00, -0.00, -1242.90, 249.90, 200.00}}, - {!"SF Airport", {-1794.90, -730.10, -3.00, -1213.90, -50.00, 200.00}}, - {!"SF Airport", {-1213.90, -730.10, 0.00, -1132.80, -50.00, 200.00}}, - {!"SF Airport", {-1242.90, -50.00, 0.00, -1213.90, 578.30, 200.00}}, - {!"SF Airport", {-1213.90, -50.00, -4.50, -947.90, 578.30, 200.00}}, - {!"SF Airport", {-1315.40, -405.30, 15.40, -1264.40, -209.50, 25.40}}, - {!"SF Airport", {-1354.30, -287.30, 15.40, -1315.40, -209.50, 25.40}}, - {!"SF Airport", {-1490.30, -209.50, 15.40, -1264.40, -148.30, 25.40}}, - {!"LV Airport", {1236.60, 1203.20, -89.00, 1457.30, 1883.10, 110.90}}, - {!"LV Airport", {1457.30, 1203.20, -89.00, 1777.30, 1883.10, 110.90}}, - {!"LV Airport", {1457.30, 1143.20, -89.00, 1777.40, 1203.20, 110.90}}, - {!"LV Airport", {1515.80, 1586.40, -12.50, 1729.90, 1714.50, 87.50}}, - {!"LS Airport", {1249.60, -2394.30, -89.00, 1852.00, -2179.20, 110.90}}, - {!"LS Airport", {1852.00, -2394.30, -89.00, 2089.00, -2179.20, 110.90}}, - {!"LS Airport", {1382.70, -2730.80, -89.00, 2201.80, -2394.30, 110.90}}, - {!"LS Airport", {1974.60, -2394.30, -39.00, 2089.00, -2256.50, 60.90}}, - {!"LS Airport", {1400.90, -2669.20, -39.00, 2189.80, -2597.20, 60.90}}, - {!"LS Airport", {2051.60, -2597.20, -39.00, 2152.40, -2394.30, 60.90}}, - {!"Verdant Meadows", {37.00, 2337.10, -3.00, 435.90, 2677.90, 200.00}} - }; - new - szName[32] = "No-where"; - - for (new i = 0; i != sizeof(g_arrZoneData); i ++) if ((fX >= g_arrZoneData[i][e_ZoneArea][0] && fX <= g_arrZoneData[i][e_ZoneArea][3]) && (fY >= g_arrZoneData[i][e_ZoneArea][1] && fY <= g_arrZoneData[i][e_ZoneArea][4]) && (fZ >= g_arrZoneData[i][e_ZoneArea][2] && fZ <= g_arrZoneData[i][e_ZoneArea][5])) { - strunpack(szName, g_arrZoneData[i][e_ZoneName]); - - break; - } - - return szName; -} - -UpdatePilotTask(playerid) -{ - new index = playerTask[playerid]; - - switch (playerTaskProgress[playerid]) - { - case 0: pTaskDistance{playerid} = floatround(GetPlayerDistanceFromPoint(playerid, taskInfo[index][taskStart][0], taskInfo[index][taskStart][1], taskInfo[index][taskStart][2])); - case 1: pTaskDistance{playerid} = floatround(GetPlayerDistanceFromPoint(playerid, taskInfo[index][taskFinish][0], taskInfo[index][taskFinish][1], taskInfo[index][taskFinish][2])); - } - - format(szNormalString, sizeof(szNormalString), "~b~Location:~w~ %s~n~~b~Distance:~w~ %dm", (playerTaskProgress[playerid] == 1 ? (ShowAirportLocation(taskInfo[index][taskFinish][0], taskInfo[index][taskFinish][1], taskInfo[index][taskFinish][2])) : (ShowAirportLocation(taskInfo[index][taskStart][0], taskInfo[index][taskStart][1], taskInfo[index][taskStart][2]))), pTaskDistance{playerid}); - TextDrawSetString(p_TruckingTD[playerid], szNormalString); - - return 1; -} diff --git a/gamemodes/irresistible/cnr/features/pool.pwn b/gamemodes/irresistible/cnr/features/pool.pwn index a5e66c2..62a7412 100644 --- a/gamemodes/irresistible/cnr/features/pool.pwn +++ b/gamemodes/irresistible/cnr/features/pool.pwn @@ -358,6 +358,9 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) SetCameraBehindPlayer( playerid ); ApplyAnimation( playerid, "CARRY", "crry_prtial", 4.0, 0, 1, 1, 0, 0 ); + TextDrawHideForPlayer( playerid, g_PoolTextdraw ); + HidePlayerProgressBar( playerid, g_PoolPowerBar[playerid] ); + g_poolTableData[ poolid ] [ E_AIMER ] = -1; DestroyObject( g_poolTableData[ poolid ] [ E_AIMER_OBJECT ] ); g_poolTableData[ poolid ] [ E_AIMER_OBJECT ] = -1; diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 680a191..5fee4e1 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -16,7 +16,7 @@ #pragma option -d3 #pragma dynamic 7200000 -#define DEBUG_MODE +//#define DEBUG_MODE #if defined DEBUG_MODE #pragma option -d3 @@ -5381,7 +5381,7 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:f return 0; // Anti Random Deathmatch - if ( IsRandomDeathmatch( playerid, iDriver ) && ! IsPlayerInPaintBall( playerid ) && ! IsPlayerInEvent( playerid ) && ! IsPlayerInMinigame( playerid ) ) + if ( IsRandomDeathmatch( playerid, iDriver ) && ! IsPlayerInPaintBall( playerid ) && ! IsPlayerInEvent( playerid ) && ! IsPlayerDueling( playerid ) ) return 0; if ( p_WantedLevel[ playerid ] <= 2 && p_Class[ playerid ] != CLASS_POLICE && p_Class[ iDriver ] == CLASS_POLICE && GetPVarInt( playerid, "ShotCopWantedCD" ) < g_iTime ) @@ -5594,7 +5594,7 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b return 0; // Anti RDM and gang member damage - if ( ! IsPlayerInEvent( playerid ) && ! IsPlayerInPaintBall( playerid ) && ! IsPlayerBoxing( playerid ) && ! IsPlayerInMinigame( playerid ) ) + if ( ! IsPlayerInEvent( playerid ) && ! IsPlayerInPaintBall( playerid ) && ! IsPlayerBoxing( playerid ) && ! IsPlayerDueling( playerid ) ) { if ( IsPlayerInPlayerGang( issuerid, playerid ) ) return ShowPlayerHelpDialog( issuerid, 2000, "You cannot damage your homies!" ), 0; @@ -7148,7 +7148,7 @@ CMD:business( playerid, params[ ] ) } return 1; } - return SendUsage( playerid, "/(b)usiness [BUY/SELL/LEAVE]" ); + return SendUsage( playerid, "/(b)usiness [BUY/PRODUCTION/SELL/LEAVE]" ); } CMD:race( playerid, params[ ] ) @@ -9776,17 +9776,6 @@ thread OnPlayerWeeklyTime( playerid, irc, player[ ] ) return 1; } -CMD:pleave( playerid, params[ ] ) -{ - if ( !IsPlayerInPaintBall( playerid ) ) - return SendError( playerid, "You're not inside the paintball." ); - - LeavePlayerPaintball( playerid ); - SetPlayerHealth( playerid, -1 ); - SendServerMessage( playerid, "You have left the paintball arena." ); - return 1; -} - CMD:xpmarket( playerid, params[ ] ) { ShowPlayerDialog(playerid, DIALOG_XPMARKET, DIALOG_STYLE_INPUT, "{FFFFFF}XP Market", ""COL_WHITE"Welcome, enter inside the input box how much XP you're willing\nto trade in for.\n\nExchange Rate: "COL_GOLD"1 XP = $"#EXCHANGE_XPCASH"", "Select", "Cancel"); diff --git a/scriptfiles/updates.txt b/scriptfiles/updates.txt index ec12c87..a8e920f 100644 --- a/scriptfiles/updates.txt +++ b/scriptfiles/updates.txt @@ -1,5 +1,6 @@ (+) Adds pool system minigame, like in singleplayer. -(+) Adds pilot minijob, accessible using pilot in specific plane models. +(+) Adds pilot minijob, accessible using "/pilot" in specific plane models. (+) Adds "/p" to be able to chat inside the paintball lobby (+) Adds "/b production" to see what the status of your business production is. -(+) Adds "/reconnectchuff" for level 5 administrators. \ No newline at end of file +(+) Adds "/reconnectchuff" for level 5 administrators. +(*) Fix textdraw issue within casinos. \ No newline at end of file