Merged master into bug-fixes

This commit is contained in:
Steven Howard 2019-01-23 20:33:50 +00:00
commit a024d7da66
3 changed files with 28 additions and 18 deletions

View File

@ -62,6 +62,7 @@ hook OnServerUpdate( )
hook OnPlayerDisconnect( playerid, reason ) hook OnPlayerDisconnect( playerid, reason )
{ {
Weed_RemovePlayerPlants( playerid ); Weed_RemovePlayerPlants( playerid );
Weed_ResetSellingProperties( playerid );
return 1; return 1;
} }
@ -112,8 +113,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
CMD:weed( playerid, params[ ] ) CMD:weed( playerid, params[ ] )
{ {
new new
Float: X, Float: Y, Float: Z Float: X, Float: Y, Float: Z;
;
if ( p_Class[ playerid ] != CLASS_CIVILIAN ) return SendError( playerid, "You are not a civilian." ); if ( p_Class[ playerid ] != CLASS_CIVILIAN ) return SendError( playerid, "You are not a civilian." );
@ -154,32 +154,29 @@ CMD:weed( playerid, params[ ] )
} }
else if ( !strcmp( params, "sell", false, 4 ) ) else if ( !strcmp( params, "sell", false, 4 ) )
{ {
new pID, iAmount; new pID, iAmount, iCost;
if ( !IsPlayerJob( playerid, JOB_DRUG_DEALER ) ) return SendError( playerid, "You are not a drug dealer." ); if ( !IsPlayerJob( playerid, JOB_DRUG_DEALER ) ) return SendError( playerid, "You are not a drug dealer." );
else if ( p_SellingWeedTick[ playerid ] > g_iTime ) return SendError( playerid, "You must wait a minute before selling weed again." ); else if ( p_SellingWeedTick[ playerid ] > g_iTime ) return SendError( playerid, "You must wait a minute before selling weed again." );
else if ( !p_WeedGrams[ playerid ] ) return SendError( playerid, "You don't have any weed with you." ); else if ( !p_WeedGrams[ playerid ] ) return SendError( playerid, "You don't have any weed with you." );
else if ( sscanf( params[ 5 ], "ud", pID, iAmount ) ) return SendUsage( playerid, "/weed sell [PLAYER_ID] [GRAMS]" ); else if ( sscanf( params[ 5 ], "udd", pID, iAmount, iCost ) ) return SendUsage( playerid, "/weed sell [PLAYER_ID] [GRAMS] [PRICE]" );
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." );
else if ( pID == playerid ) return SendError( playerid, "You cannot sell yourself weed." ); else if ( pID == playerid ) return SendError( playerid, "You cannot sell yourself weed." );
else if ( p_Class[ pID ] != CLASS_CIVILIAN ) return SendError( playerid, "This person is not a civilian." ); else if ( p_Class[ pID ] != CLASS_CIVILIAN ) return SendError( playerid, "This person is not a civilian." );
else if ( iAmount > p_WeedGrams[ playerid ] ) return SendError( playerid, "You only have %d grams of weed on you.", p_WeedGrams[ playerid ] ); else if ( iAmount > p_WeedGrams[ playerid ] ) return SendError( playerid, "You only have %d grams of weed on you.", p_WeedGrams[ playerid ] );
else if ( iAmount < 1 || iAmount > 25 ) return SendError( playerid, "You can only sell between 1 to 25 grams of weed to a player." ); else if ( iAmount < 1 || iAmount > 25 ) return SendError( playerid, "You can only sell between 1 to 25 grams of weed to a player." );
else if ( iCost <= 0 || iCost > 100000 ) return SendError( playerid, "Price must be between 1 and 100000." );
else if ( GetDistanceBetweenPlayers( playerid, pID ) < 5.0 ) else if ( GetDistanceBetweenPlayers( playerid, pID ) < 5.0 )
{ {
new
iCost = iAmount * 5000,
iTaxed = floatround( iCost * 0.8 )
;
if ( GetPlayerCash( pID ) < iCost ) return SendError( playerid, "This person doesn't have enough money." ); if ( GetPlayerCash( pID ) < iCost ) return SendError( playerid, "This person doesn't have enough money." );
p_WeedDealer[ pID ] = playerid; p_WeedDealer[ pID ] = playerid;
p_WeedTick[ pID ] = GetServerTime( ) + 120; p_WeedTick[ pID ] = GetServerTime( ) + 120;
p_WeedSellingGrams[ pID ] = iAmount; p_WeedSellingGrams[ pID ] = iAmount;
p_WeedSellingPrice[ pID ] = iCost;
p_SellingWeedTick[ playerid ] = g_iTime + 60; p_SellingWeedTick[ playerid ] = g_iTime + 60;
SendClientMessageFormatted( pID, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} %s(%d) is selling you %d gram(s) of weed for %s. "COL_ORANGE"/weed buy"COL_WHITE" to buy.", ReturnPlayerName( playerid ), playerid, iAmount, cash_format( iCost ) ); SendClientMessageFormatted( pID, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} %s(%d) is selling you %d gram(s) of weed for %s. "COL_ORANGE"/weed buy"COL_WHITE" to buy.", ReturnPlayerName( playerid ), playerid, iAmount, cash_format( iCost ) );
SendClientMessageFormatted( playerid, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} You have sent an offer to %s(%d) to buy a %d gram(s) of weed for "COL_GOLD"%s.", ReturnPlayerName( pID ), pID, iAmount, cash_format( iTaxed ) ); SendClientMessageFormatted( playerid, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} You have sent an offer to %s(%d) to buy a %d gram(s) of weed for "COL_GOLD"%s.", ReturnPlayerName( pID ), pID, iAmount, cash_format( iCost ) );
return 1; return 1;
} }
else else
@ -190,21 +187,20 @@ CMD:weed( playerid, params[ ] )
else if ( strmatch( params, "buy" ) ) else if ( strmatch( params, "buy" ) )
{ {
if ( !IsPlayerConnected( p_WeedDealer[ playerid ] ) ) return SendError( playerid, "Your dealer isn't connected anymore." ); if ( !IsPlayerConnected( p_WeedDealer[ playerid ] ) ) return SendError( playerid, "Your dealer isn't connected anymore." );
else if ( GetServerTime( ) > p_WeedTick[ playerid ] ) return p_WeedDealer[ playerid ] = INVALID_PLAYER_ID, SendError( playerid, "This deal has ended, each deal goes for 2 minutes maximum. You were late." ); else if ( GetServerTime( ) > p_WeedTick[ playerid ] ) return Weed_ResetSellingProperties( playerid ), SendError( playerid, "This deal has ended, each deal goes for 2 minutes maximum. You were late." );
else else
{ {
new new
dealerid = p_WeedDealer[ playerid ], dealerid = p_WeedDealer[ playerid ],
iGrams = p_WeedSellingGrams[ playerid ], iGrams = p_WeedSellingGrams[ playerid ],
iCost = iGrams * 5000, iCost = p_WeedSellingPrice[ playerid ]
iTaxed = floatround( iCost * 0.8 )
; ;
if ( GetPlayerCash( playerid ) < iCost ) return SendError( playerid, "You need %s to buy %d grams of weed.", cash_format( iCost ), iGrams ); if ( GetPlayerCash( playerid ) < iCost ) return SendError( playerid, "You need %s to buy %d grams of weed.", cash_format( iCost ), iGrams );
else if ( IsPlayerInPaintBall( dealerid ) || IsPlayerDueling( dealerid ) ) return SendError( playerid, "Your dealer cannot deal in an arena." ); else if ( IsPlayerInPaintBall( dealerid ) || IsPlayerDueling( dealerid ) ) return SendError( playerid, "Your dealer cannot deal in an arena." );
else if ( p_Class[ dealerid ] != CLASS_CIVILIAN ) return p_WeedDealer[ playerid ] = INVALID_PLAYER_ID, SendError( playerid, "This deal has ended, the dealer is not a civilian." ); else if ( p_Class[ dealerid ] != CLASS_CIVILIAN ) return Weed_ResetSellingProperties( playerid ), SendError( playerid, "This deal has ended, the dealer is not a civilian." );
else if ( !IsPlayerJob( dealerid, JOB_DRUG_DEALER ) ) return SendError( playerid, "Your dealer no longer does drugs." ); else if ( !IsPlayerJob( dealerid, JOB_DRUG_DEALER ) ) return SendError( playerid, "Your dealer no longer does drugs." );
else if ( !p_WeedGrams[ dealerid ] ) return p_WeedDealer[ playerid ] = INVALID_PLAYER_ID, SendError( playerid, "Your dealer doesn't have any more weed." ); else if ( !p_WeedGrams[ dealerid ] ) return Weed_ResetSellingProperties( playerid ), SendError( playerid, "Your dealer doesn't have any more weed." );
//else if ( ( p_WeedGrams[ playerid ] + iGrams ) > MAX_WEED_STORAGE ) return SendError( playerid, "You can only carry %d grams of weed.", MAX_WEED_STORAGE ); //else if ( ( p_WeedGrams[ playerid ] + iGrams ) > MAX_WEED_STORAGE ) return SendError( playerid, "You can only carry %d grams of weed.", MAX_WEED_STORAGE );
else else
{ {
@ -212,16 +208,16 @@ CMD:weed( playerid, params[ ] )
p_WeedGrams[ dealerid ] -= iGrams; p_WeedGrams[ dealerid ] -= iGrams;
GivePlayerCash( playerid, -iCost ); GivePlayerCash( playerid, -iCost );
GivePlayerCash( dealerid, iTaxed ); GivePlayerCash( dealerid, iCost );
SendClientMessageFormatted( dealerid, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} %s(%d) has bought %d grams of weed off you for %s.", ReturnPlayerName( playerid ), playerid, iGrams, cash_format( iTaxed ) ); SendClientMessageFormatted( dealerid, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} %s(%d) has bought %d grams of weed off you for %s.", ReturnPlayerName( playerid ), playerid, iGrams, cash_format( iCost ) );
SendClientMessageFormatted( playerid, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} You have bought %d grams of weed for %s.", iGrams, cash_format( iCost ) ); SendClientMessageFormatted( playerid, -1, ""COL_ORANGE"[DRUG DEAL]{FFFFFF} You have bought %d grams of weed for %s.", iGrams, cash_format( iCost ) );
GivePlayerWantedLevel( dealerid, 6 ); GivePlayerWantedLevel( dealerid, 6 );
GivePlayerWantedLevel( playerid, 6 ); GivePlayerWantedLevel( playerid, 6 );
Beep( dealerid ); Beep( dealerid );
p_WeedDealer[ playerid ] = INVALID_PLAYER_ID; Weed_ResetSellingProperties( playerid );
} }
} }
return 1; return 1;
@ -330,3 +326,11 @@ stock Weed_GetPlantLimit( playerid )
return 5; return 5;
} }
} }
stock Weed_ResetSellingProperties( playerid )
{
Weed_ResetSellingProperties( playerid );
p_WeedSellingGrams[ playerid ] = 0;
p_WeedSellingPrice[ playerid ] = 0;
return 1;
}

