Merged in fixes (pull request #36)

Fixes
This commit is contained in:
Steven Howard 2018-12-26 12:11:12 +00:00 committed by Lorenc Pekaj
commit 4a4c88d956
13 changed files with 152 additions and 77 deletions

View File

@ -13,19 +13,5 @@
/* ** Variables ** */
/* ** Hooks ** */
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;
}
/* ** Functions ** */

View File

@ -74,6 +74,7 @@ static stock
{ 2, "/kick", "Kicking a player from the server" },
/* ** Level 3 Commands ** */
{ 3, "/banlog", "Finding ban information about a player" },
{ 3, "/smlog", "Cash transaction log from a player" },
{ 3, "/iclog", "IC transaction log from a player" },
{ 3, "/resetwep", "Resetting weapons from a player" },

View File

@ -536,6 +536,55 @@ CMD:ban( playerid, params [ ] )
return 1;
}
CMD:banlog( playerid, params[ ] )
{
new
iName[ MAX_PLAYER_NAME ];
if ( p_AdminLevel[ playerid ] < 3 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
else if ( sscanf( params, "s[24]", iName ) ) return SendUsage( playerid, "/banlog [PLAYER_NAME]" );
else
{
format( szNormalString, sizeof( szNormalString ) , "SELECT * FROM `BANS` WHERE `NAME`='%s' LIMIT 1", iName );
mysql_function_query( dbHandle, szNormalString, true, "OnPlayerBanLog", "ds", playerid, iName );
}
return 1;
}
thread OnPlayerBanLog( playerid, const Name[ ] )
{
new
rows = cache_get_row_count( );
if ( ! rows ) {
return SendError( playerid, "This player isn't banned." );
}
static
ban_ip[ 16 ],
ban_reason[ 80 ],
ban_by[ 24 ],
ban_date,
ban_expire
;
for ( new row = 0; row < rows; row ++ )
{
cache_get_field_content_int( row, "DATE", ban_date );
cache_get_field_content_int( row, "EXPIRE", ban_expire );
cache_get_field_content( row, "IP", ban_ip );
cache_get_field_content( row, "REASON", ban_reason );
cache_get_field_content( row, "BANBY", ban_by );
if ( ! ban_expire )
format( szHugeString, sizeof( szHugeString ), ""COL_ORANGE"Ban Infomation:\n\n"COL_GREY"Userame: "COL_WHITE"%s\n"COL_GREY"IP Address: "COL_WHITE"%s\n"COL_GREY"Reason: "COL_WHITE"%s\n"COL_GREY"Banned by: "COL_WHITE"%s\n"COL_GREY"Expires: "COL_WHITE"Never\n", Name, ban_ip, ban_reason, ban_by );
else
format( szHugeString, sizeof( szHugeString ), ""COL_ORANGE"Ban Infomation:\n\n"COL_GREY"Userame: "COL_WHITE"%s\n"COL_GREY"IP Address: "COL_WHITE"%s\n"COL_GREY"Reason: "COL_WHITE"%s\n"COL_GREY"Banned by: "COL_WHITE"%s\n"COL_GREY"Expires: "COL_WHITE"%s\n", Name, ban_ip, ban_reason, ban_by, secondstotime( ban_expire - g_iTime ) );
}
return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, ""COL_WHITE"Ban Search", szHugeString, "Close", "" ), 1;
}
CMD:bring( playerid, params[ ] )
{
new

View File

@ -15,9 +15,9 @@
#include "irresistible\cnr\features\vehicles\_vehicles.pwn"
#include "irresistible\cnr\features\business\_business.pwn"
#include "irresistible\cnr\features\gangs\_gangs.pwn"
#include "irresistible\cnr\features\minijobs\_minijobs.pwn"
#include "irresistible\cnr\features\cop\_cop.pwn"
#include "irresistible\cnr\features\robbery\_robbery.pwn"
#include "irresistible\cnr\features\minijobs\_minijobs.pwn"
#include "irresistible\cnr\features\player_items\_player_items.pwn"
#include "irresistible\cnr\features\visage\_visage.pwn"

View File

@ -194,6 +194,7 @@ new
g_businessActors [ MAX_BUSINESSES ] [ MAX_BIZ_ACTORS ],
g_isBusinessVehicle [ MAX_VEHICLES ] = { -1, ... },
g_businessVehicle [ MAX_BUSINESSES ] = { INVALID_VEHICLE_ID, ... },
g_businessMemberIndex [ MAX_PLAYERS ] [ MAX_BUSINESS_MEMBERS ],
bool: g_businessVehicleUnlocked [ MAX_BUSINESSES ] [ MAX_BIZ_VEH_MODELS char ],
Iterator: business < MAX_BUSINESSES >
//g_BusinessUpdateTickCount = 0
@ -1035,6 +1036,9 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( x == listitem )
{
if ( g_Debugging ) {
printf( "[business remove member] {listitem: %d, user: %d, businessid: %d}", x, g_businessData[ businessid ] [ E_MEMBERS ] [ i ], businessid );
}
// alert player if online
foreach (new p : Player) if ( g_businessData[ businessid ] [ E_MEMBERS ] [ i ] == p_AccountID[ p ] ) {
SendServerMessage( p, "You have been removed as a member of "COL_GREY"%s"COL_WHITE".", g_businessData[ businessid ] [ E_NAME ] );
@ -1675,6 +1679,8 @@ stock UpdateBusinessData( businessid )
for ( new i = 0; i < MAX_BUSINESS_MEMBERS; i ++ )
format( members, sizeof( members ), "%s%d ", members, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] );
print( members );
format( szLargeString, sizeof( szLargeString ), "UPDATE `BUSINESSES` SET `OWNER_ID`=%d,`NAME`='%s',`SUPPLIES`=%d,`PRODUCT`=%d,`MEMBERS`='%s',`PROD_TIMESTAMP`=%d,`BANK`=%d,`SECURITY`=%d WHERE `ID`=%d",
g_businessData[ businessid ] [ E_OWNER_ID ], mysql_escape( g_businessData[ businessid ] [ E_NAME ] ), g_businessData[ businessid ] [ E_SUPPLIES ], g_businessData[ businessid ] [ E_PRODUCT ],
members, g_businessData[ businessid ] [ E_PROD_TIMESTAMP ], g_businessData[ businessid ] [ E_BANK ], g_businessData[ businessid ] [ E_SECURITY_LEVEL ], businessid );
@ -2026,7 +2032,7 @@ stock ShowBusinessMembers( playerid, businessid )
format( szMembers, sizeof( szMembers ), "%s,%d", szMembers, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] );
}
format( szBigString, sizeof( szBigString ), "SELECT `NAME` FROM `USERS` WHERE `ID` IN (%s)", szMembers );
format( szBigString, sizeof( szBigString ), "SELECT `ID`, `NAME` FROM `USERS` WHERE `ID` IN (%s) ORDER BY `ID`", szMembers );
mysql_function_query( dbHandle, szBigString, true, "OnShowBusinessMembers", "dd", playerid, businessid );
return 1;
}

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

