commit
bf94e5f763
@ -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 0 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
|
||||||
@ -196,8 +193,7 @@ CMD:weed( playerid, params[ ] )
|
|||||||
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 );
|
||||||
@ -212,9 +208,9 @@ 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 );
|
||||||
|
@ -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 ],
|
||||||
|
Loading…
Reference in New Issue
Block a user