View File

@ -88,6 +88,7 @@ new
p_WeedDealer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... }, p_WeedDealer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
p_WeedTick [ MAX_PLAYERS ], p_WeedTick [ MAX_PLAYERS ],
p_WeedSellingGrams [ MAX_PLAYERS ], p_WeedSellingGrams [ MAX_PLAYERS ],
p_WeedSellingPrice [ MAX_PLAYERS ],
p_Arrests [ MAX_PLAYERS ], p_Arrests [ MAX_PLAYERS ],
bool: p_AidsVaccine [ MAX_PLAYERS char ], bool: p_AidsVaccine [ MAX_PLAYERS char ],
bool: p_CantUseAsk [ MAX_PLAYERS char ], bool: p_CantUseAsk [ MAX_PLAYERS char ],

View File

@ -5124,6 +5124,11 @@ hook OnScriptInit( )
CreateDynamicObject( 2607, -2376.293945, 1553.312988, 1.487188, 0.000000, 0.000000, 0.000000, -1, -1, -1 ); CreateDynamicObject( 2607, -2376.293945, 1553.312988, 1.487188, 0.000000, 0.000000, 0.000000, -1, -1, -1 );
CreateDynamicObject( 1514, -2375.768554, 1553.325317, 2.117187, 0.000000, 0.000000, 22.000122, -1, -1, -1 ); CreateDynamicObject( 1514, -2375.768554, 1553.325317, 2.117187, 0.000000, 0.000000, 22.000122, -1, -1, -1 );
// Militia Ship Fix
SetDynamicObjectMaterial( CreateDynamicObject( 19368, -2366.884033, 1551.858032, 2.117000, 0.000000, 0.000000, 86.300003, -1, -1, -1 ), 0, 18202, "w_towncs_t", "concretebig4256128", 1 );
SetDynamicObjectMaterial( CreateDynamicObject( 19368, -2369.967041, 1556.052978, 2.117000, 0.000000, 0.000000, -3.900000, -1, -1, -1 ), 0, 18202, "w_towncs_t", "concretebig4256128", 1 );
SetDynamicObjectMaterial( CreateDynamicObject( 19464, -2367.564941, 1554.942993, 3.707000, 0.000000, 90.000000, -3.700000, -1, -1, -1 ), 0, 18202, "w_towncs_t", "concretebig4256128", 1 );
// SF Penis Tower // SF Penis Tower
// tmpVariable = CreateDynamicObject( 8131, -1980.097290, 884.313598, 54.389820, 0.000000, 0.000000, 90.000000, -1, -1, -1 ); // tmpVariable = CreateDynamicObject( 8131, -1980.097290, 884.313598, 54.389820, 0.000000, 0.000000, 90.000000, -1, -1, -1 );
// SetDynamicObjectMaterial( tmpVariable, 0, 8460, "vgseland03_lvs", "ceaserwall06_128", 0 ); // SetDynamicObjectMaterial( tmpVariable, 0, 8460, "vgseland03_lvs", "ceaserwall06_128", 0 );