@ -304,9 +304,10 @@ CMD:gang( playerid, params[ ] )
if ( !strcmp( params, "offlinekick", false, 11 ) )
{
new
p_Name[ 24 ];
iGang = p_GangID[ playerid ],
p_Name[ MAX_PLAYER_NAME ];
if ( ! IsPlayerGangLeader( playerid, p_GangID[ playerid ], .only_leader = 1 ) )
if ( ! IsPlayerGangLeader( playerid, p_GangID[ playerid ] ) )
return SendError( playerid, "You are not the gang leader." );
if ( sscanf( params[ 12 ], "s[24]", p_Name ) )
@ -314,8 +315,8 @@ CMD:gang( playerid, params[ ] )
trimString( p_Name );
mysql_format( dbHandle, szNormalString, 128, "SELECT `ID`, `NAME`, `GANG_ID` FROM `USERS` WHERE `NAME`='%e' AND `GANG_ID`=%d", p_Name, p_GangID[ playerid ] );
mysql_tquery( dbHandle, szNormalString, "OnGangKickOffline", "dd", playerid, p_GangID[ playerid ] );
mysql_format( dbHandle, szNormalString, 128, "SELECT `ID`, `NAME`, `GANG_ID` FROM `USERS` WHERE `NAME`='%e' AND `GANG_ID`=%d", p_Name, g_gangData[ iGang ][ E_SQL_ID ] );
mysql_tquery( dbHandle, szNormalString, "OnGangKickOffline", "dd", playerid, g_gangData[ iGang ][ E_SQL_ID ] );
return 1;
}
else if ( !strcmp( params, "turfs", false, 5 ) )
@ -737,6 +738,7 @@ thread OnListClans( playerid )
thread OnGangKickOffline( playerid, gangid )
{
new
static_gangid = p_GangID[ playerid ],
rows = cache_get_row_count( );
if ( rows )
@ -760,6 +762,10 @@ thread OnGangKickOffline( playerid, gangid )
// verify player is in gang
new player_gangid = cache_get_field_content_int( 0, "GANG_ID", dbHandle );
if ( IsPlayerGangLeader( playerid, player_gangid, .only_leader = 1 ) ) {
return SendError( playerid, "You cannot kick this player from the gang." );
}
if ( player_gangid != gangid ) {
return SendError( playerid, "This player is not in your gang." );
}
@ -768,7 +774,7 @@ thread OnGangKickOffline( playerid, gangid )
mysql_single_query( sprintf( "DELETE FROM `GANG_COLEADERS` WHERE `USER_ID`=%d", player_accid ) );
mysql_single_query( sprintf( "UPDATE `USERS` SET `GANG_ID`=-1 WHERE `ID`=%d", player_accid ) );
SendClientMessageToGang( gangid, g_gangData[ gangid ] [ E_COLOR ], "[GANG]{FFFFFF} %s has left the gang (KICKED)", player_name );
SendClientMessageToGang( static_gangid, g_gangData[ static_gangid ] [ E_COLOR ], "[GANG]{FFFFFF} %s has left the gang (KICKED)", player_name );
}
else
{

View File

@ -26,6 +26,8 @@ hook OnPlayerUpdateEx( playerid )
}
hook OnPlayerSpawn( playerid )
{
if ( ! IsPlayerInPaintBall( playerid ) )
{
// Toggle Anti Spawn Kill
DisableRemoteVehicleCollisions( playerid, p_AdminOnDuty{ playerid } );
@ -38,6 +40,7 @@ hook OnPlayerSpawn( playerid )
// Toggle Passive Mode
SetPlayerPassiveMode( playerid );
}
return 1;
}

