Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if ( cmd == "buyprop" )
- {
- if ( status[ player.ID ].Registered == false ) ErrorMessage( "[#FFFFFF]You need to be a part of our community to use this command.", player );
- else if ( status[ player.ID ].Logged == false ) ErrorMessage( "[#FFFFFF]You need to be identified to use this command.", player );
- else if(!text) ErrorMessage("Syntax - /" + cmd + " <PropID>", player );
- else if (!IsNum(text)) ErrorMessage("ID must be integer", player );
- else if ( text.tointeger() < 1 || text.tointeger() > GetPickupCount())ErrorMessage("Invalid Property ID", player );
- else
- {
- local prop = QuerySQL(pdb,"SELECT * FROM Properties WHERE PropertyID='"+escapeSQLString(text)+"'");
- local PX = GetSQLColumnData(prop, 1),
- PY = GetSQLColumnData(prop, 2),
- PZ = GetSQLColumnData(prop, 3);
- if( !PlayerToPoint( player, 1, PX.x, PY.y, PZ.z ) ) ErrorMessage( "You must be near the property pickup to buy property.", player );
- else if ( GetSQLColumnData(prop, 4) !="None") ErrorMessage("Property ID: ["+text+"] already purchased by: "+GetSQLColumnData(prop, 4), player );
- else if ( player.Cash < GetSQLColumnData(prop, 6)) ErrorMessage("You must have $"+GetSQLColumnData(prop, 6)+" to buy Name: "+GetSQLColumnData(prop, 0), player );
- else if ( isPropertyOwned( player ) == true ) ErrorMessage( "You cannot buy more than 1 property.", player );
- else{
- QuerySQL(pdb, "UPDATE Properties SET Owner='"+player.Name+"' WHERE PropertyID='"+escapeSQLString(text)+"'");
- DecCash( player, GetSQLColumnData(prop, 6) );
- SendMessage(YELLOW+"Congratulations, You just purchased a property ID: ["+text+"], Name: "+GetSQLColumnData(prop, 0),player);
- }
- FreeSQLQuery(prop);
- }
- }
Add Comment
Please, Sign In to add comment