Merged modulize_houses into master

This commit is contained in:
Lorenc Pekaj 2018-09-10 18:42:10 +10:00
commit 9c5633d455
11 changed files with 1903 additions and 1813 deletions

View File

@ -12,9 +12,8 @@
#include "irresistible\cnr\global.pwn"
#include "irresistible\cnr\classes.pwn"
#include "irresistible\cnr\textdraws.pwn"
#include "irresistible\cnr\cities.pwn"
#include "irresistible\cnr\spawn.pwn"
#include "irresistible\cnr\dialog_ids.pwn"
#include "irresistible\cnr\vip.pwn"
// static cnr features
#include "irresistible\cnr\static\_cnr_static.pwn"

View File

@ -1,19 +0,0 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module: cities.inc
* Purpose: definitions of cities
*/
/* ** Configuration ** */
#define ENABLE_CITY_LV true
#define ENABLE_CITY_LS true
/* ** Definitions ** */
#define MAX_CITIES 3
#define CITY_SF 0
#define CITY_LV 1
#define CITY_LS 2
#define CITY_DESERTS 3
#define CITY_COUNTRY 4

View File

@ -8,10 +8,13 @@
/* ** Includes ** */
// core
#include "irresistible\cnr\features\vip.pwn"
#include "irresistible\cnr\features\irresistibleguard.pwn"
// other
#include "irresistible\cnr\features\fps.pwn"
#include "irresistible\cnr\features\radio.pwn"
#include "irresistible\cnr\features\cash_cards.pwn"
#include "irresistible\cnr\features\furniture.pwn"
#include "irresistible\cnr\features\weapon_drop.pwn"
#include "irresistible\cnr\features\ammunation.pwn"
#include "irresistible\cnr\features\duel.pwn"
@ -21,6 +24,9 @@
// #include "irresistible\cnr\features\fishing.pwn"
// #include "irresistible\cnr\features\vote.pwn"
// houses
#include "irresistible\cnr\features\houses\_houses.pwn"
// gangs and facilities
#include "irresistible\cnr\features\gangs\_gangs.pwn"

View File

@ -0,0 +1,10 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module: cnr\features\_features.pwn
* Purpose: encloses all feature modules & components (cnr)
*/
/* ** Includes ** */
#include "irresistible\cnr\features\houses\house.pwn"
#include "irresistible\cnr\features\houses\furniture.pwn"

View File