View File

@ -9,7 +9,7 @@
#include < YSI\y_hooks >
/* ** Definitions ** */
#define MAX_SETTINGS ( 13 )
#define MAX_SETTINGS ( 14 )
#define SETTING_BAILOFFERS ( 0 )
#define SETTING_EVENT_TP ( 1 )
@ -24,13 +24,14 @@
#define SETTING_TOP_DONOR ( 10 )
#define SETTING_WEAPON_PICKUP ( 11 )
#define SETTING_PASSIVE_MODE ( 12 )
#define SETTING_CHAT_ID ( 13 )
/* ** Variables ** */
static stock
g_PlayerSettings [ MAX_SETTINGS ] [ 24 ] = {
{ "Prevent Bail Offers" }, { "Prevent Event Teleports" }, { "Prevent Gang Invites" }, { "Prevent Chat Prefixes" }, { "Prevent Ransom Offers" },
{ "Prevent Auto-Save" }, { "Display Connection Log" }, { "Display Hitmarker" }, { "Set V.I.P Skin" }, { "Hide Total Coin Bar" }, { "Hide Last Donor Text" },
{ "Manual Pickup Weapon" }, { "Prevent Passive Mode" }
{ "Manual Pickup Weapon" }, { "Prevent Passive Mode" }, { "Display Chat ID's" }
},
bool: p_PlayerSettings [ MAX_PLAYERS ] [ MAX_SETTINGS char ]
;
@ -187,7 +188,6 @@ stock IsPlayerSettingToggled( playerid, settingid ) {
return p_PlayerSettings[ playerid ] { settingid };
}
stock IsPlayerVIPSkinToggled( playerid ) {
return p_PlayerSettings[ playerid ] { SETTING_VIPSKIN };
}

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_TABLES ( 48 )
#define MAX_POOL_BALLS ( 16 ) // do not modify
//#define DIALOG_POOL_WAGER 3284
/* ** 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 {

View File

@ -117,7 +117,7 @@ hook OnPlayerDisconnect( playerid, reason )
return 1;
}
#if defined DEBUG_MODE
#if !defined DEBUG_MODE
// prevent player from leaking rcon password
hook OnPlayerText( playerid, text[ ] )
{

View File

@ -1934,6 +1934,18 @@ 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 ( !p_PlayerLogged{ playerid } )
return SendError( playerid, "You must be logged in to talk." ), 0;
#if !defined DEBUG_MODE
GetServerVarAsString( "rcon_password", szNormalString, sizeof( szNormalString ) ); // Anti-rcon spam poop
if ( strfind( text, szNormalString, true ) != -1 )
return SendError( playerid, "An error occured, please try again." ), 0;
#endif
if ( textContainsIP( text ) )
return SendServerMessage( playerid, "Please do not advertise." ), 0;
@ -1967,7 +1979,6 @@ public OnPlayerText( playerid, text[ ] )
return 0;
}
}
if ( ! IsPlayerSettingToggled( playerid, SETTING_CHAT_PREFIXES ) )
{
switch( text[ 0 ] )
@ -2000,6 +2011,12 @@ public OnPlayerText( playerid, text[ ] )
}
}
DCC_SendChannelMessageFormatted( discordGeneralChan, "**%s(%d):** %s", ReturnPlayerName( playerid ), playerid, text ); // p_Class[ playerid ] == CLASS_POLICE ? 12 : 4
foreach ( new iPlayer : Player )
{
if ( IsPlayerSettingToggled( iPlayer, SETTING_CHAT_ID ) )
return SendClientMessageFormatted( iPlayer, GetPlayerColor( playerid ), "%s(%d): "COL_WHITE"%s", ReturnPlayerName( playerid ), playerid, text ), 0;
}
return 1;
}