adds stealth mode (hides player from radar)

once player is shot he shows for a short period (like CIA)
This commit is contained in:
Steven Howard 2018-10-09 14:15:35 +01:00
parent 133a5a6079
commit 07b2d25182
3 changed files with 42 additions and 2 deletions

View File

@ -15,7 +15,7 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
switch( listitem )
{
case 0: ShowPlayerDialog( playerid, DIALOG_PERKS_P, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Game Perks", ""COL_WHITE"Item Name\t"COL_WHITE"Total Level Req.\t"COL_WHITE"Cost ($)\nUnlimited Ammunition\t"COL_GOLD"50\t"COL_GREEN"$9,900", "Select", "Back" );
case 0: ShowPlayerDialog( playerid, DIALOG_PERKS_P, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Game Perks", ""COL_WHITE"Item Name\t"COL_WHITE"Total Level Req.\t"COL_WHITE"Cost ($)\nUnlimited Ammunition\t"COL_GOLD"50\t"COL_GREEN"$9,900\nStealth Mode\t"COL_GOLD"100\t"COL_GREEN"$15,000", "Select", "Back" );
case 1: ShowPlayerDialog( playerid, DIALOG_PERKS_V, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Game Perks", ""COL_WHITE"Item Name\t"COL_WHITE"Total Level Req.\t"COL_WHITE"Cost ($)\nFix & Flip vehicle\t"COL_GOLD"75\t"COL_GREEN"$9,900\nRepair Vehicle\t"COL_GOLD"75\t"COL_GREEN"$7,500\nAdd NOS\t"COL_GOLD"50\t"COL_GREEN"$3,000\nFlip vehicle\t"COL_GOLD"40\t"COL_GREEN"$2,500", "Select", "Back" );
}
}
@ -52,6 +52,31 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
SetPlayerArmedWeapon( playerid, 0 );
Beep( playerid );
}
case 1:
{
if ( total_level < 10 ) {
return SendError( playerid, "Your total level must be at least 75 to use this (/level)." );
}
if ( GetPlayerCash( playerid ) < 11500 ) {
return SendError( playerid, "You do not have enough money for this item ($11,500)." );
}
if ( p_OffRadar{ playerid } ) {
return SendError( playerid, "You have already purchased this item." );
}
p_OffRadar{ playerid } = true;
GivePlayerCash( playerid, -11500 );
SendServerMessage( playerid, "You have brought stealth mode for $15,000." );
ShowPlayerHelpDialog( playerid, 3000, "~g~~h~Stealth mode ~w~will be deactivate once you respawn." );
SetPlayerColor( playerid, setAlpha( GetPlayerColor( playerid ), 0x00 ) );
Beep( playerid );
}
}
}
else if ( dialogid == DIALOG_PERKS_V )

View File

@ -205,6 +205,7 @@ new
p_LastPlayerState [ MAX_PLAYERS char ],
p_RespondDelay [ MAX_PLAYERS ],
p_VisibleOnRadar [ MAX_PLAYERS ],
p_OffRadarVisible [ MAX_PLAYERS ],
p_InGarage [ MAX_PLAYERS ] = { -1, ... },
p_WorkCooldown [ MAX_PLAYERS ],
p_AntiSpammyTS [ MAX_PLAYERS ],
@ -239,7 +240,8 @@ new
p_AimedAtPolice [ MAX_PLAYERS ],
bool: p_PassiveModeDisabled [ MAX_PLAYERS char ],
p_PassiveModeExpireTimer [ MAX_PLAYERS ] = { -1, ... },
Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID }
Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID },
bool: p_OffRadar [ MAX_PLAYERS char]
;
/* ** Getters And Setters** */

View File

@ -2131,6 +2131,11 @@ public ZoneTimer( )
// CIA Visible On Radar after firing a shot
if ( p_VisibleOnRadar[ playerid ] != 0 && p_VisibleOnRadar[ playerid ] < g_iTime )
SetPlayerColorToTeam( playerid ), p_VisibleOnRadar[ playerid ] = 0;
// Stealth mode after getting shot
if ( p_OffRadarVisible[ playerid ] != 0 && p_OffRadarVisible[ playerid ] < g_iTime )
SetPlayerColor( playerid, setAlpha( GetPlayerColor( playerid ), 0x00 ) ), p_OffRadarVisible[ playerid ] = 0;
}
return 1;
}
@ -2847,6 +2852,8 @@ public OnPlayerSpawn( playerid )
StopSound( playerid );
CancelEdit( playerid );
p_OffRadar{ playerid } = false;
// Approved spawn?
if ( !approveClassSpawned( playerid ) ) {
SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL SPAWN]"COL_GREY" %s(%d) - %d skin - %d ping - %s IP", ReturnPlayerName( playerid ), playerid, GetPlayerSkin( playerid ), GetPlayerPing( playerid ), ReturnPlayerIP( playerid ) );
@ -3082,6 +3089,10 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:f
if ( p_Class[ playerid ] == CLASS_POLICE && p_Class[ hitid ] != CLASS_POLICE && !p_WantedLevel[ hitid ] && GetPlayerState( hitid ) != PLAYER_STATE_WASTED && ! IsPlayerInEvent( playerid ) )
return ShowPlayerHelpDialog( playerid, 2000, "You cannot hurt innocent civilians, you're a ~b~cop~w~~h~!" ), 0;
// Exposing stealth mode player
if ( p_OffRadar{ playerid } )
SetPlayerColor( playerid, setAlpha( GetPlayerColor( playerid ), 0xFF ) ), p_OffRadarVisible[ playerid ] = g_iTime + 2;
// CIA Exposure when weapon is shot
if ( p_Class[ playerid ] == CLASS_POLICE && p_inFBI{ playerid } && p_inCIA{ playerid } && !p_inArmy{ playerid } )
SetPlayerColor( playerid, setAlpha( COLOR_CIA, 0xFF ) ), p_VisibleOnRadar[ playerid ] = g_iTime + 2;
@ -15208,6 +15219,8 @@ stock GivePlayerWantedLevel( playerid, wantedlevel, bool:loadingstats = false )
if ( p_WantedLevel[ playerid ] > 90 ) printf( "[wanted_level] %s - %d", ReturnPlayerName( playerid ), p_WantedLevel[ playerid ] );
if ( IsPlayerAdminOnDuty( playerid ) ) SetPlayerColor( playerid, COLOR_PINK );
if ( p_OffRadar{ playerid } ) SetPlayerColor( playerid, setAlpha( GetPlayerColor( playerid ), 0x00 ) );
/*if ( p_WantedLevel[ playerid ] > 2000 ) // 8hska7082bmahu
{
p_WantedLevel[ playerid ] = 2000;