MuhammadZeeshan

asdasdasdasd

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