//furniture buying and saving system by jueix. #define FILTERSCRIPT #include #include #include #include #include //coord saver of objects new Float:CX; new Float:CY; new Float:CZ; new Float:BX; new Float:BY; new Float:BZ; new Float:TX; new Float:TY; new Float:TZ; enum Finfo { NAME, HASCHAIR, HASBED, HASTABLE, CHAIRID, BEDID, TABLEID, Cworld, Cint, Tworld, Tint, Bworld, Bint, Pc, Pt, Pb }; new fInfo[MAX_PLAYERS][Finfo]; public OnFilterScriptInit() { print("\n--------------------------------------"); print(" furniture system buy jueix."); print("--------------------------------------\n"); CreateObject(1498, -1132.59, -2859.42, 269.56, 0.00, 0.00, 107.20); CreateObject(3032, -1143.17, -2865.04, 270.78, 0.00, 0.00, 18.13); CreateObject(3032, -1145.59, -2863.70, 271.01, 0.00, 0.00, 288.70); CreateObject(3032, -1148.15, -2855.98, 271.01, 0.00, 0.00, 288.70); CreateObject(1498, -1146.03, -2861.80, 269.56, 0.00, 0.00, 108.55); CreateObject(3032, -1146.55, -2853.71, 270.78, 0.00, 0.00, 192.00); CreateObject(3032, -1134.70, -2852.66, 270.78, 0.00, 0.00, 289.13); CreateObject(3032, -1133.48, -2861.87, 270.78, 0.00, 0.00, 18.70); CreateObject(19506, -1140.95, -2857.92, 271.40, 0.00, 0.00, 18.54); CreateObject(3032, -1136.56, -2862.93, 270.78, 0.00, 0.00, 18.70); CreateObject(3032, -1139.78, -2863.99, 270.78, 0.00, 0.00, 18.13); CreateObject(2626, -1143.30, -2863.27, 270.08, 0.00, 0.00, 200.28); CreateObject(1802, -1146.44, -2858.14, 269.62, 0.00, 0.00, 19.80); CreateObject(2566, -1141.98, -2855.60, 270.06, 0.00, 0.00, 20.14); CreateObject(2762, -1134.76, -2855.95, 269.92, 0.00, 0.00, 110.32); CreateObject(1704, -1135.72, -2861.89, 269.57, 0.00, 0.00, 200.08); CreateObject(1708, -1139.69, -2863.49, 269.47, 0.00, 0.00, 197.16); return 1; } public OnPlayerConnect(playerid) { LoadStats(playerid); if(fInfo[playerid][Pt] == 1) { CreateDynamicObject(fInfo[playerid][TABLEID], TX, TY, TZ, 0, 0, 0, fInfo[playerid][Tworld], fInfo[playerid][Tint], -1, 200.0); } if(fInfo[playerid][Pc] == 1) { CreateDynamicObject(fInfo[playerid][CHAIRID], CX, CY, CZ, 0, 0, 0, fInfo[playerid][Cworld], fInfo[playerid][Cint], -1, 200.0); } if(fInfo[playerid][Pb] == 1) { CreateDynamicObject(fInfo[playerid][BEDID], BX, BY, BZ, 0, 0, 0, fInfo[playerid][Bworld], fInfo[playerid][Bint], -1, 200.0); } return 1; } public OnPlayerDisconnect(playerid, reason) { if (!dini_Exists(furn(playerid))) { dini_Create(furn(playerid)); } SaveStats(playerid); return 1; } public OnFilterScriptExit() { return 1; } COMMAND:fshop(playerid, params[]) // or CMD:mycommand(playerid, params[]) { SetPlayerPos(playerid, -1146.44, -2858.14, 269.62); return 1; } //buys COMMAND:buychair(playerid, params[]) // or CMD:mycommand(playerid, params[]) { IsPlayerInRangeOfPoint(playerid, 1.0, -1136.4224,-2861.4194,270.5641); if(fInfo[playerid][HASCHAIR] == 0) { fInfo[playerid][HASCHAIR] = 1; fInfo[playerid][CHAIRID] = 1704; GivePlayerMoney(playerid, -270); SendClientMessage(playerid, 0xFFFFFF,"You have bought a leather chair for ?270."); SendClientMessage(playerid, 0xFFFFFF,"In this verison of the filterscript you can only have 1 chair"); SendClientMessage(playerid, 0xFFFFFF,"go to an area you want your chair to be and type /placechair"); } IsPlayerInRangeOfPoint(playerid, 1.0, -1140.2141,-2862.9775,270.5641); if(fInfo[playerid][HASCHAIR] == 0) { fInfo[playerid][HASCHAIR] = 1; fInfo[playerid][CHAIRID] = 1708; GivePlayerMoney(playerid, -150); SendClientMessage(playerid, 0xFFFFFF,"You have bought a chair for ?150."); SendClientMessage(playerid, 0xFFFFFF,"In this verison of the filterscript you can only have 1 chair"); SendClientMessage(playerid, 0xFFFFFF,"go to an area you want your chair to be and type /placechair"); } return 1; } COMMAND:buybed(playerid, params[]) // or CMD:mycommand(playerid, params[]) { IsPlayerInRangeOfPoint(playerid, 1.0, -1146.0715,-2857.3557,270.5641); if(fInfo[playerid][HASBED] == 0) { fInfo[playerid][HASBED] = 1; fInfo[playerid][BEDID] = 1802; GivePlayerMoney(playerid, -500); SendClientMessage(playerid, 0xFFFFFF,"You have bought a kingsize bed for ?500."); SendClientMessage(playerid, 0xFFFFFF,"In this verison of the filterscript you can only have 1 bed"); SendClientMessage(playerid, 0xFFFFFF,"go to an area you want your chair to be and type /placebed"); } IsPlayerInRangeOfPoint(playerid, 1.0, -1140.2225,-2855.2290,270.5641); if(fInfo[playerid][HASBED] == 0) { fInfo[playerid][HASBED] = 1; fInfo[playerid][BEDID] = 2566; GivePlayerMoney(playerid, -1230); SendClientMessage(playerid, 0xFFFFFF,"You have bought the bed with bed side cabinets for ?1230."); SendClientMessage(playerid, 0xFFFFFF,"In this verison of the filterscript you can only have 1 bed"); SendClientMessage(playerid, 0xFFFFFF,"go to an area you want your bed to be and type /placebed"); } else { SendClientMessage(playerid, 0xFFFFFF,"you all ready own a bed or you are not in a furniture shop."); } return 1; } COMMAND:buytable(playerid, params[]) // or CMD:mycommand(playerid, params[]) { IsPlayerInRangeOfPoint(playerid, 1.0, -1135.6499,-2856.1558,270.5641); if(fInfo[playerid][HASTABLE] == 0 && fInfo[playerid][Pt] == 0) { fInfo[playerid][HASTABLE] = 1; fInfo[playerid][TABLEID] = 2762; GivePlayerMoney(playerid, -50); SendClientMessage(playerid, 0xFFFFFF,"You have bought a wooden coffe table for ?50."); SendClientMessage(playerid, 0xFFFFFF,"In this verison of the filterscript you can only have 1 table"); SendClientMessage(playerid, 0xFFFFFF,"go to an area you want your table to be and type /placetable"); } else { SendClientMessage(playerid, 0xFFFFFF,"you all ready own a table or you are not in a furniture shop."); } return 1; } //placing COMMAND:placechair(playerid, params[]) // or CMD:mycommand(playerid, params[]) { if(fInfo[playerid][HASCHAIR] == 1 && fInfo[playerid][Pc] == 0) { new Float:x; new Float:y; new Float:z; GetPlayerPos(playerid,x,y,z); CX = x; CY = y; CZ = z - 0.8; fInfo[playerid][Cint] = GetPlayerInterior(playerid); fInfo[playerid][Cworld] = GetPlayerVirtualWorld(playerid); fInfo[playerid][Pc] = 1; CreateDynamicObject(fInfo[playerid][CHAIRID], CX, CY, CZ, 0, 0, 0, fInfo[playerid][Cworld], fInfo[playerid][Cint], -1, 200.0); } else { SendClientMessage(playerid, 0xFFFFFF,"you don't have a chair please buy one from the furniture shop."); SendClientMessage(playerid, 0xFFFFFF,"Or you have allready planted it."); } return 1; } COMMAND:placetable(playerid, params[]) // or CMD:mycommand(playerid, params[]) { if(fInfo[playerid][HASTABLE] == 1 && fInfo[playerid][Pt] == 0) { new Float:x; new Float:y; new Float:z; GetPlayerPos(playerid,x,y,z); TX = x; TY = y; TZ = z - 0.8; fInfo[playerid][Tint] = GetPlayerInterior(playerid); fInfo[playerid][Tworld] = GetPlayerVirtualWorld(playerid); fInfo[playerid][Pt] = 1; CreateDynamicObject(fInfo[playerid][TABLEID], TX, TY, TZ, 0, 0, 0, fInfo[playerid][Tworld], fInfo[playerid][Tint], -1, 200.0); } else { SendClientMessage(playerid, 0xFFFFFF,"you don't have a table please buy one from the furniture shop."); SendClientMessage(playerid, 0xFFFFFF,"Or you have allready placed it."); } return 1; } COMMAND:placebed(playerid, params[]) // or CMD:mycommand(playerid, params[]) { if(fInfo[playerid][HASBED] == 1 && fInfo[playerid][Pb] == 0) { new Float:x; new Float:y; new Float:z; GetPlayerPos(playerid,x,y,z); BX = x; BY = y; BZ = z - 0.8; fInfo[playerid][Bint] = GetPlayerInterior(playerid); fInfo[playerid][Bworld] = GetPlayerVirtualWorld(playerid); fInfo[playerid][Pb] = 1; CreateDynamicObject(fInfo[playerid][BEDID], BX, BY, BZ, 0, 0, 0, fInfo[playerid][Bworld], fInfo[playerid][Bint], -1, 200.0); } else { SendClientMessage(playerid, 0xFFFFFF,"you don't have a bed please buy one from the furniture shop."); SendClientMessage(playerid, 0xFFFFFF,"Or you have allready placed it."); } return 1; } Player(playerid) { new player[MAX_PLAYER_NAME]; GetPlayerName(playerid, player, sizeof(player)); return player; } furn(playerid) { new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid))); return a; } SaveStats(playerid) { dini_IntSet(furn(playerid), "CX", floatround(CX)); dini_IntSet(furn(playerid), "CY", floatround(CY)); dini_IntSet(furn(playerid), "CZ", floatround(CZ)); dini_IntSet(furn(playerid), "TX", floatround(TX)); dini_IntSet(furn(playerid), "TY", floatround(TY)); dini_IntSet(furn(playerid), "TZ", floatround(TZ)); dini_IntSet(furn(playerid), "BX", floatround(BX)); dini_IntSet(furn(playerid), "BY", floatround(BY)); dini_IntSet(furn(playerid), "BZ", floatround(BZ)); dini_IntSet(furn(playerid), "HASCHAIR", (fInfo[playerid][HASCHAIR])); dini_IntSet(furn(playerid), "HASTABLE", (fInfo[playerid][HASTABLE])); dini_IntSet(furn(playerid), "HASBED", (fInfo[playerid][HASBED])); dini_IntSet(furn(playerid), "Cworld", (fInfo[playerid][Cworld])); dini_IntSet(furn(playerid), "Cint", (fInfo[playerid][Cint])); dini_IntSet(furn(playerid), "Tworld", (fInfo[playerid][Tworld])); dini_IntSet(furn(playerid), "Tint", (fInfo[playerid][Tint])); dini_IntSet(furn(playerid), "Bworld", (fInfo[playerid][Bworld])); dini_IntSet(furn(playerid), "Bint", (fInfo[playerid][Bint])); dini_IntSet(furn(playerid), "HasPlacedChair", (fInfo[playerid][Pc])); dini_IntSet(furn(playerid), "HasPlacedTable", (fInfo[playerid][Pt])); dini_IntSet(furn(playerid), "HasPlacedBed", (fInfo[playerid][Pb])); dini_IntSet(furn(playerid), "CHAIRID", (fInfo[playerid][CHAIRID])); dini_IntSet(furn(playerid), "TABLEID", (fInfo[playerid][TABLEID])); dini_IntSet(furn(playerid), "BEDID", (fInfo[playerid][BEDID])); } LoadStats(playerid) { CX = dini_Int(furn(playerid), "CX"); CY = dini_Int(furn(playerid), "CY"); CZ = dini_Int(furn(playerid), "CZ"); TX = dini_Int(furn(playerid), "TX"); TY = dini_Int(furn(playerid), "TY"); TZ = dini_Int(furn(playerid), "TZ"); BX = dini_Int(furn(playerid), "BX"); BY = dini_Int(furn(playerid), "BY"); BZ = dini_Int(furn(playerid), "BZ"); fInfo[playerid][HASCHAIR] = dini_Int(furn(playerid), "HASCHAIR"); fInfo[playerid][HASTABLE] = dini_Int(furn(playerid), "HASTABLE"); fInfo[playerid][HASBED] = dini_Int(furn(playerid), "HASBED"); fInfo[playerid][Cworld] = dini_Int(furn(playerid), "Cworld"); fInfo[playerid][Cint] = dini_Int(furn(playerid), "Cint"); fInfo[playerid][Tworld] = dini_Int(furn(playerid), "Tworld"); fInfo[playerid][Tint] = dini_Int(furn(playerid), "Tint"); fInfo[playerid][Bworld] = dini_Int(furn(playerid), "Bworld"); fInfo[playerid][Bint] = dini_Int(furn(playerid), "Bint"); fInfo[playerid][Pc] = dini_Int(furn(playerid), "HasPlacedChair"); fInfo[playerid][Pt] = dini_Int(furn(playerid), "HasPlacedTable"); fInfo[playerid][Pb] = dini_Int(furn(playerid), "HasPlacedBed"); fInfo[playerid][CHAIRID] = dini_Int(furn(playerid), "CHAIRID"); fInfo[playerid][TABLEID] = dini_Int(furn(playerid), "TABLEID"); fInfo[playerid][BEDID] = dini_Int(furn(playerid), "BEDID"); }