Help with the House System !!!
#1

I have problems with createhouse command.
There doesn't insert the interiox, interiory, interioz for house when i create.

Код:
CMD:createhouse( playerid, params[ ] )
{
	if( !IsPlayerAdmin( playerid ) )
		return SendError( playerid, "You must be RCON !" );
		
	new HouseCost, Float:X, Float:Y, Float:Z, DD[ 512 ], H;
	if( sscanf( params, "i", HouseCost ) )
		return SendUsage( playerid, "/createhouse [House Cost]" );

	GetPlayerPos( playerid, X, Y, Z );
	CMDMessageToAdmins( playerid, "/createhouse" );
	
	eQuery[ 0 ] = EOS;
	format( eQuery, 512, "INSERT INTO `Houses`(`ID`, `HouseName`, `HouseCost`, `HouseSell`, `HouseInterior`, \
	`HouseLocked`, `HouseIntX`, `HouseIntY`, `HouseIntZ`, `HouseX`, `HouseY`, `HouseZ`, `HouseRent`) \
	VALUES ( 0, 'For Sale', %d, %d, 0, 1, 0.00, 0.00, 0.00, %.2f, %.2f, %.2f, 0 )", HouseCost, HouseCost / 2, X, Y, Z );
	mysql_tquery( DB_Connect, eQuery, "OnHouseCreated", "i", H );
   
  	format( HouseInfo[ H ][ Name ], 24, "For Sale" );
	HouseInfo[ H ][ Rent ] = 1000;
	HouseInfo[ H ][ Cost ] = HouseCost;
	HouseInfo[ H ][ Sell ] = HouseCost / 2;
	HouseInfo[ H ][ Interior ] = 0;
	HouseInfo[ H ][ Locked ] = 1;
	HouseInfo[ H ][ InteriorX ] = 0.00;
	HouseInfo[ H ][ InteriorY ] = 0.00;
	HouseInfo[ H ][ InteriorZ ] = 0.00;
	HouseInfo[ H ][ HX ] = X;
	HouseInfo[ H ][ HY ] = Y;
	HouseInfo[ H ][ HZ ] = Z;
	
	HousePickup[ H ] = CreateDynamicPickup( 1273, 1, HouseInfo[ H ][ HX ], HouseInfo[ H ][ HY ], HouseInfo[ H ][ HZ ] );
	HouseInfo[ H ][ HouseMapIcon ] = CreateDynamicMapIcon( HouseInfo[ H ][ HX ], HouseInfo[ H ][ HY ], HouseInfo[ H ][ HZ ], 31, 0, -1, 0, -1, 300.0 );

	format( DD, 512, "{C0C0C0}House(ID: {FF0000}%d{C0C0C0})\n{FF0000}/hinfo", H );
    housei[ H ] = CreateDynamic3DTextLabel( DD, ~1, HouseInfo[ H ][ HX ], HouseInfo[ H ][ HY ], HouseInfo[ H ][ HZ ], 30.0 );
	
	SetPlayerPos( playerid, X - 5, Y, Z );
	FormatMSG( playerid, 0xC0C0C0FF, "[SV INFO]: The house with ID: {FFFFFF}'{FF0000}%d{FFFFFF}' {C0C0C0}was created.", H );

	eString[ 0 ] = EOS;
	strcat( eString, "Madd Doggs Mansion( 5 )\n\
					  The Johnsons House( 3 )\n\
                      Verdant Bluffs Safehouse( 8 )\n\
                      Hashbury House( 10 )\n\
                      Golden Bed Motel Room( 9 )\n");
    strcat( eString, "Big Smoke's Crack Palace( 2 )\n\
    				  House 1( 3 )\n\
                      House 2( 2 )\n\
                      House 3( 1 )\n\
                      House 4( 7 )\n");
    strcat( eString, "House 5( 15 )\n\
                      House 6( 15 )\n\
                      House 7( 15 )\n\
					  Ryder's House(  2)\n\
					  Sweets House( 1 )\n\
					  Jefferson Motel( 15 )");
    return ShowPlayerDialog( playerid, DIALOG_HOUSE_INTERIOR_CHANGE, DIALOG_STYLE_LIST, "{FFFFFF}Select House Interior:", eString, "Select", "Cancel" );
}
DIALOG_HOUSE_IINTERIOR_CHANGE = The dialog where you choose the interior and sets the InteriorX, InteriorY, InteriorZ.
Код:
case DIALOG_HOUSE_INTERIOR_CHANGE:
	    {
	        if( !response )
				return 1;

			new h_owner = PlayerInfo[ playerid ][ House ];
            switch( listitem )
			{
			    case 0: return HouseInfo[ h_owner ][ InteriorX ] = 1299.14,     HouseInfo[ h_owner ][ InteriorY ] = -794.77,  	 HouseInfo[ h_owner ][ InteriorZ ] = 1084.00, 	  HouseInfo[ h_owner ][ Interior ] = 5, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 1: return HouseInfo[ h_owner ][ InteriorX ] = 2496.65, 	HouseInfo[ h_owner ][ InteriorY ] = -1696.55, 	 HouseInfo[ h_owner ][ InteriorZ ] = 1014.74, 	  HouseInfo[ h_owner ][ Interior ] = 3, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 2: return HouseInfo[ h_owner ][ InteriorX ] = 2365.42, 	HouseInfo[ h_owner ][ InteriorY ] = -1131.85, 	 HouseInfo[ h_owner ][ InteriorZ ] = 1050.88, 	  HouseInfo[ h_owner ][ Interior ] = 8, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 3: return HouseInfo[ h_owner ][ InteriorX ] = 2260.76, 	HouseInfo[ h_owner ][ InteriorY ] = -1210.45, 	 HouseInfo[ h_owner ][ InteriorZ ] = 1049.02, 	  HouseInfo[ h_owner ][ Interior ] = 10, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 4: return HouseInfo[ h_owner ][ InteriorX ] = 2251.85, 	HouseInfo[ h_owner ][ InteriorY ] = -1138.16, 	 HouseInfo[ h_owner ][ InteriorZ ] = 1050.63, 	  HouseInfo[ h_owner ][ Interior ] = 9, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 5: return HouseInfo[ h_owner ][ InteriorX ] = 2567.52, 	HouseInfo[ h_owner ][ InteriorY ] = -1294.59, 	 HouseInfo[ h_owner ][ InteriorZ ] = 1063.25, 	  HouseInfo[ h_owner ][ Interior ] = 2, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 6: return HouseInfo[ h_owner ][ InteriorX ] = 235.508994,  HouseInfo[ h_owner ][ InteriorY ] = 1189.169897, HouseInfo[ h_owner ][ InteriorZ ] = 1080.339966, HouseInfo[ h_owner ][ Interior ] = 3, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 7: return HouseInfo[ h_owner ][ InteriorX ] = 225.756989,  HouseInfo[ h_owner ][ InteriorY ] = 1240.000000, HouseInfo[ h_owner ][ InteriorZ ] = 1082.149902, HouseInfo[ h_owner ][ Interior ] = 2, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 8: return HouseInfo[ h_owner ][ InteriorX ] = 223.043991,  HouseInfo[ h_owner ][ InteriorY ] = 1289.259888, HouseInfo[ h_owner ][ InteriorZ ] = 1082.199951, HouseInfo[ h_owner ][ Interior ] = 1, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 9: return HouseInfo[ h_owner ][ InteriorX ] = 225.630997,  HouseInfo[ h_owner ][ InteriorY ] = 1022.479980, HouseInfo[ h_owner ][ InteriorZ ] = 1084.069946, HouseInfo[ h_owner ][ Interior ] = 7, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 10: return HouseInfo[ h_owner ][ InteriorX ] = 295.138977, HouseInfo[ h_owner ][ InteriorY ] = 1474.469971, HouseInfo[ h_owner ][ InteriorZ ] = 1080.519897, HouseInfo[ h_owner ][ Interior ] = 15, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 11: return HouseInfo[ h_owner ][ InteriorX ] = 328.493988, HouseInfo[ h_owner ][ InteriorY ] = 1480.589966, HouseInfo[ h_owner ][ InteriorZ ] = 1084.449951, HouseInfo[ h_owner ][ Interior ] = 15, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 12: return HouseInfo[ h_owner ][ InteriorX ] = 385.803986, HouseInfo[ h_owner ][ InteriorY ] = 1471.769897, HouseInfo[ h_owner ][ InteriorZ ] = 1080.209961, HouseInfo[ h_owner ][ Interior ] = 15, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 13: return HouseInfo[ h_owner ][ InteriorX ] = 2451.77,    HouseInfo[ h_owner ][ InteriorY ] = -1699.80,	 HouseInfo[ h_owner ][ InteriorZ ] = 1013.51, 	  HouseInfo[ h_owner ][ Interior ] = 2, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 14: return HouseInfo[ h_owner ][ InteriorX ] = 2535.83, 	HouseInfo[ h_owner ][ InteriorY ] = -1674.32, 	 HouseInfo[ h_owner ][ InteriorZ ] = 1015.50, 	  HouseInfo[ h_owner ][ Interior ] = 1, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
				case 15: return HouseInfo[ h_owner ][ InteriorX ] = 2220.26, 	HouseInfo[ h_owner ][ InteriorY ] = -1148.01, 	 HouseInfo[ h_owner ][ InteriorZ ] = 1025.80, 	  HouseInfo[ h_owner ][ Interior ] = 15, Announce( playerid, "~w~House Interior~n~~g~~h~~h~Changed~w~.", 3000, 4 );
			}
			return 1;
	    }
Код:
function OnHouseCreated( hid )
{
	HouseInfo[ hid ][ hID ] = cache_insert_id( DB_Connect );
	return 1;
}
Also when i create the house there say to me: you created the house with id 0. But when i restart or reconnect the id is normal the next id created, ex: 1989..But when i create there shows to me is house id: 0, lol.. xD
So, the house created but, in the database doesn't insert the interiorx, interiory, interiorz, when i choose it from the dialog..Can help me ? These coords insert in the DB like: 0.00, 0.00, 0.00..And spawn me nowere..Why insert the coords 0.00, 0.00, 0.00 if when i choose from that dialog i choose another interior and to set that interior coords must be inserted instead ?

Please reply.
Reply


Messages In This Thread
Help with the House System !!! - by FaLLenGirL - 16.11.2016, 20:35
Re: Help with the House System !!! - by Micko123 - 17.11.2016, 06:27
Re: Help with the House System !!! - by FaLLenGirL - 17.11.2016, 14:52

Forum Jump:


Users browsing this thread: 2 Guest(s)