Level 5-6 acmds based on note
This commit is contained in:
parent
71b4d4af8f
commit
ff4254fd75
@ -111,29 +111,69 @@ CMD:c( playerid, params[ ] )
|
|||||||
CMD:creategarage( playerid, params[ ] )
|
CMD:creategarage( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
cost, iTmp, iVehicle,
|
pID, cost;
|
||||||
Float: X, Float: Y, Float: Z, Float: Angle
|
|
||||||
;
|
|
||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "d", cost ) ) return SendUsage( playerid, "/creategarage [COST]" );
|
else if ( sscanf( params, "dU(-1)", cost, pID ) ) return SendUsage( playerid, "/creategarage [COST] [PLAYER_ID (optional)]" );
|
||||||
|
else if ( ! IsPlayerServerMaintainer( playerid ) && ! IsPlayerConnected( pID ) && cost < 50000 ) return SendError( playerid, "You must specify a player for garages under $50,000." );
|
||||||
else if ( cost < 100 ) return SendError( playerid, "The price must be located above 100 dollars." );
|
else if ( cost < 100 ) return SendError( playerid, "The price must be located above 100 dollars." );
|
||||||
else if ( !( iVehicle = GetPlayerVehicleID( playerid ) ) ) return SendError( playerid, "You are not in any vehicle." );
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddAdminLogLineFormatted( "%s(%d) has created a garage", ReturnPlayerName( playerid ), playerid );
|
mysql_format(
|
||||||
|
dbHandle, szBigString, sizeof( szBigString ),
|
||||||
if ( GetVehiclePos( iVehicle, X, Y, Z ) && GetVehicleZAngle( iVehicle, Angle ) )
|
"SELECT * FROM `NOTES` WHERE (`NOTE` LIKE '{FFDC2E}V.I.P Garage%%' ) AND USER_ID=%d AND `DELETED` IS NULL LIMIT 0,1",
|
||||||
{
|
IsPlayerConnected( pID ) ? GetPlayerAccountID( pID ) : 0
|
||||||
if ( ( iTmp = CreateGarage( 0, cost, 0, X, Y, Z, Angle ) ) != -1 )
|
);
|
||||||
{
|
mysql_tquery( dbHandle, szBigString, "OnAdminCreateGarage", "ddd", playerid, pID, cost );
|
||||||
SaveToAdminLog( playerid, iTmp, "created garage" );
|
|
||||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[GARAGE]"COL_WHITE" You have created a %s garage taking up garage id %d.", cash_format( cost ), iTmp );
|
|
||||||
}
|
}
|
||||||
else
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnAdminCreateGarage( playerid, targetid, cost )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
num_rows = cache_get_row_count( );
|
||||||
|
|
||||||
|
// if there is a note or the player is a maintainer
|
||||||
|
if ( IsPlayerServerMaintainer( playerid ) || num_rows || cost >= 50000 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
noteid = -1; // incase the lead maintainer makes it anyway
|
||||||
|
|
||||||
|
// remove the note if there is one
|
||||||
|
if ( num_rows )
|
||||||
|
{
|
||||||
|
// get the first note
|
||||||
|
noteid = cache_get_field_content_int( 0, "ID", dbHandle );
|
||||||
|
|
||||||
|
// remove the note
|
||||||
|
SaveToAdminLog( playerid, noteid, "consumed player's note" );
|
||||||
|
mysql_single_query( sprintf( "UPDATE `NOTES` SET `DELETED`=%d WHERE `ID`=%d", GetPlayerAccountID( playerid ), noteid ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
Float: X, Float: Y, Float: Z, Float: Angle, iVehicle, iTmp;
|
||||||
|
|
||||||
|
// proceed by creating the garage
|
||||||
|
if ( !( iVehicle = GetPlayerVehicleID( playerid ) ) ) return SendError( playerid, "You are not in any vehicle." );
|
||||||
|
if ( GetVehiclePos( iVehicle, X, Y, Z ) && GetVehicleZAngle( iVehicle, Angle ) && ( iTmp = CreateGarage( 0, cost, 0, X, Y, Z, Angle ) != -1 ) ) {
|
||||||
|
if ( IsPlayerConnected( targetid ) ) {
|
||||||
|
SaveToAdminLogFormatted( playerid, iTmp, "created garage (garage id %d) for %s (acc id %d, note id %d)", iTmp, ReturnPlayerName( targetid ), p_AccountID[ targetid ], noteid );
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[GARAGE]"COL_WHITE" You have created a garage in the name of %s(%d).", ReturnPlayerName( targetid ), targetid );
|
||||||
|
AddAdminLogLineFormatted( "%s(%d) has created a garage for %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( targetid ), targetid );
|
||||||
|
} else {
|
||||||
|
SaveToAdminLogFormatted( playerid, iTmp, "created garage (garage id %d)", iTmp );
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[GARAGE]"COL_WHITE" You have created a garage." );
|
||||||
|
AddAdminLogLineFormatted( "%s(%d) has created a house", ReturnPlayerName( playerid ), playerid );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
SendClientMessage( playerid, -1, ""COL_PINK"[GARAGE]"COL_WHITE" Unable to create a garage due to a unexpected error." );
|
SendClientMessage( playerid, -1, ""COL_PINK"[GARAGE]"COL_WHITE" Unable to create a garage due to a unexpected error." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendError( playerid, "This user does not have a V.I.P Garage note." );
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,9 +637,7 @@ CMD:destroybribe( playerid, params[ ] )
|
|||||||
CMD:createcar( playerid, params[ ] )
|
CMD:createcar( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
vName[ 24 ], pID,
|
vName[ 24 ], pID, iModel;
|
||||||
Float: X, Float: Y, Float: Z, Float: Angle
|
|
||||||
;
|
|
||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "us[24]", pID, vName ) ) return SendUsage( playerid, "/createcar [PLAYER_ID] [VEHICLE_NAME]" );
|
else if ( sscanf( params, "us[24]", pID, vName ) ) return SendUsage( playerid, "/createcar [PLAYER_ID] [VEHICLE_NAME]" );
|
||||||
@ -607,23 +645,60 @@ CMD:createcar( playerid, params[ ] )
|
|||||||
else if ( p_OwnedVehicles[ pID ] >= GetPlayerVehicleSlots( pID ) ) return SendError( playerid, "This player has too many vehicles." );
|
else if ( p_OwnedVehicles[ pID ] >= GetPlayerVehicleSlots( pID ) ) return SendError( playerid, "This player has too many vehicles." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new
|
|
||||||
iModel, iTmp;
|
|
||||||
|
|
||||||
if ( ( iModel = GetVehicleModelFromName( vName ) ) != -1 ) {
|
if ( ( iModel = GetVehicleModelFromName( vName ) ) != -1 ) {
|
||||||
|
mysql_format(
|
||||||
|
dbHandle, szBigString, sizeof( szBigString ),
|
||||||
|
"SELECT * FROM `NOTES` WHERE (`NOTE` LIKE '{FFDC2E}V.I.P Vehicle%%' ) AND USER_ID=%d AND `DELETED` IS NULL LIMIT 0,1",
|
||||||
|
GetPlayerAccountID( pID )
|
||||||
|
);
|
||||||
|
mysql_tquery( dbHandle, szBigString, "OnAdminCreateVehicle", "ddd", playerid, pID, iModel );
|
||||||
|
}
|
||||||
|
else SendError( playerid, "Invalid Vehicle Model." );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
AddAdminLogLineFormatted( "%s(%d) has created a vehicle for %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID );
|
thread OnAdminCreateVehicle( playerid, targetid, modelid )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
num_rows = cache_get_row_count( );
|
||||||
|
|
||||||
|
// if there is a note or the player is a maintainer
|
||||||
|
if ( IsPlayerServerMaintainer( playerid ) || num_rows )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
noteid = -1; // incase the lead maintainer makes it anyway
|
||||||
|
|
||||||
|
// remove the note if there is one
|
||||||
|
if ( num_rows )
|
||||||
|
{
|
||||||
|
// get the first note
|
||||||
|
noteid = cache_get_field_content_int( 0, "ID", dbHandle );
|
||||||
|
|
||||||
|
// remove the note
|
||||||
|
SaveToAdminLog( playerid, noteid, "consumed player's note" );
|
||||||
|
mysql_single_query( sprintf( "UPDATE `NOTES` SET `DELETED`=%d WHERE `ID`=%d", GetPlayerAccountID( playerid ), noteid ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
Float: X, Float: Y, Float: Z, Float: Angle, iTmp;
|
||||||
|
|
||||||
|
// proceed by creating the vehicle
|
||||||
GetPlayerPos( playerid, X, Y, Z );
|
GetPlayerPos( playerid, X, Y, Z );
|
||||||
GetPlayerFacingAngle( playerid, Angle );
|
GetPlayerFacingAngle( playerid, Angle );
|
||||||
|
|
||||||
if ( ( iTmp = CreateBuyableVehicle( pID, iModel, 0, 0, X, Y, Z, Angle, 1337 ) ) != -1 ) {
|
if ( ( iTmp = CreateBuyableVehicle( targetid, modelid, 0, 0, X, Y, Z, Angle, 1337 ) ) != -1 ) {
|
||||||
SaveToAdminLogFormatted( playerid, iTmp, "created car (model id %d) for %s (acc id %d)", iModel, ReturnPlayerName( pID ), p_AccountID[ pID ] );
|
SaveToAdminLogFormatted( playerid, iTmp, "created car (model id %d) for %s (acc id %d, note id %d)", modelid, ReturnPlayerName( targetid ), p_AccountID[ targetid ], noteid );
|
||||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[VEHICLE]"COL_WHITE" You have created a vehicle in the name of %s(%d).", ReturnPlayerName( pID ), pID );
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[VEHICLE]"COL_WHITE" You have created a vehicle in the name of %s(%d).", ReturnPlayerName( targetid ), targetid );
|
||||||
PutPlayerInVehicle( playerid, g_vehicleData[ pID ] [ iTmp ] [ E_VEHICLE_ID ], 0 );
|
AddAdminLogLineFormatted( "%s(%d) has created a vehicle for %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( targetid ), targetid );
|
||||||
|
PutPlayerInVehicle( playerid, g_vehicleData[ targetid ] [ iTmp ] [ E_VEHICLE_ID ], 0 );
|
||||||
|
} else {
|
||||||
|
SendClientMessage( playerid, -1, ""COL_PINK"[VEHICLE]"COL_WHITE" Unable to create a vehicle due to a unexpected error." );
|
||||||
}
|
}
|
||||||
else SendClientMessage( playerid, -1, ""COL_PINK"[VEHICLE]"COL_WHITE" Unable to create a vehicle due to a unexpected error." );
|
|
||||||
}
|
}
|
||||||
else SendError( playerid, "Invalid Vehicle Model." );
|
else
|
||||||
|
{
|
||||||
|
SendError( playerid, "This user does not have a V.I.P Vehicle note." );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -680,29 +755,118 @@ CMD:stripcarmods( playerid, params[ ] )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMD:replacecar( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
vName[ 24 ], iModel;
|
||||||
|
|
||||||
|
if ( sscanf( params, "s[24]", vName ) ) return SendUsage(playerid, "/replacecar [VEHICLE_NAME]");
|
||||||
|
|
||||||
|
if ( p_AdminLevel[ playerid ] < 5 )
|
||||||
|
return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
|
|
||||||
|
if ( !IsPlayerInAnyVehicle( playerid ) )
|
||||||
|
return SendError( playerid, "You are not in any vehicle." );
|
||||||
|
|
||||||
|
if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false )
|
||||||
|
return SendError( playerid, "This vehicle isn't a buyable vehicle." );
|
||||||
|
if ( ( iModel = GetVehicleModelFromName( vName ) ) != -1 ) {
|
||||||
|
|
||||||
|
new
|
||||||
|
oldmodel, ownerid, slotid, vehicleid = GetPlayerVehicleID( playerid ),
|
||||||
|
v = getVehicleSlotFromID( vehicleid, ownerid, slotid ),
|
||||||
|
Float: X, Float: Y, Float: Z, Float: Angle
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( v == -1 ) return SendError( playerid, "This vehicle doesn't look like it can be replaced. (0xAA)" );
|
||||||
|
if ( g_vehicleData[ ownerid ] [ slotid ] [ E_CREATED ] == false ) return SendError( playerid, "This vehicle doesn't look like it can be replaced. (0xAF)" );
|
||||||
|
|
||||||
|
GetVehiclePos( vehicleid, X, Y, Z );
|
||||||
|
GetVehicleZAngle( vehicleid, Angle );
|
||||||
|
|
||||||
|
oldmodel = GetVehicleModel( vehicleid );
|
||||||
|
|
||||||
|
g_vehicleData[ ownerid ] [ slotid ] [ E_MODEL ] = iModel;
|
||||||
|
|
||||||
|
PutPlayerInVehicle( playerid, RespawnBuyableVehicle( vehicleid, playerid ), 0 );
|
||||||
|
SaveVehicleData( ownerid, slotid );
|
||||||
|
|
||||||
|
SendClientMessage( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" You have replaced model of this vehicle via administration." );
|
||||||
|
SaveToAdminLogFormatted( playerid, slotid, "replaced car on %s (acc id %d, model id %d)", ReturnPlayerName( ownerid ), p_AccountID[ ownerid ], g_vehicleData[ ownerid ] [ slotid ] [ E_MODEL ] );
|
||||||
|
AddAdminLogLineFormatted( "%s(%d) changed %s(%d)'s vehicle from %s to %s", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( ownerid ), ownerid, GetVehicleName( oldmodel ), GetVehicleName( iModel ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendError( playerid, "Invalid Vehicle Model." );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
CMD:createhouse( playerid, params[ ] )
|
CMD:createhouse( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
cost, iTmp,
|
pID, cost;
|
||||||
Float: X, Float: Y, Float: Z
|
|
||||||
;
|
|
||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "d", cost ) ) return SendUsage( playerid, "/createhouse [COST]" );
|
else if ( sscanf( params, "dU(-1)", cost, pID ) ) return SendUsage( playerid, "/createhouse [COST] [PLAYER_ID (optional)]" );
|
||||||
|
else if ( ! IsPlayerServerMaintainer( playerid ) && ! IsPlayerConnected( pID ) && cost < 50000 ) return SendError( playerid, "You must specify a player for homes under $50,000." );
|
||||||
else if ( cost < 100 ) return SendError( playerid, "The price must be located above 100 dollars." );
|
else if ( cost < 100 ) return SendError( playerid, "The price must be located above 100 dollars." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
mysql_format(
|
||||||
|
dbHandle, szBigString, sizeof( szBigString ),
|
||||||
|
"SELECT * FROM `NOTES` WHERE (`NOTE` LIKE '{FFDC2E}V.I.P House%%' ) AND USER_ID=%d AND `DELETED` IS NULL LIMIT 0,1",
|
||||||
|
IsPlayerConnected( pID ) ? GetPlayerAccountID( pID ) : 0
|
||||||
|
);
|
||||||
|
mysql_tquery( dbHandle, szBigString, "OnAdminCreateHouse", "ddd", playerid, pID, cost );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnAdminCreateHouse( playerid, targetid, cost )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
num_rows = cache_get_row_count( );
|
||||||
|
|
||||||
|
// if there is a note or the player is a maintainer
|
||||||
|
if ( IsPlayerServerMaintainer( playerid ) || num_rows || cost >= 50000 )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
noteid = -1; // incase the lead maintainer makes it anyway
|
||||||
|
|
||||||
|
// remove the note if there is one
|
||||||
|
if ( num_rows )
|
||||||
|
{
|
||||||
|
// get the first note
|
||||||
|
noteid = cache_get_field_content_int( 0, "ID", dbHandle );
|
||||||
|
|
||||||
|
// remove the note
|
||||||
|
SaveToAdminLog( playerid, noteid, "consumed player's note" );
|
||||||
|
mysql_single_query( sprintf( "UPDATE `NOTES` SET `DELETED`=%d WHERE `ID`=%d", GetPlayerAccountID( playerid ), noteid ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
Float: X, Float: Y, Float: Z, iTmp;
|
||||||
|
|
||||||
|
// proceed by creating the house
|
||||||
|
if ( GetPlayerPos( playerid, X, Y, Z ) && ( iTmp = CreateHouse( "Home", cost, X, Y, Z ) ) != -1 ) {
|
||||||
|
if ( IsPlayerConnected( targetid ) ) {
|
||||||
|
SaveToAdminLogFormatted( playerid, iTmp, "created house (house id %d) for %s (acc id %d, note id %d)", iTmp, ReturnPlayerName( targetid ), p_AccountID[ targetid ], noteid );
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" You have created a house in the name of %s(%d).", ReturnPlayerName( targetid ), targetid );
|
||||||
|
AddAdminLogLineFormatted( "%s(%d) has created a house for %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( targetid ), targetid );
|
||||||
|
} else {
|
||||||
|
SaveToAdminLogFormatted( playerid, iTmp, "created house (house id %d)", iTmp );
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" You have created a house." );
|
||||||
AddAdminLogLineFormatted( "%s(%d) has created a house", ReturnPlayerName( playerid ), playerid );
|
AddAdminLogLineFormatted( "%s(%d) has created a house", ReturnPlayerName( playerid ), playerid );
|
||||||
if ( GetPlayerPos( playerid, X, Y, Z ) )
|
|
||||||
{
|
|
||||||
if ( ( iTmp = CreateHouse( "Home", cost, X, Y, Z ) ) != -1 )
|
|
||||||
{
|
|
||||||
SaveToAdminLogFormatted( playerid, iTmp, "created house for %s", cash_format( cost ) );
|
|
||||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" You have created a %s house taking up house id %d.", cash_format( cost ), iTmp );
|
|
||||||
}
|
}
|
||||||
else SendClientMessage( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" Unable to create a house due to a unexpected error." );
|
} else {
|
||||||
|
SendClientMessage( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" Unable to create a house due to a unexpected error." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendError( playerid, "This user does not have a V.I.P House note." );
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,7 +919,7 @@ CMD:unforceac( playerid, params[ ] )
|
|||||||
Query[ 70 ];
|
Query[ 70 ];
|
||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "s[24]", player ) ) SendUsage( playerid, "/unban [NAME]" );
|
else if ( sscanf( params, "s[24]", player ) ) SendUsage( playerid, "/unforceac [PLAYER_NAME]" );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new pID = GetPlayerIDFromName( player );
|
new pID = GetPlayerIDFromName( player );
|
||||||
|
@ -9,28 +9,69 @@
|
|||||||
CMD:createbusiness( playerid, params[ ] )
|
CMD:createbusiness( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
Float: X, Float: Y, Float: Z, cost, type
|
pID, cost, type;
|
||||||
;
|
|
||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "dd", cost, type ) ) return SendUsage( playerid, "/createbusiness [COST] [TYPE]" );
|
else if ( sscanf( params, "ddU(-1)", cost, type, pID ) ) return SendUsage( playerid, "/createhouse [COST] [TYPE] [PLAYER_ID (optional)]" );
|
||||||
|
else if ( ! IsPlayerServerMaintainer( playerid ) && ! IsPlayerConnected( pID ) && cost < 50000 ) return SendError( playerid, "You must specify a player for business under $50,000." );
|
||||||
else if ( cost < 100 ) return SendError( playerid, "The price must be located above 100 dollars." );
|
else if ( cost < 100 ) return SendError( playerid, "The price must be located above 100 dollars." );
|
||||||
else if ( ! ( 0 <= type <= 3 ) ) return SendError( playerid, "Invalid business type (Weed=0, Meth=1, Coke=2, Weapons=3)." );
|
else if ( ! ( 0 <= type <= 3 ) ) return SendError( playerid, "Invalid business type (Weed=0, Meth=1, Coke=2, Weapons=3)." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetPlayerPos( playerid, X, Y, Z );
|
mysql_format(
|
||||||
AddAdminLogLineFormatted( "%s(%d) has created a business", ReturnPlayerName( playerid ), playerid );
|
dbHandle, szBigString, sizeof( szBigString ),
|
||||||
|
"SELECT * FROM `NOTES` WHERE (`NOTE` LIKE '{FFDC2E}%%Business%%') AND USER_ID=%d AND `DELETED` IS NULL LIMIT 0,1",
|
||||||
|
IsPlayerConnected( pID ) ? GetPlayerAccountID( pID ) : 0
|
||||||
|
);
|
||||||
|
mysql_tquery( dbHandle, szBigString, "OnAdminCreateBusiness", "dddd", playerid, pID, cost, type );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnAdminCreateBusiness( playerid, targetid, cost, type )
|
||||||
|
{
|
||||||
new
|
new
|
||||||
iTmp = CreateBusiness( 0, "Business", cost, type, X, Y, Z );
|
num_rows = cache_get_row_count( );
|
||||||
|
|
||||||
if ( iTmp != ITER_NONE ) {
|
// if there is a note or the player is a maintainer
|
||||||
SaveToAdminLog( playerid, iTmp, "created business" );
|
if ( IsPlayerServerMaintainer( playerid ) || num_rows || cost >= 50000 )
|
||||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[BUSINESS]"COL_WHITE" You have created a %s business taking up business id %d.", cash_format( cost ), iTmp );
|
{
|
||||||
|
new
|
||||||
|
noteid = -1; // incase the lead maintainer makes it anyway
|
||||||
|
|
||||||
|
// remove the note if there is one
|
||||||
|
if ( num_rows )
|
||||||
|
{
|
||||||
|
// get the first note
|
||||||
|
noteid = cache_get_field_content_int( 0, "ID", dbHandle );
|
||||||
|
|
||||||
|
// remove the note
|
||||||
|
SaveToAdminLog( playerid, noteid, "consumed player's note" );
|
||||||
|
mysql_single_query( sprintf( "UPDATE `NOTES` SET `DELETED`=%d WHERE `ID`=%d", GetPlayerAccountID( playerid ), noteid ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
Float: X, Float: Y, Float: Z, iTmp;
|
||||||
|
|
||||||
|
// proceed by creating the business
|
||||||
|
if ( GetPlayerPos( playerid, X, Y, Z ) && ( iTmp = CreateBusiness( 0, "Business", cost, type, X, Y, Z ) != ITER_NONE ) ) {
|
||||||
|
if ( IsPlayerConnected( targetid ) ) {
|
||||||
|
SaveToAdminLogFormatted( playerid, iTmp, "created business (business id %d) for %s (acc id %d, note id %d)", iTmp, ReturnPlayerName( targetid ), p_AccountID[ targetid ], noteid );
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[BUSINESS]"COL_WHITE" You have created a business in the name of %s(%d).", ReturnPlayerName( targetid ), targetid );
|
||||||
|
AddAdminLogLineFormatted( "%s(%d) has created a business for %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( targetid ), targetid );
|
||||||
|
} else {
|
||||||
|
SaveToAdminLogFormatted( playerid, iTmp, "created business (business id %d)", iTmp );
|
||||||
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[BUSINESS]"COL_WHITE" You have created a business." );
|
||||||
|
AddAdminLogLineFormatted( "%s(%d) has created a business", ReturnPlayerName( playerid ), playerid );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SendClientMessage( playerid, -1, ""COL_PINK"[BUSINESS]"COL_WHITE" Unable to create a business due to a unexpected error." );
|
SendClientMessage( playerid, -1, ""COL_PINK"[BUSINESS]"COL_WHITE" Unable to create a business due to a unexpected error." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendError( playerid, "This user does not have a V.I.P Business note." );
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +113,7 @@ CMD:createentrance( playerid, params[ ] )
|
|||||||
;
|
;
|
||||||
|
|
||||||
if ( p_AdminLevel[ playerid ] < 6 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
if ( p_AdminLevel[ playerid ] < 6 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
|
||||||
else if ( sscanf( params, "ufffdddds[32]", ownerid, toX, toY, toZ, interior, world, customInterior, vipOnly, label ) ) return SendUsage( playerid, "/createhouse [OWNER] [TO_X] [TO_Y] [TO_Z] [INTERIOR] [WORLD] [CUSTOM_INTERIOR] [VIP_ONLY] [LABEL]" );
|
else if ( sscanf( params, "ufffdddds[32]", ownerid, toX, toY, toZ, interior, world, customInterior, vipOnly, label ) ) return SendUsage( playerid, "/createentrance [OWNER] [TO_X] [TO_Y] [TO_Z] [INTERIOR] [WORLD] [CUSTOM_INTERIOR] [VIP_ONLY] [LABEL]" );
|
||||||
else if ( !IsPlayerConnected( ownerid ) || IsPlayerNPC( ownerid ) ) return SendError( playerid, "Invalid Player ID." );
|
else if ( !IsPlayerConnected( ownerid ) || IsPlayerNPC( ownerid ) ) return SendError( playerid, "Invalid Player ID." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -83,7 +124,7 @@ CMD:createentrance( playerid, params[ ] )
|
|||||||
entranceid = CreateEntrance( label, X, Y, Z, toX, toY, toZ, interior, world, customInterior > 0, vipOnly > 0 );
|
entranceid = CreateEntrance( label, X, Y, Z, toX, toY, toZ, interior, world, customInterior > 0, vipOnly > 0 );
|
||||||
|
|
||||||
if ( entranceid == -1 )
|
if ( entranceid == -1 )
|
||||||
return SendClientMessage( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" Unable to create a entrance due to a unexpected error." );
|
return SendClientMessage( playerid, -1, ""COL_PINK"[ENTRANCE]"COL_WHITE" Unable to create a entrance due to a unexpected error." );
|
||||||
|
|
||||||
SaveToAdminLog( playerid, entranceid, "created entrance" );
|
SaveToAdminLog( playerid, entranceid, "created entrance" );
|
||||||
g_entranceData[ entranceid ] [ E_SAVED ] = true;
|
g_entranceData[ entranceid ] [ E_SAVED ] = true;
|
||||||
@ -91,7 +132,7 @@ CMD:createentrance( playerid, params[ ] )
|
|||||||
format( szBigString, 256, "INSERT INTO `ENTRANCES` (`OWNER`, `LABEL`, `X`, `Y`, `Z`, `EX`, `EY`, `EZ`, `INTERIOR`, `WORLD`, `CUSTOM`, `VIP_ONLY`) VALUES ('%s','%s',%f,%f,%f,%f,%f,%f,%d,%d,%d,%d)", mysql_escape( ReturnPlayerName( ownerid ) ), mysql_escape( label ), X, Y, Z, toX, toY, toZ, interior, world, customInterior, vipOnly );
|
format( szBigString, 256, "INSERT INTO `ENTRANCES` (`OWNER`, `LABEL`, `X`, `Y`, `Z`, `EX`, `EY`, `EZ`, `INTERIOR`, `WORLD`, `CUSTOM`, `VIP_ONLY`) VALUES ('%s','%s',%f,%f,%f,%f,%f,%f,%d,%d,%d,%d)", mysql_escape( ReturnPlayerName( ownerid ) ), mysql_escape( label ), X, Y, Z, toX, toY, toZ, interior, world, customInterior, vipOnly );
|
||||||
mysql_single_query( szBigString );
|
mysql_single_query( szBigString );
|
||||||
|
|
||||||
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" You have created a entrance using id %d.", entranceid );
|
SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ENTRANCE]"COL_WHITE" You have created a entrance using id %d.", entranceid );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user