@ -1,18 +1,494 @@
/*
* Irresistible Gaming 2018
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module: static_cnr\furniture.inc
* Purpose: removals of static furniture objects in buildings or player interiors
* Module:
* Purpose:
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Definitions ** */
#define MAX_FURNITURE ( 50 )
// Furniture Categories
#define FC_DOORS 0
#define FC_TABLECHAIR 1
#define FC_FITNESS 2
#define FC_KITCHENBATH 3
#define FC_ELECTRONIC 4
#define FC_BEDROOM 5
#define FC_LOUNGE 6
#define FC_FLOWERS 7
#define FC_MISC 8
#define FC_WEAPONS 9
#define FC_HOLIDAYS 10
#define FC_FOODRINK 11
/* ** Variables ** */
enum E_FURINTURE_DATA
{
E_CATEGORY, E_NAME[ 21 ], E_MODEL,
E_COST
};
new
g_furnitureCategory[ ] [ ] =
{
{ "Doors" }, { "Tables and Chairs" }, { "Fitness" }, { "Kitchen and Bathroom" }, { "Electronics" }, { "Bedroom" },
{ "Lounge" }, { "Flowers and Plants" }, { "Miscellaneous" }, { "Weapons" }, { "Holiday" }, { "Food/Drink" }
},
g_houseFurniture[ ] [ E_FURINTURE_DATA ] =
{
// Doors
{ FC_DOORS, "Red Door", 1504, 175 },
{ FC_DOORS, "Blue Door", 1505, 175 },
{ FC_DOORS, "White Door", 1506, 175 },
{ FC_DOORS, "Yellow Door", 1507, 175 },
// Tables and Chairs
{ FC_TABLECHAIR, "Wooden Open Table", 1817, 50 },
{ FC_TABLECHAIR, "Dining Chair", 2079, 60 },
{ FC_TABLECHAIR, "Office Chair", 1806, 62 },
{ FC_TABLECHAIR, "Wooden Circle Table", 1815, 75 },
{ FC_TABLECHAIR, "Cluckin' Table Sml", 2763, 80 },
{ FC_TABLECHAIR, "Cluckin' Table", 2762, 125 },
{ FC_TABLECHAIR, "Dining Table", 2115, 135 },
{ FC_TABLECHAIR, "Circle Dining Chair", 2125, 135 },
{ FC_TABLECHAIR, "Circle Dining Table", 2030, 150 },
{ FC_TABLECHAIR, "Swivel Chair", 1663, 180 },
{ FC_TABLECHAIR, "Rocking Chair", 11734, 200 },
{ FC_TABLECHAIR, "Gamer Chair", 19999, 320 },
{ FC_TABLECHAIR, "Poker Table", 19474, 500 },
{ FC_TABLECHAIR, "Lab Table", 3383, 900 },
// Fitness
{ FC_FITNESS, "Mattress #1", 2815, 50 },
{ FC_FITNESS, "Mattress #2", 2817, 50 },
{ FC_FITNESS, "Mattress #3", 2833, 50 },
{ FC_FITNESS, "Mattress #4", 2836, 50 },
{ FC_FITNESS, "Mattress #5", 2847, 50 },
{ FC_FITNESS, "Cycle", 2630, 950 },
{ FC_FITNESS, "Treadmill", 2627, 1250 },
{ FC_FITNESS, "Weight Lifting", 2628, 1550 },
// Kitchen and Bathroom
{ FC_KITCHENBATH, "Soap", 19874, 15 },
{ FC_KITCHENBATH, "Toilet Paper", 19873, 20 },
{ FC_KITCHENBATH, "Towel holder", 11707, 300 },
{ FC_KITCHENBATH, "Double Metal Cabin", 2007, 400 },
{ FC_KITCHENBATH, "Metal Shelf x4", 2063, 400 },
{ FC_KITCHENBATH, "Metal Table", 941, 500 },
{ FC_KITCHENBATH, "Metal Counter", 937, 600 },
{ FC_KITCHENBATH, "Metal Bench-top", 936, 685 },
{ FC_KITCHENBATH, "Toilet", 2514, 700 },
{ FC_KITCHENBATH, "Bathroom Sink", 2523, 900 },
{ FC_KITCHENBATH, "Wooden Double Draw", 2139, 910 },
{ FC_KITCHENBATH, "Wooden Low-unit", 2138, 925 },
{ FC_KITCHENBATH, "Washing Machine", 1208, 925 },
{ FC_KITCHENBATH, "Laundry Unit", 2303, 980 },
{ FC_KITCHENBATH, "White Bath Tub", 2519, 1000 },
{ FC_KITCHENBATH, "Corner Wooden Bench", 2305, 1100 },
{ FC_KITCHENBATH, "Wooden Bench w/ Sink", 2136, 1185 },
{ FC_KITCHENBATH, "Stable Counter", 2339, 1200 },
{ FC_KITCHENBATH, "Bath Tub", 2526, 1200 },
{ FC_KITCHENBATH, "Shower System", 14481, 1290 },
{ FC_KITCHENBATH, "Stable Shelf", 2141, 1300 },
{ FC_KITCHENBATH, "Stable Sink", 2132, 1500 },
{ FC_KITCHENBATH, "Love Spa", 11732, 2000 },
{ FC_KITCHENBATH, "Cooker and Oven", 2135, 2200 },
{ FC_KITCHENBATH, "Deep Fryer", 2413, 2300 },
// Electronics
{ FC_ELECTRONIC, "Blender", 19830, 120 },
{ FC_ELECTRONIC, "Mini Stereo Speaker", 2233, 450 },
{ FC_ELECTRONIC, "Coffee Machine", 11743, 500 },
{ FC_ELECTRONIC, "Red Guitar", 19317, 650 },
{ FC_ELECTRONIC, "White Guitar", 19318, 675 },
{ FC_ELECTRONIC, "Bass speaker", 2229, 675 },
{ FC_ELECTRONIC, "Black Guitar", 19319, 700 },
{ FC_ELECTRONIC, "8 Bit TV", 1748, 700 },
{ FC_ELECTRONIC, "VCR Player", 1719, 900 },
{ FC_ELECTRONIC, "Gaming Console", 2028, 1000 },
{ FC_ELECTRONIC, "Small TV with VCR", 2595, 1100 },
{ FC_ELECTRONIC, "Laptop", 19893, 1250 },
{ FC_ELECTRONIC, "TV Small", 1518, 1575 },
{ FC_ELECTRONIC, "Swank TV", 1792, 1600 },
{ FC_ELECTRONIC, "TV with Wall Hook", 2596, 1790 },
{ FC_ELECTRONIC, "TV With Stance", 1717, 2000 },
{ FC_ELECTRONIC, "Doozy TV with Stance", 2224, 2050 },
{ FC_ELECTRONIC, "Stereo System", 2100, 2175 },
{ FC_ELECTRONIC, "Wide-screen TV", 1786, 2500 },
{ FC_ELECTRONIC, "Huge LCD", 19786, 3000 },
{ FC_ELECTRONIC, "Small TV Unit", 2297, 3700 },
{ FC_ELECTRONIC, "TV Unit", 2296, 4000 },
{ FC_ELECTRONIC, "PC with Desk", 2181, 4200 },
// Bedroom
{ FC_BEDROOM, "Wooden Stance", 1743, 650 },
{ FC_BEDROOM, "Wooden Counter", 1416, 750 },
{ FC_BEDROOM, "Wooden Drawer", 1417, 800 },
{ FC_BEDROOM, "Hobo bed", 1745, 800 },
{ FC_BEDROOM, "Luxurious bed", 2298, 1300 },
{ FC_BEDROOM, "Super Luxurious bed", 2563, 1750 },
{ FC_BEDROOM, "Lavish Red Bed", 11720, 2000 },
{ FC_BEDROOM, "Love Bed", 11731, 4200 },
// Lounge
{ FC_LOUNGE, "Wooden Couch", 1755, 275 },
{ FC_LOUNGE, "Couch", 1754, 350 },
{ FC_LOUNGE, "Leather Couch", 1702, 500 },
{ FC_LOUNGE, "Single Couch", 1704, 850 },
{ FC_LOUNGE, "Luxury Mattress", 1828, 900 },
{ FC_LOUNGE, "Bookshelf", 1742, 1000 },
{ FC_LOUNGE, "Leather Couch", 1723, 1650 },
{ FC_LOUNGE, "TV Stand", 2313, 1700 },
{ FC_LOUNGE, "Fireplace", 11724, 4800 },
{ FC_LOUNGE, "Chandelier", 19806, 5200 },
// Flowers and plants
{ FC_FLOWERS, "Flower Plant 3", 2001, 30 },
{ FC_FLOWERS, "Flower Plant 4", 2253, 35 },
{ FC_FLOWERS, "Clear Flower Vase", 2247, 35 },
{ FC_FLOWERS, "Painted Flower Vase", 2251, 40 },
{ FC_FLOWERS, "Plant Vase", 2245, 50 },
{ FC_FLOWERS, "Flower Wall-Mount", 3810, 120 },
{ FC_FLOWERS, "Weed Plant", 19473, 2250 },
// Miscellaneous
{ FC_MISC, "Chainsaw Dildo", 19086, 69 },
{ FC_MISC, "Massive Die", 1851, 80 },
{ FC_MISC, "Deer Head Mount", 1736, 120 },
{ FC_MISC, "Striped Surfboard", 2404, 140 },
{ FC_MISC, "Beach Surfboard", 2406, 150 },
{ FC_MISC, "Flamed Torch", 3461, 175 },
{ FC_MISC, "Rocking Unicorn", 11733, 180 },
{ FC_MISC, "Do Not Cross Tape", 19834, 250 },
{ FC_MISC, "Grill", 19831, 300 },
{ FC_MISC, "Boxing Bag", 1985, 300 },
{ FC_MISC, "Car Engine", 19917, 500 },
{ FC_MISC, "Drum Kit", 19609, 800 },
{ FC_MISC, "Mechanic Computer", 19903, 1000 },
{ FC_MISC, "Pool Table", 2964, 1250 },
{ FC_MISC, "Cow", 19833, 1337 },
{ FC_MISC, "Deer", 19315, 1337 },
{ FC_MISC, "Money Safe", 2332, 2000 },
{ FC_MISC, "Mechanic Shelves", 19899, 2000 },
{ FC_MISC, "Dance Floor", 19128, 3250 },
{ FC_MISC, "Craps Table", 1824, 4000 },
{ FC_MISC, "Boxing Arena", 14781, 15000 },
// Weapons
{ FC_WEAPONS, "Brass Knuckles", 331, 25 },
{ FC_WEAPONS, "Pool Cue", 338, 40 },
{ FC_WEAPONS, "Parachute", 371, 60 },
{ FC_WEAPONS, "Purple Dildo", 321, 69 },
{ FC_WEAPONS, "Sledge Hammer", 19631, 90 },
{ FC_WEAPONS, "Landmine", 19602, 100 },
{ FC_WEAPONS, "Ammo Box", 19832, 120 },
{ FC_WEAPONS, "Antique Sword", 19590, 250 },
{ FC_WEAPONS, "Mac 10", 352, 250 },
{ FC_WEAPONS, "Tec 9", 372, 290 },
{ FC_WEAPONS, "Rifle", 357, 300 },
{ FC_WEAPONS, "Desert Eagle", 348, 500 },
{ FC_WEAPONS, "Shotgun", 349, 600 },
{ FC_WEAPONS, "Sawn-off Shotgun", 350, 800 },
{ FC_WEAPONS, "Sniper", 358, 800 },
{ FC_WEAPONS, "Spas 12", 351, 900 },
{ FC_WEAPONS, "M4", 356, 900 },
{ FC_WEAPONS, "Minigun", 362, 1337 },
{ FC_WEAPONS, "Heatseeker", 360, 1337 },
{ FC_WEAPONS, "RPG", 359, 1337 },
// Holiday
{ FC_HOLIDAYS, "Xmas Box 1", 19054, 100 },
{ FC_HOLIDAYS, "Xmas Box 2", 19055, 100 },
{ FC_HOLIDAYS, "Xmas Box 3", 19056, 100 },
{ FC_HOLIDAYS, "Xmas Box 4", 19057, 100 },
{ FC_HOLIDAYS, "Xmas Box 5", 19058, 100 },
{ FC_HOLIDAYS, "Witch Pot", 19527, 200 },
{ FC_HOLIDAYS, "Devil Face", 11704, 666 },
{ FC_HOLIDAYS, "Xmas Tree", 19076, 777 },
// Food/Drink
{ FC_FOODRINK, "Pizza Box", 19571, 10 },
{ FC_FOODRINK, "Coffee Mug", 19835, 15 },
{ FC_FOODRINK, "Pizza", 19580, 30 },
{ FC_FOODRINK, "Ordinary Brandy", 19821, 45 },
{ FC_FOODRINK, "Fine Scotch", 19823, 90 },
{ FC_FOODRINK, "Beer Keg", 19812, 150 },
{ FC_FOODRINK, "Vintage Whiskey", 19824, 155 },
{ FC_FOODRINK, "Premium Brandy", 19820, 190 },
{ FC_FOODRINK, "Premium Wine", 19822, 220 }
},
g_houseFurnitureData [ MAX_HOUSES ] [ MAX_FURNITURE ],
Iterator: housefurniture [ MAX_HOUSES ] < MAX_FURNITURE >
;
/* ** Hooks ** */
hook OnPlayerConnect( playerid ) {
initializePlayerInteriors( playerid );
hook OnScriptInit( )
{
mysql_function_query( dbHandle, "SELECT * FROM `FURNITURE`", true, "OnFurnitureLoad", "" );
return 1;
}
/* ** Functions ** */
static stock initializePlayerInteriors( playerid )
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( dialogid == DIALOG_FURNITURE )
{
new houseid = p_InHouse[ playerid ];
if ( houseid == -1 )
return SendError( playerid, "You're not inside any house." );
if ( !IsPlayerHomeOwner( playerid, houseid ) )
return SendError( playerid, "You are not the owner of this house." );
if ( response )
{
switch( listitem )
{
case 0: ShowFurnitureCategory( playerid );
case 1: SendServerMessage( playerid, "You are now editing your furniture. Simply drag your mouse over a piece of furniture and click to edit." ), SelectObject( playerid );
case 2: ShowOwnedFurnitureList( playerid, houseid );
case 3:
{
new fhandle = ITER_NONE;
new i = GetClosestFurniture( houseid, playerid, .furniture_handle = fhandle );
if ( i == INVALID_OBJECT_ID || fhandle == ITER_NONE ) return SendError( playerid, "There are no nearby furniture." );
SetPVarInt( playerid, "furniture_house", houseid );
SetPVarInt( playerid, "furniture_id", fhandle );
ShowPlayerDialog( playerid, DIALOG_FURNITURE_OPTION, DIALOG_STYLE_LIST, "Furniture", "Use Editor\nEdit Rotation X\nEdit Rotation Y\nEdit Rotation Z\nSell Object", "Select", "Back" );
}
case 4: ShowPlayerDialog( playerid, DIALOG_TRUNCATE_FURNITURE, DIALOG_STYLE_MSGBOX, "Furniture", ""COL_WHITE"Are you sure you want to truncate your furniture?", "Confirm", "Back" );
}
}
else
{
if ( p_InHouse[ playerid ] != -1 ) return cmd_h( playerid, "config" );
return cmd_flat( playerid, "config" );
}
}
else if ( dialogid == DIALOG_TRUNCATE_FURNITURE )
{
if ( p_InHouse[ playerid ] == -1 )
return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) )
return SendError( playerid, "You are not the owner of this house." );
if ( response )
destroyAllFurniture( p_InHouse[ playerid ] );
return ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
}
else if ( dialogid == DIALOG_FURNITURE_CATEGORY )
{
if ( !response ) return ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
ShowFurnitureList( playerid, listitem );
p_FurnitureCategory{ playerid } = listitem;
}
else if ( dialogid == DIALOG_FURNITURE_MAN_SEL )
{
if ( response )
{
new houseid = p_InHouse[ playerid ];
if ( houseid == -1 )
return SendError( playerid, "You're not inside any house." );
if ( !IsPlayerHomeOwner( playerid, houseid ) )
return SendError( playerid, "You are not the owner of this house." );
new x = 0;
foreach ( new fhandle : housefurniture[ houseid ] )
{
new objectid = g_houseFurnitureData[ houseid ] [ fhandle ];
if ( IsValidDynamicObject( objectid ) )
{
if ( x == listitem )
{
SetPVarInt( playerid, "furniture_house", houseid );
SetPVarInt( playerid, "furniture_id", fhandle );
ShowPlayerDialog( playerid, DIALOG_FURNITURE_OPTION, DIALOG_STYLE_LIST, "Furniture", "Use Editor\nEdit Rotation X\nEdit Rotation Y\nEdit Rotation Z\nSell Object", "Select", "Back" );
break;
}
x++;
}
}
}
else ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
}
else if ( dialogid == DIALOG_FURNITURE_OPTION )
{
if ( !response )
return ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
new editing_house = GetPVarInt( playerid, "furniture_house" );
new editing_furniture = GetPVarInt( playerid, "furniture_id" );
new houseid = p_InHouse[ playerid ];
if ( houseid == -1 )
return SendError( playerid, "You're not inside any house." );
if ( houseid != editing_house )
return SendError( playerid, "There was an issue editing the furniture of this home, try again." );
if ( !IsPlayerHomeOwner( playerid, houseid ) )
return SendError( playerid, "You are not the owner of this house." );
new objectid = g_houseFurnitureData[ editing_house ] [ editing_furniture ];
new modelid = Streamer_GetIntData( STREAMER_TYPE_OBJECT, objectid, E_STREAMER_MODEL_ID );
switch( listitem )
{
case 0: EditDynamicObject( playerid, objectid );
case 1 .. 3:
{
p_FurnitureRotAxis{ playerid } = listitem;
ShowPlayerDialog( playerid, DIALOG_FURNITURE_ROTATION, DIALOG_STYLE_INPUT, "{FFFFFF}Furniture", "{FFFFFF}Input your axis' value below.", "Confirm", "Back" );
}
case 4:
{
new i = getFurnitureID( modelid );
if ( ! Iter_Count( housefurniture[ houseid ] ) )
return SendError( playerid, "There is no furniture left to sell." );
if ( i == -1 )
return SendError( playerid, "Unable to sell furniture due to an unexpected error (0x8F)." );
DestroyDynamicObject( objectid );
mysql_single_query( sprintf( "DELETE FROM `FURNITURE` WHERE `ID`=%d AND `HOUSE_ID`=%d", editing_furniture, editing_house ) );
new iNetProfit = floatround( g_houseFurniture[ i ] [ E_COST ] / 2 );
GivePlayerCash( playerid, iNetProfit );
SendClientMessageFormatted( playerid, -1, ""COL_GREY"[FURNITURE]"COL_WHITE" You have successfully sold your "COL_WHITE"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_houseFurniture[ i ] [ E_NAME ], number_format( iNetProfit ) );
ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
}
}
}
else if ( dialogid == DIALOG_FURNITURE_ROTATION )
{
new editing_house = GetPVarInt( playerid, "furniture_house" );
new editing_furniture = GetPVarInt( playerid, "furniture_id" );
new houseid = p_InHouse[ playerid ];
if ( houseid == -1 )
return SendError( playerid, "You're not inside any house." );
if ( houseid != editing_house )
return SendError( playerid, "There was an issue editing the furniture of this home, try again." );
if ( !IsPlayerHomeOwner( playerid, houseid ) )
return SendError( playerid, "You are not the owner of this house." );
new objectid = g_houseFurnitureData[ editing_house ] [ editing_furniture ];
if ( !response )
return ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
new Float: angle;
if ( sscanf( inputtext, "f", angle ) )
return ShowPlayerDialog( playerid, DIALOG_FURNITURE_ROTATION, DIALOG_STYLE_INPUT, "{FFFFFF}Furniture", "{FFFFFF}Input your axis' value below.\n\n"COL_RED"Invalid Value!", "Confirm", "Back" );
new Float: rotX, Float: rotY, Float: rotZ;
GetDynamicObjectRot( objectid, rotX, rotY, rotZ );
switch( p_FurnitureRotAxis{ playerid } )
{
case 1: SetDynamicObjectRot( objectid, angle, rotY, rotZ );
case 2: SetDynamicObjectRot( objectid, rotX, angle, rotZ );
case 3: SetDynamicObjectRot( objectid, rotX, rotY, angle );
}
GetDynamicObjectRot( objectid, rotX, rotY, rotZ ); // finalize
format( szBigString, sizeof( szBigString ), "UPDATE `FURNITURE` SET `RX`=%f,`RY`=%f,`RZ`=%f WHERE `ID`=%d AND `HOUSE_ID`=%d", rotX, rotY, rotZ, editing_furniture, editing_house );
mysql_single_query( szBigString );
SendServerMessage( playerid, "Furniture has been successfully updated." );
ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
}
else if ( dialogid == DIALOG_FURNITURE_LIST )
{
if ( !response ) return ShowFurnitureCategory( playerid );
new houseid = p_InHouse[ playerid ];
if ( houseid == -1 )
return SendError( playerid, "You're not inside any house." );
if ( !IsPlayerHomeOwner( playerid, houseid ) )
return SendError( playerid, "You are not the owner of this house." );
new vip_slots = 20 + ( p_VIPLevel[ playerid ] * 10 );
new total_furniture = Iter_Count( housefurniture[ houseid ] );
if ( total_furniture > vip_slots )
return SendError( playerid, "You have reached the maximum furniture limit of %d.", vip_slots );
for( new i, x = 0; i < sizeof( g_houseFurniture ); i++ )
{
if ( p_FurnitureCategory{ playerid } == g_houseFurniture[ i ] [ E_CATEGORY ] )
{
if ( x == listitem )
{
if ( GetPlayerCash( playerid ) < g_houseFurniture[ i ] [ E_COST ] )
{
ShowFurnitureList( playerid, p_FurnitureCategory{ playerid } );
return SendError( playerid, "You don't have enough money for this piece of furniture." );
}
new Float: X, Float: Y, Float: Z;
GetXYInFrontOfPlayer( playerid, X, Y, Z, 2.0 );
new fhandle = CreateFurniture( houseid, g_houseFurniture[ i ] [ E_MODEL ], X, Y, Z, 0.0, 0.0, 0.0, .creator = p_AccountID[ playerid ] );
if ( fhandle == ITER_NONE )
return SendError( playerid, "You do not have any more slots available to add furniture." );
GivePlayerCash( playerid, -g_houseFurniture[ i ] [ E_COST ] );
Streamer_Update( playerid ); // SyncObject( playerid );
SendServerMessage( playerid, "You have purchased a "COL_GREY"%s"COL_WHITE". "COL_ORANGE"[%d/%d]", g_houseFurniture[ i ] [ E_NAME ], total_furniture + 1, vip_slots );
ShowFurnitureList( playerid, p_FurnitureCategory{ playerid } );
break;
}
x ++;
}
}
}
return 1;
}
hook OnPlayerSelectDynObject( playerid, objectid, modelid, Float:x, Float:y, Float:z )
{
new houseid = p_InHouse[ playerid ];
if ( houseid == -1 )
return SendError( playerid, "You're not inside any house." );
if ( ! IsPlayerHomeOwner( playerid, houseid ) )
return SendError( playerid, "You are not the owner of this house." );
if ( isFurnitureObject( modelid ) )
{
new fhandle;
// check the handle of the modelid
foreach ( fhandle : housefurniture[ houseid ] ) {
new furniture_model = Streamer_GetIntData( STREAMER_TYPE_OBJECT, g_houseFurnitureData[ houseid ] [ fhandle ], E_STREAMER_MODEL_ID );
if ( furniture_model == modelid ) break;
}
// notify
if ( fhandle != ITER_NONE ) {
SetPVarInt( playerid, "furniture_house", houseid );
SetPVarInt( playerid, "furniture_id", fhandle );
ShowPlayerDialog( playerid, DIALOG_FURNITURE_OPTION, DIALOG_STYLE_LIST, "Furniture", "Use Editor\nEdit Rotation X\nEdit Rotation Y\nEdit Rotation Z\nSell Object", "Select", "Back" );
}
else SendError( playerid, "This furniture item cannot be edited as its model is unrecogized in the house." );
}
CancelEdit( playerid );
return 1;
}
hook OnPlayerConnect( playerid )
{
//Katie - 271.884979,306.631988,999.148437 - DEFAULT - 2
RemoveBuildingForPlayer( playerid, 2251, 266.4531, 303.3672, 998.9844, 0.25 );
@ -492,3 +968,274 @@ static stock initializePlayerInteriors( playerid )
RemoveBuildingForPlayer( playerid, 1742, -2160.3906, 647.3906, 1056.5859, 0.25 );
RemoveBuildingForPlayer( playerid, 1738, -2158.3906, 647.0859, 1057.2344, 0.25 );
}
/* ** SQL Threads ** */
thread OnFurnitureLoad( )
{
new rows, i = -1;
new loadingTick = GetTickCount( );
cache_get_data( rows, tmpVariable );
if ( rows )
{
while( ++i < rows )
{
new fhandle = CreateFurniture(
cache_get_field_content_int( i, "HOUSE_ID", dbHandle ),
cache_get_field_content_int( i, "MODEL", dbHandle ),
cache_get_field_content_float( i, "X", dbHandle ),
cache_get_field_content_float( i, "Y", dbHandle ),
cache_get_field_content_float( i, "Z", dbHandle ),
cache_get_field_content_float( i, "RX", dbHandle ),
cache_get_field_content_float( i, "RY", dbHandle ),
cache_get_field_content_float( i, "RZ", dbHandle ),
cache_get_field_content_int( i, "ID", dbHandle ),
.creator = -1
);
if ( fhandle == ITER_NONE ) printf( "[FURNITURE ERROR] Too much furniture created for house id %d.", fhandle );
}
}
printf( "[FURNITURE]: %d objects have been loaded. (Tick: %dms)", i, GetTickCount( ) - loadingTick );
return 1;
}
/* ** Functions ** */
stock CreateFurniture( houseid, modelid, Float: x, Float: y, Float: z, Float: rx, Float: ry, Float: rz, fhandle = ITER_NONE, creator = 0 )
{
if ( ! ( 0 <= houseid < MAX_HOUSES ) )
return ITER_NONE;
if ( fhandle == ITER_NONE ) // find free slot if not preloaded
fhandle = Iter_Free( housefurniture[ houseid ] );
if ( fhandle != ITER_NONE )
{
// insert into iterator
Iter_Add( housefurniture[ houseid ], fhandle );
g_houseFurnitureData[ houseid ] [ fhandle ] = CreateDynamicObject( modelid, x, y, z, rx, ry, rz, houseid + MAX_HOUSES );
// insert into database
if ( creator >= 0 )
{
format( szBigString, sizeof ( szBigString ), "INSERT INTO `FURNITURE`(`ID`,`HOUSE_ID`,`OWNER`,`MODEL`,`X`,`Y`,`Z`,`RX`,`RY`,`RZ`) VALUES (%d,%d,%d,%d,%f,%f,%f,%f,%f,%f)", fhandle, houseid, creator, modelid, x, y, z, rx, ry, rz );
mysql_single_query( szBigString );
}
}
return fhandle;
}
stock isFurnitureObject( modelid )
{
for( new i = 0; i < sizeof( g_houseFurniture ); i++ )
if ( g_houseFurniture[ i ] [ E_MODEL ] == modelid )
return true;
return false;
}
stock destroyAllFurniture( houseid )
{
if ( ! Iter_Contains( houses, houseid ) )
return 0;
foreach ( new fhandle : housefurniture[ houseid ] ) {
DestroyDynamicObject( g_houseFurnitureData[ houseid ] [ fhandle ] ), g_houseFurnitureData[ houseid ] [ fhandle ] = -1;
Iter_SafeRemove( housefurniture[ houseid ], fhandle, fhandle );
}
mysql_single_query( sprintf( "DELETE FROM `FURNITURE` WHERE `HOUSE_ID`=%d", houseid ) );
return 1;
}
stock getFurnitureID( modelid )
{
for( new i = 0; i < sizeof( g_houseFurniture ); i++ )
if ( modelid == g_houseFurniture[ i ] [ E_MODEL ] ) return i;
return -1;
}
stock ShowOwnedFurnitureList( playerid, houseid )
{
if ( Iter_Count( housefurniture[ houseid ] ) > 0 )
{
szLargeString = ""COL_WHITE"Furniture Item\n";
foreach ( new fhandle : housefurniture[ houseid ] ) {
new modelid = Streamer_GetIntData( STREAMER_TYPE_OBJECT, g_houseFurnitureData[ houseid ] [ fhandle ], E_STREAMER_MODEL_ID );
new furniture_item = getFurnitureID( modelid );
if ( furniture_item != -1 ) {
format( szLargeString, sizeof( szLargeString ), "%s%s\n", szLargeString, g_houseFurniture[ furniture_item ] [ E_NAME ] );
} else {
strcat( szLargeString, "Unknown\n" );
}
}
ShowPlayerDialog( playerid, DIALOG_FURNITURE_MAN_SEL, DIALOG_STYLE_TABLIST_HEADERS, "Furniture", szLargeString, "Select", "Back" );
}
else
{
SendError( playerid, "You don't own any furniture." );
ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
}
}
stock ShowFurnitureCategory( playerid )
{
static
szCategory[ 148 ];
if ( szCategory[ 0 ] == '\0' )
{
for( new i = 0; i < sizeof( g_furnitureCategory ); i++ )
format( szCategory, sizeof( szCategory ), "%s%s\n", szCategory, g_furnitureCategory[ i ] );
}
ShowPlayerDialog( playerid, DIALOG_FURNITURE_CATEGORY, DIALOG_STYLE_LIST, "Furniture", szCategory, "Select", "Back" );
return 1;
}
stock ShowFurnitureList( playerid, category )
{
szLargeString = ""COL_WHITE"Furniture\t"COL_WHITE"Cost\n";
for( new i = 0; i < sizeof( g_houseFurniture ); i++ ) if ( g_houseFurniture[ i ] [ E_CATEGORY ] == category )
format( szLargeString, sizeof( szLargeString ), "%s%s\t"COL_GOLD"%s\n", szLargeString, g_houseFurniture[ i ] [ E_NAME ], number_format( g_houseFurniture[ i ] [ E_COST ] ) );
ShowPlayerDialog( playerid, DIALOG_FURNITURE_LIST, DIALOG_STYLE_TABLIST_HEADERS, "Furniture", szLargeString, "Select", "Back" );
}
stock GetClosestFurniture( houseid, playerid, &Float: dis = 99999.99, &furniture_handle = ITER_NONE )
{
new
Float: dis2,
object = INVALID_OBJECT_ID,
Float: X, Float: Y, Float: Z
;
foreach ( new fhandle : housefurniture[ houseid ] )
{
new objectid = g_houseFurnitureData[ houseid ] [ fhandle ];
if ( IsValidDynamicObject( objectid ) )
{
GetDynamicObjectPos( objectid, X, Y, Z );
dis2 = GetPlayerDistanceFromPoint( playerid, X, Y, Z );
if ( dis2 < dis && dis2 != -1.00 ) {
dis = dis2;
object = objectid;
furniture_handle = fhandle;
}
}
}
return object;
}
stock FillHomeWithFurniture( houseid, interior_id ) {
if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Cattus Interior" ) ) {
CreateFurniture( houseid, 2181, 273.795989, 304.962005, 998.148010, 0.000000, 0.000000, -90.000000 );
CreateFurniture( houseid, 19317, 273.561004, 307.549011, 998.896972, -8.899999, 0.000000, -44.599998 );
CreateFurniture( houseid, 1745, 269.713012, 305.380004, 998.057983, 0.000000, 0.000000, 0.000000 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Assum Interior" ) ) {
CreateFurniture( houseid, 1745, 246.465103, 302.465484, 998.127441, 0.000000, 0.000000, -90.000000 );
CreateFurniture( houseid, 1717, 244.388854, 301.269592, 998.117431, 0.000000, 0.000000, 47.600032 );
CreateFurniture( houseid, 1742, 250.075302, 305.350036, 998.127441, 0.000000, 0.000000, -90.000000 );
CreateFurniture( houseid, 349, 248.876480, 302.361389, 998.922302, -95.399993, 0.000000, 0.000000 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Fossor Interior" ) ) {
CreateFurniture( houseid, 11720, 2210.785888, -1072.437988, 1049.422973, 0.000000, 0.000000, -90.000000 );
CreateFurniture( houseid, 2100, 2214.089111, -1078.663940, 1049.483032, 0.000000, 0.000000, 180.000000 );
CreateFurniture( houseid, 19317, 2212.149902, -1072.442993, 1051.865966, 0.000000, -45.000000, -90.000000 );
CreateFurniture( houseid, 19317, 2212.149902, -1072.442993, 1051.865966, 0.000000, 45.000000, -90.000000 );
}
/*else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Angusto Interior" ) ) {
CreateFurniture( houseid, 11743, 265.862518, 1290.442016, 1080.305175, 0.000000, 0.000000, 180.000000 );
}*/
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Organum Interior" ) ) {
CreateFurniture( houseid, 2297, 308.390014, 300.296997, 1002.294006, 0.000000, 0.000000, 135.000000 );
CreateFurniture( houseid, 1754, 308.322998, 303.714996, 1002.304016, 0.000000, 0.000000, -15.600000 );
CreateFurniture( houseid, 1754, 306.437988, 303.539001, 1002.304016, 0.000000, 0.000000, 33.099998 );
CreateFurniture( houseid, 19631, 303.839996, 302.459014, 1002.731994, 70.099998, 93.000000, 94.300003 );
}
/*else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Bulbus Interior" ) ) {
CreateFurniture( houseid, 19893, -69.010528, 1362.585815, 1079.770507, 0.000000, 0.000000, -110.200012 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Vindemia Interior" ) ) {
CreateFurniture( houseid, 1518, 292.440887, 1472.344360, 1080.087646, 0.000000, 0.000000, 180.000000 );
CreateFurniture( houseid, 1748, 288.720428, 1490.140014, 1079.787353, 0.000000, 0.000000, 45.699871 );
CreateFurniture( houseid, 19893, 302.293579, 1475.090209, 1079.957519, 0.000000, 0.000000, -160.199905 );
}*/
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Aurora Interior" ) ) {
CreateFurniture( houseid, 1828, -2165.865966, 644.096984, 1056.583007, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 11743, -2162.052978, 637.107971, 1057.515991, 0.000000, 0.000000, 129.699996 );
CreateFurniture( houseid, 19830, -2158.127929, 637.051025, 1057.505981, 0.000000, 0.000000, -147.300003 );
CreateFurniture( houseid, 19893, -2161.440917, 643.953002, 1057.384033, 0.000000, 0.000000, -85.699996 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Fragor Interior" ) ) {
CreateFurniture( houseid, 2563, 307.286010, 1121.037963, 1082.881958, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 2313, 318.532989, 1124.858032, 1082.871948, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 1786, 319.161987, 1125.123046, 1083.342041, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 1828, 323.757995, 1129.447021, 1082.871948, 0.000000, 0.000000, 90.000000 );
}
/*else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Mundus Interior" ) ) {
CreateFurniture( houseid, 19893, 26.778570, 1347.625488, 1088.554687, 0.000000, 0.000000, 124.699920 );
CreateFurniture( houseid, 356, 31.855621, 1346.810668, 1083.904663, 85.500068, -65.499977, -2.500000 );
}*/
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Artus Interior" ) ) {
CreateFurniture( houseid, 19786, 2242.808105, -1065.896972, 1049.543945, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 2313, 2242.090087, -1066.394042, 1048.050048, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 1702, 2243.757080, -1069.983032, 1047.969970, 0.000000, 0.000000, 180.000000 );
CreateFurniture( houseid, 1704, 2244.997070, -1067.770996, 1047.969970, 0.000000, 0.000000, -102.800003 );
CreateFurniture( houseid, 1704, 2240.719970, -1068.850952, 1047.969970, 0.000000, 0.000000, 95.699996 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Caelum Interior" ) ) {
CreateFurniture( houseid, 11720, 2230.312988, -1106.276000, 1049.852050, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 2100, 2235.194091, -1110.384033, 1049.881958, 0.000000, 0.000000, -90.000000 );
CreateFurniture( houseid, 321, 2230.624023, -1107.496948, 1049.881958, 90.000000, 90.000000, 0.000000 );
CreateFurniture( houseid, 362, 2226.039062, -1110.713012, 1050.806030, 0.000000, -5.199999, 0.000000 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Rotta Interior" ) ) {
CreateFurniture( houseid, 11743, 2501.027099, -1707.707031, 1014.861999, 0.000000, 0.000000, -91.699996 );
CreateFurniture( houseid, 2181, 2492.664062, -1704.439941, 1013.742004, 0.000000, 0.000000, 180.000000 );
CreateFurniture( houseid, 1717, 2492.029052, -1694.394042, 1013.786987, 0.000000, 0.000000, -36.900001 );
CreateFurniture( houseid, 1755, 2494.482910, -1695.970947, 1013.721984, 0.000000, 0.000000, -124.000000 );
CreateFurniture( houseid, 1755, 2492.474121, -1696.670043, 1013.721984, 0.000000, 0.000000, 160.500000 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Ascensor Interior" ) ) {
CreateFurniture( houseid, 19786, 2325.875000, -1017.260986, 1051.161987, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 1743, 2325.341064, -1018.752990, 1049.219970, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 1828, 2325.969970, -1022.057983, 1049.189941, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 11720, 2324.851074, -1008.127014, 1053.727050, 0.000000, 0.000000, 0.000000 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Colonel Interior" ) ) {
CreateFurniture( houseid, 2100, 2810.426025, -1164.852050, 1024.578979, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 2297, 2812.813964, -1171.582031, 1024.578979, 0.000000, 0.000000, -135.000000 );
CreateFurniture( houseid, 1704, 2810.127929, -1171.822021, 1024.548950, 0.000000, 0.000000, 72.099998 );
CreateFurniture( houseid, 1745, 2817.600097, -1167.550048, 1028.151000, 0.000000, 0.000000, 180.000000 );
CreateFurniture( houseid, 19319, 2817.147949, -1171.015991, 1030.425048, 0.000000, 45.000000, 180.000000 );
}
/*else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Godfather Interior" ) ) {
CreateFurniture( houseid, 358, 150.524795, 1370.906127, 1083.410156, -78.500221, 37.299991, -99.299461 );
}*/
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Recens Interior" ) ) {
CreateFurniture( houseid, 2229, 2257.180908, -1221.848999, 1048.001953, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 2181, 2257.602050, -1224.232055, 1047.991943, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 19318, 2258.295898, -1219.160034, 1048.699951, -10.199999, 0.000000, 0.000000 );
CreateFurniture( houseid, 357, 2262.698974, -1225.001953, 1048.322998, 0.000000, -90.000000, 0.000000 );
CreateFurniture( houseid, 19832, 2262.360107, -1224.750976, 1048.021972, 0.000000, 0.000000, -24.799999 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Novus Interior" ) ) {
CreateFurniture( houseid, 1745, 2364.553955, -1122.925048, 1049.864013, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 2100, 2363.528076, -1129.816040, 1049.874023, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 1416, 2374.649902, -1132.967041, 1050.415039, 0.000000, 0.000000, -90.000000 );
CreateFurniture( houseid, 372, 2374.791015, -1133.095947, 1050.974975, 90.000000, 90.000000, 0.000000 );
CreateFurniture( houseid, 372, 2374.615966, -1133.433959, 1050.974975, 90.000000, 90.000000, -27.100000 );
}
else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Securuse Interior" ) ) {
CreateFurniture( houseid, 1745, 2311.577880, -1139.357055, 1053.293945, 0.000000, 0.000000, 180.000000 );
CreateFurniture( houseid, 2181, 2310.585937, -1135.288940, 1053.303955, 0.000000, 0.000000, 0.000000 );
CreateFurniture( houseid, 1702, 2322.388916, -1141.819946, 1049.468994, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 1702, 2326.492919, -1139.828002, 1049.468994, 0.000000, 0.000000, -90.000000 );
CreateFurniture( houseid, 1742, 2318.163085, -1140.253051, 1049.708984, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 1742, 2318.163085, -1141.673950, 1049.708984, 0.000000, 0.000000, 90.000000 );
CreateFurniture( houseid, 2100, 2328.367919, -1137.057006, 1049.489013, 0.000000, 0.000000, 0.000000 );
}
// else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Lorem Interior" ) )
// else if ( strmatch( g_houseInteriors[ interior_id ] [ E_NAME ], "Domus Interior" ) )
}

View File

@ -0,0 +1,858 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module:
* Purpose:
*/
/* ** Error checking ** */
#if !defined __sfcnr__houses
#define __sfcnr__houses
#endif
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Definitions ** */
#define MAX_HOUSES ( 2000 )
#define MAX_HOUSE_WEAPONS ( 7 ) // (do not change)
#define HOUSE_MAPICON_RADIUS ( 25.0 )
#define H_DEFAULT_X 266.4996
#define H_DEFAULT_Y 304.9577
#define H_DEFAULT_Z 999.1484
#define PROGRESS_BRUTEFORCE 1
/* ** Macros ** */
#define IsPlayerHomeOwner(%0,%1) ( strmatch( g_houseData[ %1 ] [ E_OWNER ], ReturnPlayerName( %0 ) ) )
/* ** Variables ** */
enum E_HOUSE_DATA
{
E_OWNER[ 24 ], E_HOUSE_NAME[ 30 ],
Float: E_EX, Float: E_EY, Float: E_EZ,
Float: E_TX, Float: E_TY, Float: E_TZ,
E_COST, E_INTERIOR_ID, E_CHECKPOINT[ 2 ],
E_WORLD, Text3D: E_LABEL [ 2 ], E_PASSWORD[ 5 ],
bool: E_CRACKED, bool: E_BEING_CRACKED, E_CRACKED_TS,
E_CRACKED_WAIT, E_MAP_ICON
};
enum E_HINTERIOR_DATA
{
E_NAME[ 19 ], Float: E_EX, Float: E_EY,
Float: E_EZ, E_INTERIOR_ID, E_COST,
bool: E_VIP, Float: E_PREVIEW_POS[ 3 ], Float: E_PREVIEW_LOOKAT[ 3 ]
};
new
g_houseInteriors[ ] [ E_HINTERIOR_DATA ] =
{
{ "Cattus Interior", H_DEFAULT_X, H_DEFAULT_Y, H_DEFAULT_Z, 2, 0, false, { 266.60010, 302.42820, 999.14840 }, { 271.44260, 306.64240, 999.15580 } },
{ "Assum Interior", 243.71980, 304.963500, 999.14840, 1, 10000, false, { 249.61870, 300.89080, 999.14840 }, { 244.85410, 305.49680, 999.14840 } },
{ "Fossor Interior", 2218.4036, -1076.2621, 1050.4844, 1, 15000, false, { 2202.6704, -1078.198, 1050.4844 }, { 2211.8030, -1074.362, 1050.4844 } },
//{ "Angusto Interior", 260.98790, 1284.29470, 1080.2578, 4, 20000, false, { 253.80180, 1294.2167, 1080.2578 }, { 258.55260, 1288.3639, 1080.2578 } },
{ "Organum Interior", 309.37170, 311.674700, 1003.3047, 4, 25000, false, { 310.13720, 310.80550, 1003.3047 }, { 300.02930, 300.86170, 1003.5391 } },
//{ "Bulbus Interior", -68.84510, 1351.19570, 1080.2109, 6, 25000, false, { -71.41990, 1366.0359, 1080.2185 }, { -64.59070, 1360.7052, 1080.2185 } },
//{ "Vindemia Interior", 295.08510, 1472.25520, 1080.2578, 15, 25000, false, { 290.14430, 1488.8372, 1080.2578 }, { 294.96960, 1483.6603, 1080.2578 } },
{ "Aurora Interior", -2170.344, 639.502500, 1052.3750, 1, 30000, false, { -2168.073, 646.40000, 1057.5938 }, { -2158.598, 638.13010, 1057.5861 } },
{ "Fragor Interior", 318.58580, 1114.47920, 1083.8828, 5, 35000, false, { 326.31450, 1117.5468, 1083.8828 }, { 317.28550, 1122.6113, 1083.8828 } },
//{ "Mundus Interior", 24.012500, 1340.15890, 1084.3750, 10, 40000, false, { 19.801100, 1340.7814, 1084.3750 }, { 34.253800, 1342.9272, 1084.3750 } },
{ "Artus Interior", 2237.5259, -1081.6458, 1049.0234, 2, 40000, false, { 2236.2290, -1081.065, 1049.0234 }, { 2244.2285, -1069.357, 1049.0234 } },
{ "Caelum Interior", 2233.6931, -1115.2620, 1050.8828, 5, 40000, false, { 2235.1128, -1114.911, 1050.8828 }, { 2229.8982, -1105.175, 1050.8903 } },
{ "Rotta Interior", 2495.9663, -1692.0857, 1014.7422, 3, 50000, false, { 2491.1794, -1694.953, 1014.7461 }, { 2497.4587, -1704.258, 1014.7422 } },
{ "Ascensor Interior", 2317.8369, -1026.7662, 1050.2178, 9, 50000, false, { 2320.9111, -1025.776, 1050.2109 }, { 2319.0242, -1014.091, 1050.2109 } },
{ "Colonel Interior", 2807.5693, -1174.7520, 1025.5703, 8, 60000, false, { 2812.0911, -1173.043, 1025.5703 }, { 2806.0210, -1165.486, 1025.5703 } },
//{ "Godfather Interior", 140.28170, 1365.92150, 1083.8594, 5, 65000, false, { 135.53440, 1366.6400, 1083.8615 }, { 143.49590, 1375.7461, 1083.8668 } },
{ "Recens Interior", 2270.4192, -1210.5172, 1047.5625, 10, 70000, false, { 2248.2854, -1207.207, 1049.0234 }, { 2261.0574, -1213.011, 1049.0234 } },
{ "Novus Interior", 2365.2341, -1135.5957, 1050.8826, 8, 72000, false, { 2375.3567, -1121.340, 1050.8750 }, { 2367.7095, -1130.863, 1050.8826 } },
{ "Securuse Interior", 2324.3826, -1149.5442, 1050.7101, 12, 80000, false, { 2317.5684, -1136.016, 1054.3047 }, { 2333.1262, -1147.694, 1050.7031 } },
//{ "Lorem Interior", 234.13900, 1063.72110, 1084.2123, 6, 82500, false, { 235.83530, 1070.2394, 1084.1903 }, { 226.63560, 1073.0388, 1086.2266 } },
//{ "Domus Interior", 225.73480, 1021.44500, 1084.0177, 7, 120000, false, { 224.76680, 1022.3558, 1084.0150 }, { 241.65380, 1037.2081, 1084.0118 } },
{ "Madd Doggs Mansion", 1260.6455, -785.46530, 1091.9063, 5, 1337, true , { 1262.1033, -772.6712, 1091.9063 }, { 1282.7361, -783.5193, 1089.9375 } },
{ "Butcher Interior", 964.93310, 2160.13210, 1011.0303, 1, 1337, true , { 933.67050, 2118.9556, 1012.8329 }, { 947.38930, 2163.8730, 1011.0234 } },
{ "Bar Interior", 501.93780, -67.563000, 998.75780, 11, 1337, true , { 511.80380, -68.01930, 999.25000 }, { 490.78870, -78.92080, 998.75780 } },
{ "Casino Interior", 1133.1831, -15.833100, 1000.6797, 12, 1337, true , { 1114.8433, -12.31790, 1003.0643 }, { 1136.3059, 2.6477000, 1000.6797 } }
},
g_houseData [ MAX_HOUSES ] [ E_HOUSE_DATA ],
Iterator: houses < MAX_HOUSES >,
szg_houseInteriors [ 24 * sizeof( g_houseInteriors ) ],
g_HouseWeapons [ MAX_HOUSES ] [ MAX_HOUSE_WEAPONS ],
g_HouseWeaponAmmo [ MAX_HOUSES ] [ MAX_HOUSE_WEAPONS ],
p_InHouse [ MAX_PLAYERS ]
;
/* ** Hooks ** */
hook OnScriptInit( )
{
// load all house interiors into a string once
for( new i = 0; i < sizeof( g_houseInteriors ); i++ ) {
format( szg_houseInteriors, sizeof( szg_houseInteriors ), "%s%s%s\n", szg_houseInteriors, g_houseInteriors[ i ] [ E_VIP ] ? ( COL_GOLD ) : "", g_houseInteriors[ i ] [ E_NAME ] );
}
// load all houses
mysql_function_query( dbHandle, "SELECT * FROM `HOUSES`", true, "OnHouseLoad", "" );
return 1;
}
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( dialogid == DIALOG_HOUSE_CONFIG && response )
{
if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
DeletePVar( playerid, "gate_edititem" ); // Definitely not in the gate dialog lol
switch( listitem )
{
case 0: ShowPlayerDialog( playerid, DIALOG_HOUSE_TITLE, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Title", ""COL_WHITE"Input the house title you want to change with:", "Confirm", "Back" );
case 1: ShowPlayerDialog( playerid, DIALOG_HOUSE_INTERIORS, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", szg_houseInteriors, "Select", "Back" );
case 2: ShowPlayerDialog( playerid, DIALOG_HOUSE_SET_PW, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Password", ""COL_WHITE"Enter your desired house password below.\n\n"COL_GREY"Note:"COL_WHITE" You can disable it by typing \"N/A\" (without the quotation marks).", "Confirm", "Back" );
case 3: ShowHouseWeaponStorage( playerid );
case 4: ShowPlayerDialog( playerid, DIALOG_FURNITURE, DIALOG_STYLE_LIST, "{FFFFFF}Furniture", "Purchase Furniture\nSelect Furniture Easily\nSelect Furniture Manually\nSelect Furniture Nearest\n"COL_RED"Remove All Furniture", "Confirm", "Back" );
}
}
else if ( dialogid == DIALOG_HOUSE_WEAPONS )
{
if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." );
if ( response )
{
if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
if ( g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] != 0 )
{
GivePlayerWeapon( playerid, g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ], g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] );
SendServerMessage( playerid, "You have withdrawn your "COL_GREY"%s"COL_WHITE" with %d ammo.", ReturnWeaponName( g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] ), g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] );
g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] = 0;
g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] = -1;
SaveHouseWeaponStorage( p_InHouse[ playerid ] );
ShowHouseWeaponStorage( playerid );
}
else
{
if ( listitem > 2 && p_VIPLevel[ playerid ] < VIP_REGULAR ) return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
p_HouseWeaponAddSlot{ playerid } = listitem;
ShowPlayerDialog( playerid, DIALOG_HOUSE_WEAPONS_ADD, DIALOG_STYLE_MSGBOX, "{FFFFFF}House Weapon Storage", "{FFFFFF}Would you like to insert your current weapon into this slot?", "Insert", "Back" );
}
}
else cmd_h( playerid, "config" );
}
else if ( dialogid == DIALOG_HOUSE_WEAPONS_ADD )
{
if ( response )
{
if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this while you're in jail." );
if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
if ( IsMeleeWeapon( GetPlayerWeapon( playerid ) ) )
{
SendError( playerid, "You cannot insert melee weapons." );
cmd_h( playerid, "config" );
return 1;
}
new current_weapon = GetPlayerWeapon( playerid );
new current_ammo = GetPlayerAmmo( playerid );
if ( ( 16 <= current_weapon <= 18 ) || current_weapon == 35 ) {
SendError( playerid, "You cannot store this weapon." );
cmd_h( playerid, "config" );
return 1;
}
if ( current_ammo > 0x7FFF || current_ammo <= 0 ) current_ammo = 0x7FFF;
listitem = p_HouseWeaponAddSlot{ playerid };
g_HouseWeapons[ p_InHouse[ playerid ] ] [ listitem ] = current_weapon;
g_HouseWeaponAmmo[ p_InHouse[ playerid ] ] [ listitem ] = current_ammo;
SendServerMessage( playerid, "You have inserted your "COL_GREY"%s"COL_WHITE" into your weapon storage.", ReturnWeaponName( current_weapon ) );
RemovePlayerWeapon( playerid, current_weapon );
SaveHouseWeaponStorage( p_InHouse[ playerid ] );
ShowHouseWeaponStorage( playerid );
}
else ShowHouseWeaponStorage( playerid );
}
else if ( dialogid == DIALOG_HOUSE_SET_PW )
{
if ( response )
{
if ( p_InHouse[ playerid ] == -1 ) return SendError( playerid, "You're not inside any house." );
else if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
else if ( !strlen( inputtext ) || strlen( inputtext ) > 4 )
{
SendError( playerid, "Your password must vary between 0 and 4 characters." );
ShowPlayerDialog( playerid, DIALOG_HOUSE_SET_PW, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Password", ""COL_WHITE"Enter your desired house password below.\n\n"COL_GREY"Note:"COL_WHITE" You can disable it by typing \"N/A\" or \"NULL\" (without the quotation marks).", "Confirm", "Back" );
}
else if ( strmatch( inputtext, "N/A" ) || strmatch( inputtext, "NULL" ) )
{
format( g_houseData[ p_InHouse[ playerid ] ] [ E_PASSWORD ], 4, "N/A" );
SendServerMessage( playerid, "You have successfully disabled your house's password." );
format( szNormalString, 60, "UPDATE `HOUSES` SET `PASSWORD`='N/A' WHERE `ID`=%d", p_InHouse[ playerid ] );
mysql_single_query( szNormalString );
cmd_h( playerid, "config" );
}
else
{
SendServerMessage( playerid, "You have changed your house password to "COL_GREY"%s"COL_WHITE".", inputtext );
format( g_houseData[ p_InHouse[ playerid ] ] [ E_PASSWORD ], 5, "%s", inputtext );
format( szNormalString, 60, "UPDATE `HOUSES` SET `PASSWORD`='%s' WHERE `ID`=%d", mysql_escape( inputtext ), p_InHouse[ playerid ] );
mysql_single_query( szNormalString );
cmd_h( playerid, "config" );
}
}
else cmd_h( playerid, "config" );
}
else if ( dialogid == DIALOG_HOUSE_INTERIORS )
{
if ( response )
{
if ( p_InHouse[ playerid ] == -1 )
return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) )
return SendError( playerid, "You are not the owner of this house." );
p_ViewingInterior{ playerid } = listitem;
ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" );
}
else cmd_h( playerid, "config" );
}
else if ( dialogid == DIALOG_HOUSE_INT_CONFIRM )
{
if ( response )
{
if ( p_InHouse[ playerid ] == -1 )
return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) )
return SendError( playerid, "You are not the owner of this house." );
new
intid = p_ViewingInterior{ playerid };
switch( listitem )
{
case 0:
{
if ( g_houseInteriors[ intid ] [ E_COST ] > GetPlayerCash( playerid ) )
{
ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" );
SendError( playerid, "This interior costs "COL_GOLD"%s"COL_WHITE". You don't have this amount.", number_format( g_houseInteriors[ intid ] [ E_COST ] ) );
}
else if ( g_houseInteriors[ intid ] [ E_VIP ] && !p_VIPLevel[ playerid ] )
{
ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" );
SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
}
else if ( ArePlayersInHouse( p_InHouse[ playerid ], playerid ) )
{
ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" );
SendError( playerid, "You cannot purchase a house interior if there are people inside the building." );
}
else
{
if ( g_houseInteriors[ intid ] [ E_VIP ] && p_VIPLevel[ playerid ] && ( ( p_VIPExpiretime[ playerid ] - g_iTime ) / 86400 ) < 3 )
return SendError( playerid, "You need more than 3 days of V.I.P in order to complete this." );
new houseid = p_InHouse[ playerid ];
GivePlayerCash( playerid, -( g_houseInteriors[ intid ] [ E_COST ] ) );
if ( intid != 0 )
SendServerMessage( playerid, "You have purchased a %s for "COL_GOLD"%s"COL_WHITE". This has been applied to the House ID %d.", g_houseInteriors[ intid ] [ E_NAME ], number_format( g_houseInteriors[ intid ] [ E_COST ] ), houseid );
else
SendServerMessage( playerid, "You have successfully reset your interior to the default interior." );
destroyAllFurniture( houseid );
FillHomeWithFurniture( houseid, intid );
g_houseData[ houseid ] [ E_TX ] = g_houseInteriors[ intid ] [ E_EX ];
g_houseData[ houseid ] [ E_TY ] = g_houseInteriors[ intid ] [ E_EY ];
g_houseData[ houseid ] [ E_TZ ] = g_houseInteriors[ intid ] [ E_EZ ];
g_houseData[ houseid ] [ E_INTERIOR_ID ] = g_houseInteriors[ intid ] [ E_INTERIOR_ID ];
SetPlayerPos( playerid, g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ] );
SetPlayerInterior( playerid, g_houseInteriors[ intid ] [ E_INTERIOR_ID ] );
DestroyDynamicCP( g_houseData[ houseid ] [ E_CHECKPOINT ] [ 1 ] );
g_houseData[ houseid ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ], 1.0, g_houseData[ houseid ] [ E_WORLD ], g_houseData[ houseid ] [ E_INTERIOR_ID ], -1, 50.0 );
format( szBigString, sizeof( szBigString ), "UPDATE HOUSES SET TX=%f, TY=%f, TZ=%f, INTERIOR=%d WHERE ID=%d", g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ], g_houseData[ houseid ] [ E_INTERIOR_ID ], houseid );
mysql_single_query( szBigString );
DestroyDynamic3DTextLabel( g_houseData[ houseid ] [ E_LABEL ] [ 1 ] );
g_houseData[ houseid ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ houseid ] [ E_TX ], g_houseData[ houseid ] [ E_TY ], g_houseData[ houseid ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ houseid ] [ E_WORLD ] );
pauseToLoad( playerid );
}
}
case 1:
{
if ( p_WantedLevel[ playerid ] ) {
ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" );
return SendError( playerid, "This feature requires you not to have a wanted level." );
}
if ( ArePlayersInHouse( p_InHouse[ playerid ], playerid ) ) {
ShowPlayerDialog( playerid, DIALOG_HOUSE_INT_CONFIRM, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", "Purchase House Interior\nPreview House Interior", "Select", "Back" );
return SendError( playerid, "You cannot view a house interior if there are people inside the building." );
}
TogglePlayerControllable( playerid, 0 );
SetPlayerPos( playerid, g_houseInteriors[ intid ] [ E_EX ], g_houseInteriors[ intid ] [ E_EY ], g_houseInteriors[ intid ] [ E_EZ ] );
SetPlayerInterior( playerid, g_houseInteriors[ intid ] [ E_INTERIOR_ID ] );
InterpolateCameraPos( playerid, g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 2 ] + 1.5, g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 2 ], 15000, CAMERA_MOVE );
InterpolateCameraLookAt( playerid, g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_LOOKAT ] [ 2 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 0 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 1 ], g_houseInteriors[ intid ] [ E_PREVIEW_POS ] [ 2 ] + 1.5, 15000, CAMERA_MOVE );
SendServerMessage( playerid, "You are now previewing "COL_GREY"%s "COL_GOLD"%s"COL_WHITE". Press your enter key to stop.", g_houseInteriors[ intid ] [ E_NAME ], number_format( g_houseInteriors[ intid ] [ E_COST ] ) );
SetPVarInt( playerid, "viewing_houseints", 1 );
}
}
}
else ShowPlayerDialog( playerid, DIALOG_HOUSE_INTERIORS, DIALOG_STYLE_LIST, "{FFFFFF}House Interiors", szg_houseInteriors, "Select", "Back" );
}
else if ( dialogid == DIALOG_HOUSE_TITLE )
{
if ( response )
{
if ( p_InHouse[ playerid ] == -1 )
return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ p_InHouse[ playerid ] ] [ E_OWNER ], ReturnPlayerName( playerid ) ) )
return SendError( playerid, "You are not the owner of this house." );
if ( ! ( 1 <= strlen( inputtext ) <= 30 ) )
return ShowPlayerDialog( playerid, DIALOG_HOUSE_TITLE, DIALOG_STYLE_INPUT, "{FFFFFF}Set House Title", ""COL_WHITE"Input the house title you want to change with:\n\n"COL_RED"Must be between 1 and 30 characters.", "Confirm", "Back" );
if ( textContainsIP( inputtext ) )
return SendError( playerid, "We do not condone advertising." );
new houseid = p_InHouse[ playerid ];
format( g_houseData[ houseid ] [ E_HOUSE_NAME ], 30, "%s", inputtext);
mysql_format( dbHandle, szNormalString, sizeof( szNormalString ), "UPDATE `HOUSES` SET `NAME`='%s' WHERE `ID`=%d", g_houseData[ houseid ] [ E_HOUSE_NAME ], p_InHouse[ playerid ] );
mysql_single_query( szNormalString );
format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" %s(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", g_houseData[ houseid ] [ E_HOUSE_NAME ], houseid, g_houseData[ houseid ] [ E_OWNER ], number_format( g_houseData[ houseid ] [ E_COST ] ) );
UpdateDynamic3DTextLabelText( g_houseData[ houseid ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString );
SendServerMessage( playerid, "You have successfully changed the name of your house." );
cmd_h( playerid, "config" );
}
else cmd_h( playerid, "config" );
}
else if ( dialogid == DIALOG_HOUSE_PW && response )
{
new i = p_PasswordedHouse[ playerid ];
if ( !strlen( inputtext ) || strlen( inputtext ) > 4 || strmatch( inputtext, "N/A" ) || !strmatch( inputtext, g_houseData[ i ] [ E_PASSWORD ] ) ) ShowPlayerDialog( playerid, DIALOG_HOUSE_PW, DIALOG_STYLE_PASSWORD, "{FFFFFF}House Authentication", ""COL_GREEN"This house is password locked!\n"COL_WHITE"You may only enter this house if you enter the correct password.\n\n"COL_RED"Incorrect Password!", "Enter", "Cancel" );
else
{
if ( !IsPlayerInRangeOfPoint( playerid, 3.0, g_houseData[ i ] [ E_EX ], g_houseData[ i ] [ E_EY ], g_houseData[ i ] [ E_EZ ] ) ) return SendError( playerid, "You are not near the house entrance!" );
SendServerMessage( playerid, "Password correct. Access has been granted." );
p_InHouse[ playerid ] = i;
SetPlayerPos( playerid, g_houseData[ i ] [ E_TX ], g_houseData[ i ] [ E_TY ], g_houseData[ i ] [ E_TZ ] );
SetPlayerVirtualWorld( playerid, g_houseData[ i ] [ E_WORLD ] );
SetPlayerInterior( playerid, g_houseData[ i ] [ E_INTERIOR_ID ] );
}
}
return 1;
}
/* ** Commands ** */
CMD:bruteforce( playerid, params[ ] )
{
/* ** ANTI SPAM ** */
if ( GetPVarInt( playerid, "last_bruteforce" ) > g_iTime ) return SendError( playerid, "You must wait 30 seconds before using this command again." );
/* ** END OF ANTI SPAM ** */
if ( p_Class[ playerid ] != CLASS_POLICE ) return SendError( playerid, "This command is restricted for F.B.I agents." );
if ( !( p_inFBI{ playerid } == true && p_inArmy{ playerid } == false && p_inCIA{ playerid } == false ) ) return SendError( playerid, "This command is restricted for F.B.I agents." );
foreach ( new i : houses )
{
if ( IsPlayerInDynamicCP( playerid, g_houseData[ i ] [ E_CHECKPOINT ] [ 0 ] ) && !strmatch( g_houseData[ i ] [ E_OWNER ], ReturnPlayerName( playerid ) ) )
{
if ( g_iTime > g_houseData[ i ] [ E_CRACKED_TS ] && g_houseData[ i ] [ E_CRACKED ] ) g_houseData[ i ] [ E_CRACKED ] = false; // The Virus Is Disabled.
if ( g_houseData[ i ] [ E_CRACKED_WAIT ] > g_iTime )
return SendError( playerid, "This house had its password recently had a cracker run through. Come back later." );
if ( strmatch( g_houseData[ i ] [ E_PASSWORD ], "N/A" ) )
return SendError( playerid, "This house does not require cracking as it doesn't have a password." );
if ( g_houseData[ i ] [ E_CRACKED ] || g_houseData[ i ] [ E_BEING_CRACKED ] )
return SendError( playerid, "This house is currently being cracked or is already cracked." );
if ( IsHouseOnFire( i ) )
return SendError( playerid, "This house is on fire, you cannot bruteforce it!" ), 1;
g_houseData[ i ] [ E_BEING_CRACKED ] = true;
p_HouseCrackingPW[ playerid ] = i;
SetPVarInt( playerid, "last_bruteforce", g_iTime + 30 );
ShowProgressBar( playerid, "Brute Forcing Password", PROGRESS_BRUTEFORCE, 5000, COLOR_BLUE );
return 1;
}
}
SendError( playerid, "You are not standing in any house checkpoint." );
return 1;
}
CMD:h( playerid, params[ ] )
{
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED )
return SendError( playerid, "You must be verified in order to use this feature. "COL_YELLOW"(use /verify)" );
if ( ! p_VIPLevel[ playerid ] && p_OwnedHouses[ playerid ] > GetPlayerHouseSlots( playerid ) && ! strmatch( params, "sell" ) ) {
ResetSpawnLocation( playerid );
return SendError( playerid, "Please renew your V.I.P or sell this home to match your house allocated limit (/h sell)." );
}
new
ID = p_InHouse[ playerid ],
query[ 140 ]
;
if ( strmatch( params, "spawn" ) )
{
SendServerMessage( playerid, "We have changed the command to simply "COL_GREY"/spawn"COL_WHITE"." );
return ShowPlayerSpawnMenu( playerid );
}
else if ( strmatch( params, "config" ) )
{
if ( ID == -1 ) return SendError( playerid, "You're not in any house." );
else if ( !strmatch( g_houseData[ ID ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
else
{
ShowPlayerDialog( playerid, DIALOG_HOUSE_CONFIG, DIALOG_STYLE_LIST, "{FFFFFF}House Configuration", "Set House Title\nUpgrade Interior\nSet House Password\nWeapon Storage\nFurniture", "Select", "Cancel" );
}
return 1;
}
else if ( strmatch( params, "buy" ) )
{
if ( p_OwnedHouses[ playerid ] >= GetPlayerHouseSlots( playerid ) ) return SendError( playerid, "You cannot purchase any more houses, you've reached the limit." );
if ( GetPlayerScore( playerid ) < 200 ) return SendError( playerid, "You need at least 200 score to buy a house." );
foreach ( new i : houses )
{
if ( IsPlayerInDynamicCP( playerid, g_houseData[ i ] [ E_CHECKPOINT ] [ 0 ] ) || ( ID != -1 && ID == i ) )
{
if ( strmatch( g_houseData[ i ] [ E_OWNER ], "No-one" ) )
{
if ( GetPlayerCash( playerid ) < g_houseData[ i ] [ E_COST ] )
return SendError( playerid, "You don't have enough money to purchase this house." );
if ( g_houseData[ i ] [ E_COST ] == 1337 && !p_VIPLevel[ playerid ] )
return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
GivePlayerCash( playerid, -( g_houseData[ i ] [ E_COST ] ), .force_save = true );
SendServerMessage( playerid, "You have bought this home for "COL_GOLD"%s"COL_WHITE"!", number_format( g_houseData[ i ] [ E_COST ] ) );
SetHouseOwner( i, ReturnPlayerName( playerid ) );
p_OwnedHouses[ playerid ] ++;
return 1;
}
else return SendError( playerid, "This house isn't for sale." );
}
}
return SendError( playerid, "You are not around any house entrances." );
}
else if ( strmatch( params, "sell" ) )
{
if ( ID == -1 ) return SendError( playerid, "You're not in any house." );
else if ( !strmatch( g_houseData[ ID ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
else
{
format( szBigString, sizeof( szBigString ), "[SELL] [%s] %s | %s | %d\r\n", getCurrentDate( ), ReturnPlayerName( playerid ), g_houseData[ ID ][ E_OWNER ], ID );
AddFileLogLine( "log_houses.txt", szBigString );
p_OwnedHouses[ playerid ] --;
format( g_houseData[ ID ] [ E_PASSWORD ], 4, "N/A" );
format( g_houseData[ ID ] [ E_OWNER ], 7, "No-one" );
format( g_houseData[ ID ] [ E_HOUSE_NAME ], 5, "Home" );
for( new i; i < MAX_HOUSE_WEAPONS; i++ ) { g_HouseWeapons[ ID ] [ i ] = 0, g_HouseWeaponAmmo[ ID ] [ i ] = -1; }
SaveHouseWeaponStorage( ID );
GivePlayerCash( playerid, ( g_houseData[ ID ] [ E_COST ] / 2 ) );
destroyAllFurniture( ID );
FillHomeWithFurniture( ID, 0 );
g_houseData[ ID ] [ E_TX ] = g_houseInteriors[ 0 ] [ E_EX ];
g_houseData[ ID ] [ E_TY ] = g_houseInteriors[ 0 ] [ E_EY ];
g_houseData[ ID ] [ E_TZ ] = g_houseInteriors[ 0 ] [ E_EZ ];
g_houseData[ ID ] [ E_INTERIOR_ID ] = 2;
format( query, sizeof( query ), "UPDATE HOUSES SET OWNER='No-one',PASSWORD='N/A',NAME='Home',TX=%f,TY=%f,TZ=%f,INTERIOR=%d WHERE ID=%d", g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], g_houseData[ ID ] [ E_INTERIOR_ID ], ID );
mysql_single_query( query );
format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" No-one\n"COL_GOLD"Price:"COL_WHITE" %s", ID, number_format( g_houseData[ ID ] [ E_COST ] ) );
UpdateDynamic3DTextLabelText( g_houseData[ ID ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString );
DestroyDynamic3DTextLabel( g_houseData[ ID ] [ E_LABEL ] [ 1 ] );
g_houseData[ ID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ ID ] [ E_WORLD ] );
DestroyDynamicCP( g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] );
g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 1.0, g_houseData[ ID ] [ E_WORLD ], g_houseData[ ID ] [ E_INTERIOR_ID ], -1, 50.0 );
SetPlayerPos( playerid, g_houseData[ ID ] [ E_EX ], g_houseData[ ID ] [ E_EY ], g_houseData[ ID ] [ E_EZ ] );
DestroyDynamicMapIcon( g_houseData[ ID ] [ E_MAP_ICON ] );
SetPlayerInterior( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
SendServerMessage( playerid, "You have successfully sold your house for "COL_GOLD"%s", number_format( ( g_houseData[ ID ] [ E_COST ] / 2 ) ) );
}
return 1;
}
else if ( strmatch( params, "offer cancel" ) )
{
new
bool: bResults = false;
foreach(new i : Player)
{
if ( p_HouseOfferer[ i ] == playerid )
{
bResults = true;
p_HouseOfferer [ i ] = INVALID_PLAYER_ID;
p_HouseOfferTicks [ i ] = 0;
p_HouseSellingID [ i ] = 0;
p_HouseSellingPrice [ i ] = 0;
}
}
if ( bResults )
return SendServerMessage( playerid, "You have successfully canceled all house offers you have made to players." );
return SendError( playerid, "You have not made any house offers to anybody." );
}
else if ( strmatch( params, "offer take" ) )
{
new
houseid = p_HouseSellingID[ playerid ],
sellerid = p_HouseOfferer[ playerid ],
sellingprice = p_HouseSellingPrice[ playerid ]
;
if ( !IsPlayerConnected( sellerid ) ) SendError( playerid, "The person who offered you a house is no longer online." );
else if ( p_HouseOfferTicks[ playerid ] < g_iTime ) SendError( playerid, "This house offer has expired %d seconds ago.", g_iTime - p_HouseOfferTicks[ playerid ] );
else if ( GetPlayerCash( playerid ) < p_HouseSellingPrice[ playerid ] ) SendError( playerid, "You do not have enough money to accept this offer (%s).", number_format( p_HouseSellingPrice[ playerid ] ) );
else if ( g_houseData[ houseid ] [ E_COST ] <= 1337 && !p_VIPLevel[ playerid ] ) SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" );
else if ( p_OwnedHouses[ playerid ] >= GetPlayerHouseSlots( playerid ) ) SendError( playerid, "You cannot purchase any more houses, you've reached the limit." );
else
{
format( szBigString, sizeof( szBigString ), "[SELL TO] [%s] %s | %s | %s | %d\r\n", getCurrentDate( ), ReturnPlayerName( playerid ), ReturnPlayerName( sellerid ), number_format( sellingprice ), houseid );
AddFileLogLine( "log_houses.txt", szBigString );
p_OwnedHouses[ sellerid ] --;
p_OwnedHouses[ playerid ] ++;
// destroyAllFurniture( houseid );
mysql_single_query( sprintf( "UPDATE `FURNITURE` SET `OWNER`=%d WHERE `HOUSE_ID`=%d", p_AccountID[ playerid ], houseid ) );
SetHouseOwner( houseid, ReturnPlayerName( playerid ) );
GivePlayerCash( playerid, -sellingprice );
GivePlayerCash( sellerid, sellingprice );
SendServerMessage( sellerid, "You have successfully sold your house for "COL_GOLD"%s"COL_WHITE" to %s(%d)!", number_format( p_HouseSellingPrice[ playerid ] ), ReturnPlayerName( playerid ), playerid );
SendServerMessage( playerid, "You have successfully bought %s(%d)'s home for "COL_GOLD"%s"COL_WHITE"!", ReturnPlayerName( sellerid ), sellerid, number_format( p_HouseSellingPrice[ playerid ] ) );
}
return ( p_HouseOfferer[ playerid ] = INVALID_PLAYER_ID ), ( p_HouseOfferTicks[ playerid ] = 0 ), 1;
}
else if ( !strcmp( params, "offer", false, 5 ) )
{
new offerid, price;
if ( ID == -1 ) return SendError( playerid, "You're not in any house." );
else if ( !strmatch( g_houseData[ ID ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
else if ( sscanf( params[ 6 ],""#sscanf_u"d", offerid, price ) ) return SendUsage( playerid, "/h offer [PLAYER_ID] [PRICE]" );
else if ( !IsPlayerConnected( offerid ) ) return SendError( playerid, "This player is not connected." );
else if ( offerid == playerid ) return SendError( playerid, "You cannot make a house offer to yourself." );
else if ( price > 30000000 ) return SendError( playerid, "The maximum amount you can sell a house for is $30,000,000." );
else if ( price < g_houseData[ ID ] [ E_COST ] / 2 ) return SendError( playerid, "You cannot sell your house to somebody for less than half its cost." );
else if ( GetDistanceBetweenPlayers( playerid, offerid ) > 4.0 ) return SendError( playerid, "You cannot send offers to players who are not near you." );
else if ( p_HouseOfferTicks[ offerid ] > g_iTime ) return SendError( playerid, "Please wait %d seconds to make an house price offer to this player again.", p_HouseOfferTicks[ offerid ] - g_iTime );
else if ( g_houseData[ ID ] [ E_COST ] <= 1337 && !p_VIPLevel[ offerid ] ) return SendError( playerid, "You cannot offer V.I.P homes to sell to regular players." );
else if ( p_OwnedHouses[ offerid ] >= GetPlayerHouseSlots( offerid ) ) return SendError( playerid, "This player cannot purchase any more houses, they have reached the limit." );
else
{
// Cannot sell to non vip vip homes k
p_HouseOfferer[ offerid ] = playerid;
p_HouseOfferTicks[ offerid ] = g_iTime + 15;
p_HouseSellingID[ offerid ] = ID;
p_HouseSellingPrice[ offerid ] = price;
SendServerMessage( offerid, "%s(%d) wishes to offer his house (id %d) for %s to you. Use "COL_GREY"/h offer take"COL_WHITE" to take the offer.", ReturnPlayerName( playerid ), playerid, ID, number_format( price ) );
SendServerMessage( playerid, "You have offered %s(%d) %s for your house (id %d), cancel the offer with "COL_GREY"/h offer cancel"COL_WHITE".", ReturnPlayerName( offerid ), offerid, number_format( price ), ID );
}
return 1;
}
return SendUsage( playerid, "/h [CONFIG/BUY/SELL/OFFER/OFFER TAKE/OFFER CANCEL]" );
}
/* ** SQL Threads ** */
thread OnHouseLoad( )
{
new
rows, fields, i = -1,
loadingTick = GetTickCount( )
;
cache_get_data( rows, fields );
if ( rows )
{
static weapon_info[ 40 ], house_name[ 30 ], password[ 5 ], owner[ 24 ];
while( ++ i < rows )
{
// set name., owner, password again (less memory)
cache_get_field_content( i, "NAME", house_name, dbHandle, 30 );
cache_get_field_content( i, "PASSWORD", password, dbHandle, 5 );
cache_get_field_content( i, "OWNER", owner, dbHandle, 24 );
// create home handle
new house_sql_id = cache_get_field_content_int( i, "ID", dbHandle );
new handle = CreateHouse( house_name,
cache_get_field_content_int( i, "COST", dbHandle ),
cache_get_field_content_float( i, "EX", dbHandle ),
cache_get_field_content_float( i, "EY", dbHandle ),
cache_get_field_content_float( i, "EZ", dbHandle ),
cache_get_field_content_float( i, "TX", dbHandle ),
cache_get_field_content_float( i, "TY", dbHandle ),
cache_get_field_content_float( i, "TZ", dbHandle ),
cache_get_field_content_int( i, "INTERIOR", dbHandle ),
password, owner, house_sql_id
);
if ( handle != ITER_NONE ) {
// store weapon information
cache_get_field_content( i, "WEAPONS", weapon_info ), sscanf( weapon_info, "p<.>e<ddddddd>", g_HouseWeapons[ handle ] );
cache_get_field_content( i, "AMMO", weapon_info ), sscanf( weapon_info, "p<.>e<ddddddd>", g_HouseWeaponAmmo[ handle ] );
}
}
}
printf( "[HOUSES]: %d houses have been loaded. (Tick: %dms)", rows, GetTickCount( ) - loadingTick );
// Make Lorenc the owner of unowned VIP houses
foreach ( new houseid : houses ) if ( g_houseData[ houseid ] [ E_COST ] < 10000 ) {
if ( strmatch( g_houseData[ houseid ] [ E_OWNER ], "No-one" ) ) {
SetHouseOwner( houseid, "Lorenc" );
}
}
// The server crashes when the fires aren't correctly loaded.
CreateFire( );
return 1;
}
/* ** Functions ** */
stock CreateHouse( house_name[ 30 ], cost, Float: eX, Float: eY, Float: eZ, Float: tX = H_DEFAULT_X, Float: tY = H_DEFAULT_Y, Float: tZ = H_DEFAULT_Z, interior = 2, password[ 5 ] = "N/A", owner[ 24 ] = "No-one", sql_id = ITER_NONE )
{
new
hID = ( 0 <= sql_id < MAX_HOUSES ) ? sql_id : Iter_Free( houses );
if ( Iter_Contains( houses, sql_id ) )
hID = ITER_NONE;
if ( hID != ITER_NONE )
{
Iter_Add( houses, hID );
// set house name, password, owner
format( g_houseData[ hID ] [ E_HOUSE_NAME ], 30, "%s", house_name );
format( g_houseData[ hID ] [ E_PASSWORD ], 5, "%s", password );
format( g_houseData[ hID ] [ E_OWNER ], 24, "%s", owner );
// set home variables
g_houseData[ hID ] [ E_COST ] = cost;
g_houseData[ hID ] [ E_EX ] = eX;
g_houseData[ hID ] [ E_EY ] = eY;
g_houseData[ hID ] [ E_EZ ] = eZ;
g_houseData[ hID ] [ E_TX ] = tX;
g_houseData[ hID ] [ E_TY ] = tY;
g_houseData[ hID ] [ E_TZ ] = tZ;
g_houseData[ hID ] [ E_INTERIOR_ID ] = interior;
g_houseData[ hID ] [ E_WORLD ] = ( hID + MAX_HOUSES );
// reset weapons (in case)
for( new i; i < MAX_HOUSE_WEAPONS; i++ ) {
g_HouseWeapons[ hID ] [ i ] = 0, g_HouseWeaponAmmo[ hID ] [ i ] = -1;
}
// prefurnish home
if ( sql_id == ITER_NONE ) FillHomeWithFurniture( hID, 0 );
// set global
g_houseData[ hID ] [ E_MAP_ICON ] = strmatch( owner, "No-one" ) ? CreateDynamicMapIcon( eX, eY, eZ, 31, 0, -1, -1, -1, HOUSE_MAPICON_RADIUS ) : -1;
g_houseData[ hID ] [ E_CHECKPOINT ] [ 0 ] = CreateDynamicCP( eX, eY, eZ, 1.0, -1, 0, -1, 100.0 );
g_houseData[ hID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( tX, tY, tZ, 1.0, g_houseData[ hID ] [ E_WORLD ], g_houseData[ hID ] [ E_INTERIOR_ID ], -1, 100.0 );
format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" %s(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", g_houseData[ hID ] [ E_HOUSE_NAME ], hID, g_houseData[ hID ] [ E_OWNER ], number_format( cost ) );
g_houseData[ hID ] [ E_LABEL ] [ 0 ] = CreateDynamic3DTextLabel( szBigString, COLOR_WHITE, eX, eY, eZ, 20.0 );
g_houseData[ hID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, tX, tY, tZ, 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ hID ] [ E_WORLD ] );
// insert if non existant prior
if ( sql_id == ITER_NONE ) {
format( szBigString, sizeof( szBigString ), "INSERT INTO `HOUSES` VALUES (%d,'Home','No-one',%d,%f,%f,%f,%f,%f,%f,%d,'N/A','0.0.0.0.0.0.0.','-1.-1.-1.-1.-1.-1.-1.')", hID, cost, eX, eY, eZ, tX, tY, tZ, interior );
mysql_single_query( szBigString );
}
}
return hID;
}
stock DestroyHouse( houseid )
{
if ( ! Iter_Contains( houses, houseid ) )
return 0;
new
query[ 40 ],
playerid = GetPlayerIDFromName( g_houseData[ houseid ] [ E_OWNER ] )
;
if ( IsPlayerConnected( playerid ) )
{
SendClientMessage( playerid, -1, ""COL_PINK"[HOUSE]"COL_WHITE" One of your houses has been destroyed.");
p_OwnedHouses[ playerid ] --;
}
format( query, sizeof( query ), "DELETE FROM HOUSES WHERE ID=%d", houseid );
mysql_single_query( query );
destroyAllFurniture( houseid );
g_houseData[ houseid ] [ E_HOUSE_NAME ] [ 0 ] = '\0';
g_houseData[ houseid ] [ E_OWNER ] [ 0 ] = '\0';
DestroyDynamicMapIcon( g_houseData[ houseid ] [ E_MAP_ICON ] );
DestroyDynamicCP( g_houseData[ houseid ] [ E_CHECKPOINT ] [ 0 ] );
DestroyDynamicCP( g_houseData[ houseid ] [ E_CHECKPOINT ] [ 1 ] );
DestroyDynamic3DTextLabel( g_houseData[ houseid ] [ E_LABEL ] [ 0 ] );
DestroyDynamic3DTextLabel( g_houseData[ houseid ] [ E_LABEL ] [ 1 ] );
Iter_Remove( houses, houseid );
return 1;
}
stock SetHouseForAuction( ID )
{
if ( ID == -1 )
return 0;
if ( ! Iter_Contains( houses, ID ) )
return 0;
new
query[ 128 ],
player = GetPlayerIDFromName( g_houseData[ ID ] [ E_OWNER ] )
;
if ( IsPlayerConnected( player ) )
{
SendClientMessage( player, -1, ""COL_PINK"[HOUSE]"COL_WHITE" One of your houses has been taken for auction.");
p_OwnedHouses[ player ] --;
}
for( new i; i < MAX_HOUSE_WEAPONS; i++ ) { g_HouseWeapons[ ID ] [ i ] = 0, g_HouseWeaponAmmo[ ID ] [ i ] = -1; }
format( g_houseData[ ID ] [ E_PASSWORD ], 4, "N/A" );
format( g_houseData[ ID ] [ E_OWNER ], 7, "No-one" );
format( g_houseData[ ID ] [ E_HOUSE_NAME ], 5, "Home" );
g_houseData[ ID ] [ E_TX ] = g_houseInteriors[ 0 ] [ E_EX ];
g_houseData[ ID ] [ E_TY ] = g_houseInteriors[ 0 ] [ E_EY ];
g_houseData[ ID ] [ E_TZ ] = g_houseInteriors[ 0 ] [ E_EZ ];
g_houseData[ ID ] [ E_INTERIOR_ID ] = 2;
destroyAllFurniture( ID );
FillHomeWithFurniture( ID, 0 );
format( query, sizeof( query ), "UPDATE HOUSES SET OWNER='No-one',PASSWORD='N/A',NAME='Home',TX=%f,TY=%f,TZ=%f,INTERIOR=%d WHERE ID=%d", g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], g_houseData[ ID ] [ E_INTERIOR_ID ], ID );
mysql_single_query( query );
format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" No-one\n"COL_GOLD"Price:"COL_WHITE" %s", ID, number_format( g_houseData[ ID ] [ E_COST ] ) );
UpdateDynamic3DTextLabelText( g_houseData[ ID ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString);
DestroyDynamic3DTextLabel( g_houseData[ ID ] [ E_LABEL ] [ 1 ] );
g_houseData[ ID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ ID ] [ E_WORLD ] );
DestroyDynamicCP( g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] );
g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 1.0, g_houseData[ ID ] [ E_WORLD ], g_houseData[ ID ] [ E_INTERIOR_ID ], -1, 50.0 );
DestroyDynamicMapIcon( g_houseData[ ID ] [ E_MAP_ICON ] );
g_houseData[ ID ] [ E_MAP_ICON ] = CreateDynamicMapIcon( g_houseData[ ID ] [ E_EX ], g_houseData[ ID ] [ E_EY ], g_houseData[ ID ] [ E_EZ ], 31, 0, -1, -1, -1, HOUSE_MAPICON_RADIUS );
return 1;
}
stock SetHouseOwner( houseid, szOwner[ MAX_PLAYER_NAME ] )
{
if ( ! Iter_Contains( houses, houseid ) || isnull( szOwner ) )
return 0;
new
query[ 128 ]
;
format( g_houseData[ houseid ] [ E_OWNER ], 24, "%s", szOwner );
format( query, sizeof( query ), "UPDATE HOUSES SET OWNER='%s' WHERE ID=%d", mysql_escape( szOwner ), houseid );
mysql_single_query( query );
DestroyDynamicMapIcon( g_houseData[ houseid ] [ E_MAP_ICON ] );
format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" %s\n"COL_GOLD"Price:"COL_WHITE" %s", houseid, g_houseData[ houseid ] [ E_OWNER ], number_format( g_houseData[ houseid ] [ E_COST ] ) );
UpdateDynamic3DTextLabelText( g_houseData[ houseid ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString);
return 1;
}
stock SwitchHouseOwners( ID, playerid, buyerid )
{
if ( IsPlayerConnected( playerid ) )
{
p_OwnedHouses[ playerid ] --;
SetPlayerInterior( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
SendServerMessage( playerid, "You have successfully sold your house for "COL_GOLD"%s", number_format( ( g_houseData[ ID ] [ E_COST ] / 2 ) ) );
SetPlayerPos( playerid, g_houseData[ ID ] [ E_EX ], g_houseData[ ID ] [ E_EY ], g_houseData[ ID ] [ E_EZ ] );
}
strcpy( g_houseData[ ID ] [ E_PASSWORD ], "N/A" );
strcpy( g_houseData[ ID ] [ E_HOUSE_NAME ], "Home" );
format( g_houseData[ ID ] [ E_OWNER ], 7, "%s", ReturnPlayerName( buyerid ) );
format( szBigString, sizeof( szBigString ), "UPDATE HOUSES SET OWNER='%s',PASSWORD='N/A',NAME='Home' WHERE ID=%d", mysql_escape( ReturnPlayerName( buyerid ) ) , ID );
mysql_single_query( szBigString );
format( szBigString, sizeof( szBigString ), ""COL_GOLD"House:"COL_WHITE" Home(%d)\n"COL_GOLD"Owner:"COL_WHITE" No-one\n"COL_GOLD"Price:"COL_WHITE" %s", ID, number_format( g_houseData[ ID ] [ E_COST ] ) );
UpdateDynamic3DTextLabelText( g_houseData[ ID ] [ E_LABEL ] [ 0 ], COLOR_WHITE, szBigString );
DestroyDynamic3DTextLabel( g_houseData[ ID ] [ E_LABEL ] [ 1 ] );
g_houseData[ ID ] [ E_LABEL ] [ 1 ] = CreateDynamic3DTextLabel( "[EXIT]", COLOR_GOLD, g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, g_houseData[ ID ] [ E_WORLD ] );
DestroyDynamicCP( g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] );
g_houseData[ ID ] [ E_CHECKPOINT ] [ 1 ] = CreateDynamicCP( g_houseData[ ID ] [ E_TX ], g_houseData[ ID ] [ E_TY ], g_houseData[ ID ] [ E_TZ ], 1.0, g_houseData[ ID ] [ E_WORLD ], g_houseData[ ID ] [ E_INTERIOR_ID ], -1, 50.0 );
DestroyDynamicMapIcon( g_houseData[ ID ] [ E_MAP_ICON ] );
}
stock GetPlayerOwnedHouses( playerid )
{
new
count = 0;
foreach ( new i : houses ) if ( IsPlayerHomeOwner( playerid, i ) ) {
count ++;
}
return count;
}
stock ShowHouseWeaponStorage( playerid )
{
if ( !IsPlayerConnected( playerid ) )
return 0;
new id = p_InHouse[ playerid ];
if ( id == -1 ) return SendError( playerid, "You're not inside any house." );
if ( !strmatch( g_houseData[ id ] [ E_OWNER ], ReturnPlayerName( playerid ) ) ) return SendError( playerid, "You are not the owner of this house." );
szLargeString[ 0 ] = '\0';
for( new i = 0; i < MAX_HOUSE_WEAPONS; i++ )
{
if ( g_HouseWeapons[ id ] [ i ] != 0 )
format( szLargeString, sizeof( szLargeString ), "%s%s%s(%d)\n", szLargeString, i > 2 ? (""#COL_GOLD"") : ("{FFFFFF}"), ReturnWeaponName( g_HouseWeapons[ id ] [ i ] ), g_HouseWeaponAmmo[ id ] [ i ] );
else
strcat( szLargeString, i > 2 ? ( ""COL_GOLD"Empty\n" ) : ( ""COL_WHITE"Empty\n" ) );
}
ShowPlayerDialog( playerid, DIALOG_HOUSE_WEAPONS, DIALOG_STYLE_LIST, "{FFFFFF}House Weapon Storage", szLargeString, "Withdraw", "Back" );
return 1;
}
stock SaveHouseWeaponStorage( houseid )
{
new szWeapon[ 21 ], szAmmo[ 50 ];
for( new i; i < MAX_HOUSE_WEAPONS; i++ )
{
format( szWeapon, sizeof( szWeapon ), "%s%d.", szWeapon, g_HouseWeapons[ houseid ] [ i ] );
format( szAmmo, sizeof( szAmmo ), "%s%d.", szAmmo, g_HouseWeaponAmmo[ houseid ] [ i ] );
}
format( szBigString, sizeof( szBigString ), "UPDATE `HOUSES` SET `WEAPONS`='%s',`AMMO`='%s' WHERE `ID`=%d", szWeapon, szAmmo, houseid );
mysql_single_query( szBigString );
return 1;
}
stock ArePlayersInHouse( houseid, owner )
{
foreach ( new i : Player ) if ( i != owner )
{
if ( p_InHouse[ i ] == houseid )
{
if ( GetPlayerVirtualWorld( i ) == g_houseData[ houseid ] [ E_WORLD ] )
return true;
p_InHouse[ i ] = -1; // They're bugged probably
}
}
return false;
}

View File

@ -0,0 +1,127 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module: cnr\irresistibleguard.pwn
* Purpose: provides account protection in the form of email securing
*/
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Definitions ** */
#define SECURITY_MODE_MILD ( 0 )
#define SECURITY_MODE_PARANOID ( 1 )
#define SECURITY_MODE_DISABLED ( 2 )
/* ** Variables ** */
enum E_IRRESISTIBLE_GUARD
{
E_ID, E_EMAIL[ 64 ], E_MODE,
bool: E_VERIFIED, E_LAST_DISABLED
};
new
p_accountSecurityData [ MAX_PLAYERS ] [ E_IRRESISTIBLE_GUARD ]
;
/* ** Hooks ** */
hook OnPlayerDisconnect( playerid, reason )
{
p_accountSecurityData[ playerid ] [ E_VERIFIED ] = false;
p_accountSecurityData[ playerid ] [ E_ID ] = 0;
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
return 1;
}
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( ( dialogid == DIALOG_ACC_GUARD ) && response )
{
if ( p_accountSecurityData[ playerid ] [ E_ID ] && ! p_accountSecurityData[ playerid ] [ E_VERIFIED ] && p_accountSecurityData[ playerid ] [ E_MODE ] != SECURITY_MODE_DISABLED )
return SendError( playerid, "You must be verified to use this feature." );
switch ( listitem )
{
case 0:
{
if ( p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "Your email is already confirmed!" ), ShowPlayerAccountGuard( playerid ), 1;
format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `EMAILS` WHERE `USER_ID`=%d", p_AccountID[ playerid ] );
mysql_function_query( dbHandle, szNormalString, true, "OnEmailConfirm", "d", playerid );
}
case 1: ShowPlayerDialog( playerid, DIALOG_ACC_GUARD_MODE, DIALOG_STYLE_TABLIST, "{FFFFFF}Irresistible Guard - Mode", "Mild\t"COL_GREY"Must verify IP before making transactions\nParanoid\t"COL_GREY"Must verify IP after logging in\nDisable\t"COL_GREY"No form of verification", "Select", "Back" );
case 2:
{
format( szBigString, sizeof( szBigString ), "SELECT * FROM `EMAILS` WHERE `ID`=%d", p_accountSecurityData[ playerid ] [ E_ID ] );
mysql_function_query( dbHandle, szBigString, true, "OnAccountGuardDelete", "d", playerid );
}
case 3:
{
if ( p_AddedEmail{ playerid } )
return SendError( playerid, "You already added an email to your account before." );
if ( GetPlayerScore( playerid ) < 1000 )
return SendServerMessage( playerid, "Get at least 1000 score, then use this feature." );
Beep( playerid );
p_AddedEmail{ playerid } = true;
SetPlayerVipLevel( playerid, VIP_REGULAR, .interval = 259560 ); // 3 days of vip
mysql_single_query( sprintf( "UPDATE `USERS` SET `USED_EMAIL`=1 WHERE `ID`=%d", p_AccountID[ playerid ] ) );
SendGlobalMessage( COLOR_GOLD, "[EMAIL CONFIRMED]"COL_GREY" %s(%d) has confirmed their "COL_GOLD"/email"COL_GREY" and received 3 days of V.I.P!", ReturnPlayerName( playerid ), playerid );
return 1;
}
}
return 1;
}
else if ( dialogid == DIALOG_ACC_GUARD_CONFIRM )
{
if ( ! response )
{
if ( p_accountSecurityData[ playerid ] [ E_MODE ] == SECURITY_MODE_PARANOID ) {
return Kick( playerid );
}
// allow other modes
return 1;
}
static
szInput[ 10 ];
format( szInput, sizeof( szInput ), "%s", inputtext );
trimString( szInput ); // gotta take out the whitespace
if ( strlen( szInput ) != 8 )
return SendError( playerid, "The verification code must be 8 characters." ), ShowPlayerAccountVerification( playerid );
mysql_format( dbHandle, szBigString, sizeof( szBigString ), "SELECT * FROM `USER_CONFIRMED_IPS` WHERE `USER_ID`=%d AND `IP`='%e' AND `TOKEN`='%e'", p_AccountID[ playerid ], ReturnPlayerIP( playerid ), szInput );
mysql_function_query( dbHandle, szBigString, true, "OnAccountGuardVerify", "d", playerid );
return 1;
}
else if ( dialogid == DIALOG_ACC_GUARD_DEL_CANCEL )
{
if ( !response )
return ShowPlayerAccountGuard( playerid );
p_accountSecurityData[ playerid ] [ E_LAST_DISABLED ] = 0;
mysql_single_query( sprintf( "UPDATE `EMAILS` SET `LAST_CHANGED`=%d,`LAST_DISABLED`=0 WHERE `ID`=%d", g_iTime, p_accountSecurityData[ playerid ] [ E_ID ] ) );
return SendServerMessage( playerid, "You have cancelled the process to removing Irresistible Guard." );
}
else if ( dialogid == DIALOG_ACC_GUARD_MODE )
{
if ( !response )
return ShowPlayerAccountGuard( playerid );
if ( ! p_accountSecurityData[ playerid ] [ E_ID ] )
return SendError( playerid, "You need to assign an email to your account." );
p_accountSecurityData[ playerid ] [ E_MODE ] = listitem;
mysql_single_query( sprintf( "UPDATE `EMAILS` SET `MODE`=%d WHERE `ID`=%d", listitem, p_accountSecurityData[ playerid ] [ E_ID ] ) );
SendServerMessage( playerid, "Your Irresistible Guard mode is now set to "COL_GREY"%s"COL_WHITE".", SecurityModeToString( listitem ) );
return ShowPlayerAccountGuard( playerid );
}
return 1;
}
/* ** Functions ** */

View File

@ -54,7 +54,6 @@ new
bool: p_Spectating [ MAX_PLAYERS char ],
bool: p_Muted [ MAX_PLAYERS char ],
bool: p_InfectedHIV [ MAX_PLAYERS char ],
p_InHouse [ MAX_PLAYERS ],
p_ExperienceHideTimer [ MAX_PLAYERS ],
p_AntiTextSpam [ MAX_PLAYERS ],
bool: p_BlockedPM [ MAX_PLAYERS ] [ MAX_PLAYERS ],
@ -238,8 +237,6 @@ new
p_Fireworks [ MAX_PLAYERS ],
p_ExplosiveBullets [ MAX_PLAYERS ],
bool: p_AddedEmail [ MAX_PLAYERS char ],
p_SpawningKey [ MAX_PLAYERS ] [ 4 ],
p_SpawningIndex [ MAX_PLAYERS ],
p_TazingImmunity [ MAX_PLAYERS ],
p_PlayerAltBind [ MAX_PLAYERS ] = { -1, ... },
p_PlayerAltBindTick [ MAX_PLAYERS ]

View File

@ -0,0 +1,136 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module: cities.inc
* Purpose: definitions of spawn & cities
*/
/* ** Configuration ** */
#define ENABLE_CITY_LV true
#define ENABLE_CITY_LS true
/* ** Definitions ** */
#define MAX_CITIES 3
#define CITY_SF 0
#define CITY_LV 1
#define CITY_LS 2
#define CITY_DESERTS 3
#define CITY_COUNTRY 4
/* ** Macros ** */
#define ResetSpawnLocation(%0) SetPlayerSpawnLocation(%0, "")
/* ** Variables ** */
enum E_RANDOM_SPAWNS
{
Float:RANDOM_SPAWN_X,
Float:RANDOM_SPAWN_Y,
Float:RANDOM_SPAWN_Z,
Float:RANDOM_SPAWN_A,
RANDOM_SPAWN_INTERIOR,
RANDOM_SPAWN_WORLD
};
new const
g_SanFierroSpawns[ ] [ E_RANDOM_SPAWNS ] =
{
{ -2097.5737, 715.2664, 69.5625, 277.9042, 0, 0 },
{ -1757.4670, 961.8670, 24.8828, 181.7833, 0, 0 },
{ -1953.8724, 300.1801, 41.0471, 133.1765, 0, 0 },
{ -2020.3107, -96.6103, 35.1641, 331.9525, 0, 0 },
{ -2343.3860, -138.315, 35.3203, 3.2265, 0, 0 },
{ -2519.0496, -30.7666, 25.6172, 319.5007, 0, 0 },
{ -2759.6978, 375.4238, 4.5230, 270.5632, 0, 0 },
{ -2474.5874, 1264.014, 28.7647, 275.3246, 0, 0 },
{ -1501.3506, 914.5378, 7.1875, 90.5807, 0, 0 },
{ -2238.6428, 113.4054, 35.3203, 243.0862, 0, 0 },
{ -1983.5684, 129.8655, 27.6875, 74.4550, 0, 0 },
{ -2626.2156, 1398.626, 7.1016, 204.5252, 0, 0 },
{ -2626.2156, 1398.626, 7.1016, 204.5252, 0, 0 },
{ -2587.4861, 212.0579, 9.0733, 9.073300, 0, 0 }
},
g_LasVenturasSpawns[ ] [ E_RANDOM_SPAWNS ] =
{
{ 2170.4834, 1714.3723, 11.0469, 137.5881, 0, 0 },
{ 2000.1403, 1564.7941, 15.3672, 236.5212, 0, 0 },
{ 2417.5991, 1136.6140, 10.8125, 225.6512, 0, 0 },
{ 2484.6160, 1528.7273, 10.8954, 323.0129, 0, 0 },
{ 2464.4070, 2033.2441, 11.0625, 47.88940, 0, 0 },
{ 2451.2332, 2347.0044, 12.1635, 112.7286, 0, 0 },
{ 1480.3296, 2250.1125, 11.0291, 279.2149, 0, 0 },
{ 2143.3252, 2840.4441, 10.8203, 139.9116, 0, 0 }
},
g_LosSantosSpawns [ ] [ E_RANDOM_SPAWNS ] =
{
{ 810.63520, -1340.0682, 13.5386, 37.33070, 0, 0 },
{ 1124.6071, -1427.5155, 15.7969, 350.9336, 0, 0 },
{ 585.81520, -1247.9160, 17.9521, 335.6035, 0, 0 },
{ 2025.2626, -1423.2682, 16.9922, 135.4516, 0, 0 },
{ 2509.2468, -1679.2029, 13.5469, 50.24740, 0, 0 },
{ 1457.1467, -1011.7307, 26.8438, 51.79910, 0, 0 },
{ 2017.8206, -1279.4851, 23.9820, 47.38920, 0, 0 },
{ 1935.7644, -1794.6068, 13.5469, 295.5515, 0, 0 },
{ 1371.4569, -1090.6387, 24.5459, 92.84640, 0, 0 },
{ 2298.4055, -1500.3264, 25.3047, 199.6940, 0, 0 }
},
g_FiremanSpawns [ MAX_CITIES ] [ E_RANDOM_SPAWNS ] =
{
{ -2026.3287, 67.1439, 28.6916, 270.0000, 0, 0 },
{ 1744.56240, 2079.43, 10.8203, 172.1325, 0, 0 },
{ 1757.44350, -1456.7, 13.5469, 282.4133, 0, 0 }
},
g_MedicSpawns [ MAX_CITIES ] [ E_RANDOM_SPAWNS ] =
{
{ -2658.0764, 634.333, 14.4531, 180.0000, 0, 0 },
{ 1615.62490, 1840.19, 10.9696, 0.000000, 0, 0 },
{ 1178.04170, -1323.6, 14.1005, 285.5701, 0, 0 }
},
g_ArmySpawns [ MAX_CITIES ] [ E_RANDOM_SPAWNS ] =
{
{ -1401.8173, 493.496, 18.2294, 0.000000, 0, 0 },
{ 199.572200, 1920.97, 17.6406, 180.0000, 0, 0 },
{ 1229.35670, -2611.4, 19.7344, 264.2092, 0, 0 }
},
g_CIASpawns [ MAX_CITIES ] [ E_RANDOM_SPAWNS ] =
{
{ -2455.4487, 503.92360, 30.078, 270.000, 0, 0 },
{ 940.813400, 1733.6327, 8.8516, 270.000, 0, 0 },
{ 1518.82930, -1452.430, 14.203, 0.00000, 0, 0 }
},
g_PoliceSpawns [ MAX_CITIES ] [ E_RANDOM_SPAWNS ] =
{
{ -1606.3693, 674.1749, -5.2422, 0.0000, 0, 0 },
{ 2295.62960, 2468.796, 10.8203, 90.000, 0, 0 },
{ 1528.58340, -1677.49, 5.89060, 270.00, 0, 0 }
}
;
new
p_SpawningKey [ MAX_PLAYERS ] [ 4 ],
p_SpawningIndex [ MAX_PLAYERS ]
;
/* ** Functions ** */
stock SetPlayerSpawnLocation( playerid, spawn_key[ 4 ], spawn_index = 0 )
{
// set sql, null if key is null
if ( spawn_key[ 0 ] == '\0' ) {
mysql_single_query( sprintf( "UPDATE `USERS` SET `SPAWN`=NULL WHERE `ID`=%d", p_AccountID[ playerid ] ) );
} else {
mysql_single_query( sprintf( "UPDATE `USERS` SET `SPAWN`='%s %d' WHERE `ID`=%d", spawn_key, spawn_index, p_AccountID[ playerid ] ) );
}
// variable update
strcpy( p_SpawningKey[ playerid ], spawn_key );
p_SpawningIndex[ playerid ] = spawn_index;
return 1;
}

File diff suppressed because it is too large Load Diff