Merge branch 'fixes' of https://bitbucket.org/lorenc/cnr into fixes

This commit is contained in:
Stev 2018-12-25 22:45:36 +00:00
commit 25f67e8bdb
5 changed files with 54 additions and 46 deletions

View File

@ -17,13 +17,6 @@ hook OnPlayerText( playerid, text[ ] )
{
if ( ! IsPlayerNPC( playerid ) ) {
if ( GetPlayerScore( playerid ) < 10 ) {
return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), Y_HOOKS_BREAK_RETURN_1;
}
if ( ! IsPlayerLoggedIn( playerid ) ) {
return SendError( playerid, "You must be logged in to talk." ), Y_HOOKS_BREAK_RETURN_1;
}
}
return Y_HOOKS_CONTINUE_RETURN_1;
}

View File

@ -362,16 +362,16 @@ CMD:duel( playerid, params[ ] )
new
targetid;
if ( sscanf( params[7], "u", targetid) )
if ( sscanf( params[ 7 ], "u", targetid ) )
return SendUsage( playerid, "/duel accept [PLAYER_ID]");
if ( !IsPlayerConnected( targetid ))
if ( !IsPlayerConnected( targetid ) )
return SendError( playerid, "You do not have any duel invitations to accept.");
if ( gettime() > p_duelInvitation[ targetid ][ playerid ] )
if ( gettime( ) > p_duelInvitation[ targetid ][ playerid ] )
return SendError( playerid, "You have not been invited by %s to duel or it has expired.");
if ( IsPlayerDueling( playerid ))
if ( IsPlayerDueling( playerid ) )
return SendError( playerid, "You cannot accept this invite as you are currently dueling.");
if ( GetDistanceBetweenPlayers( playerid, targetid ) > 25.0)
@ -380,15 +380,15 @@ CMD:duel( playerid, params[ ] )
new
waged_amount = g_duelData[ targetid ][ E_BET ];
if (g_duelData[ targetid ][ E_BET ] != 0)
if ( g_duelData[ targetid ][ E_BET ] != 0 )
{
if ( GetPlayerCash( targetid ) < waged_amount)
if ( GetPlayerCash( targetid ) < waged_amount )
{
SendClientMessageFormatted( targetid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" %s has accepted but you don't have money to wage (%s).", ReturnPlayerName( playerid ), cash_format( waged_amount ) );
SendClientMessageFormatted( playerid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" You have accepted %s's duel invitation but they don't have money.", ReturnPlayerName( targetid ) );
return 1;
}
else if ( GetPlayerCash( playerid ) < waged_amount)
else if ( GetPlayerCash( playerid ) < waged_amount )
{
SendClientMessageFormatted( playerid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" %s requires you to wage %s.", ReturnPlayerName( targetid ), cash_format( waged_amount ) );
SendClientMessageFormatted( targetid, -1, ""COL_DUEL"[DUEL]"COL_WHITE" %s has accepted the duel invitation but they don't have money to wage.", ReturnPlayerName( playerid ) );
@ -451,9 +451,9 @@ CMD:duel( playerid, params[ ] )
}
return 1;
}
else if (strmatch(params, "cancel"))
else if ( strmatch( params, "cancel" ) )
{
if ( ClearDuelInvites( playerid ))
if ( ClearDuelInvites( playerid ) )
{
return SendServerMessage( playerid, "You have cancelled every duel offer that you have made." );
}
@ -486,7 +486,7 @@ stock IsPlayerDueling( playerid ) {
return p_playerDueling{ playerid };
}
stock ShowPlayerDuelMenu(playerid)
stock ShowPlayerDuelMenu( playerid )
{
if ( p_Class[ playerid ] != CLASS_CIVILIAN )
return SendError( playerid, "You can only use this feature whist being a civilian.");
@ -496,7 +496,7 @@ stock ShowPlayerDuelMenu(playerid)
format( szBigString, sizeof(szBigString),
"Player\t"COL_GREY"%s\nHealth\t"COL_GREY"%.2f%%\nArmour\t"COL_GREY"%.2f%%\nPrimary Weapon\t"COL_GREY"%s\nSecondary Weapon\t"COL_GREY"%s\nLocation\t"COL_GREY"%s\nWager\t"COL_GREY"%s\n"COL_GOLD"Send Invite\t"COL_GOLD">>>",
(!IsPlayerConnected(g_duelData[ playerid ][ E_PLAYER ]) ? (""COL_RED"No-one") : (ReturnPlayerName( g_duelData[ playerid ][ E_PLAYER ] ) ) ),
( ! IsPlayerConnected( g_duelData[ playerid ][ E_PLAYER ] ) ? ( ""COL_RED"No-one" ) : ( ReturnPlayerName( g_duelData[ playerid ][ E_PLAYER ] ) ) ),
g_duelData[ playerid ][ E_HEALTH ],
g_duelData[ playerid ][ E_ARMOUR ],
ReturnWeaponName( g_duelData[ playerid ][ E_WEAPON ][ 0 ] ),
@ -505,13 +505,13 @@ stock ShowPlayerDuelMenu(playerid)
cash_format( g_duelData[ playerid ][ E_BET ] )
);
ShowPlayerDialog(playerid, DIALOG_DUEL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Duel Settings", szBigString, "Select", "Cancel");
ShowPlayerDialog( playerid, DIALOG_DUEL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Duel Settings", szBigString, "Select", "Cancel" );
return 1;
}
static stock forfeitPlayerDuel(playerid)
{
if ( !IsPlayerDueling( playerid ))
if ( !IsPlayerDueling( playerid ) )
return 0;
ClearDuelInvites( playerid );
@ -519,22 +519,22 @@ static stock forfeitPlayerDuel(playerid)
new
winnerid = g_duelData[ playerid ][ E_PLAYER ];
if ( ! IsPlayerConnected( winnerid ) || ! IsPlayerDueling( winnerid ))
if ( ! IsPlayerConnected( winnerid ) || ! IsPlayerDueling( winnerid ) )
return 0;
// begin wager info
new
amount_waged = g_duelData[ playerid ][ E_BET ];
SpawnPlayer(winnerid);
ClearDuelInvites(winnerid);
SpawnPlayer( winnerid );
ClearDuelInvites( winnerid );
// decrement rounds
g_duelData[ playerid ][ E_ROUNDS ] --;
g_duelData[ winnerid ][ E_ROUNDS ] = g_duelData[ playerid ][ E_ROUNDS ];
// check if theres a remaining round
if (g_duelData[ playerid ][ E_ROUNDS ] == 0)
if ( g_duelData[ playerid ][ E_ROUNDS ] == 0)
{
if ( 0 < amount_waged < 10000000 )
{
@ -552,10 +552,10 @@ static stock forfeitPlayerDuel(playerid)
return 1;
}
function OnDuelTimer(targetid)
function OnDuelTimer( targetid )
{
new
playerid = g_duelData[targetid][ E_PLAYER ];
playerid = g_duelData[ targetid ][ E_PLAYER ];
g_duelData[ targetid ][ E_COUNTDOWN ] --;
@ -574,7 +574,7 @@ function OnDuelTimer(targetid)
}
else
{
format(szSmallString, sizeof(szSmallString), "~w~%d", g_duelData[ targetid ][ E_COUNTDOWN ]);
format( szSmallString, sizeof( szSmallString ), "~w~%d", g_duelData[ targetid ][ E_COUNTDOWN ] );
GameTextForPlayer( targetid, szSmallString, 1500, 4 );
GameTextForPlayer( playerid, szSmallString, 1500, 4 );

View File

@ -128,9 +128,19 @@ hook OnServerGameDayEnd( )
hook OnPlayerDriveVehicle( playerid, vehicleid )
{
new
modelid = GetVehicleModel( vehicleid );
modelid = GetVehicleModel( vehicleid ),
Float: total_experience;
GetPlayerTotalExperience( playerid, total_experience );
if ( modelid == 407 ) {
if ( total_experience < 2500 )
{
RemovePlayerFromVehicle( playerid );
return SendServerMessage( playerid, "You must have 2,500XP to use a Firetruck." );
}
ShowPlayerHelpDialog( playerid, 2500, "You can see where fires are using ~g~/fires" );
}
return 1;

View File

@ -10,20 +10,17 @@
//#include < physics_dynamic >
/* ** Definitions ** */
#define POCKET_RADIUS 0.09
#define POOL_TIMER_SPEED 30
#define DEFAULT_AIM 0.38
#define POCKET_RADIUS ( 0.09 )
#define POOL_TIMER_SPEED ( 30 )
#define DEFAULT_AIM ( 0.38 )
#define DEFAULT_POOL_STRING "Pool Table\n{FFFFFF}Press ENTER To Play"
#define POOL_FEE_RATE 0.02
#define POOL_FEE_RATE ( 0.02 )
#define MAX_POOL_TABLES 48
#define MAX_POOL_BALLS (16) // do not modify
//#define DIALOG_POOL_WAGER 3284
#define MAX_POOL_TABLES ( 48 )
#define MAX_POOL_BALLS ( 16 ) // do not modify
/* ** Macros ** */
#define SendPoolMessage(%0,%1) \
SendClientMessageFormatted(%0, -1, "{4B8774}[POOL] {E5861A}" # %1)
#define SendPoolMessage(%0,%1) SendClientMessageFormatted(%0, -1, "{4B8774}[POOL] {E5861A}" # %1)
/* ** Constants (do not modify) ** */
enum E_POOL_BALL_TYPE {
@ -133,14 +130,14 @@ forward PlayPoolSound ( poolid, soundid );
hook OnScriptInit( )
{
// textdraws
g_PoolTextdraw = TextDrawCreate(529.000000, 218.000000, "Power");
TextDrawBackgroundColor(g_PoolTextdraw, 255);
TextDrawFont(g_PoolTextdraw, 1);
TextDrawLetterSize(g_PoolTextdraw, 0.300000, 1.299998);
TextDrawColor(g_PoolTextdraw, -1);
TextDrawSetOutline(g_PoolTextdraw, 1);
TextDrawSetProportional(g_PoolTextdraw, 1);
TextDrawSetSelectable(g_PoolTextdraw, 0);
g_PoolTextdraw = TextDrawCreate( 529.000000, 218.000000, "Power" );
TextDrawBackgroundColor( g_PoolTextdraw, 255 );
TextDrawFont( g_PoolTextdraw, 1 );
TextDrawLetterSize( g_PoolTextdraw, 0.300000, 1.299998 );
TextDrawColor( g_PoolTextdraw, -1 );
TextDrawSetOutline( g_PoolTextdraw, 1 );
TextDrawSetProportional( g_PoolTextdraw, 1 );
TextDrawSetSelectable( g_PoolTextdraw, 0 );
// create static pooltables
CreatePoolTableEx( 510.10159, -84.83590, 998.9375, 90.00000, POOL_SKIN_DEFAULT, 11, 7, 54, 55, 56, 50, 52, 51, 15, 10, 21, 58, 48, 17, 36, 41, 22 );

View File

@ -1934,6 +1934,14 @@ public OnPlayerText( playerid, text[ ] )
new
time = g_iTime;
if ( GetPlayerScore( playerid ) < 10 ) {
return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), 0;
}
if ( ! IsPlayerLoggedIn( playerid ) ) {
return SendError( playerid, "You must be logged in to talk." ), 0;
}
if ( textContainsIP( text ) )
return SendServerMessage( playerid, "Please do not advertise." ), 0;