Advertisement
Guest User

Untitled

a guest
Jun 24th, 2010
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. dcmd_buycar(playerid, params[])
  2. {
  3. new field[3][32], mod, col1, col2, Query[128], price[64];
  4.  
  5. if(sscanf(params, "ddd", mod, col1, col1)) return SendClientMessage(playerid, color_white, "[Info] Usage: /buycar [model] [color1] [color2] (/vehicles)");
  6. if(IsPlayerInRangeOfPoint(playerid, 15, 540.1616,-1289.9795,17.2422))
  7. {
  8. format(Query, sizeof(Query), "SELECT * FROM vehicle_prices WHERE model = '%d'", mod);
  9. mysql_query(Query);
  10. mysql_store_result();
  11. if(mysql_num_rows() == 0)
  12. {
  13. SendClientMessage(playerid,color_red,"[Error] Sorry, we do not have this vehicle model available yet. Try another one.");
  14. return 1;
  15. }
  16. if(IsCarColorValid(col1) && IsCarColorValid(col2))
  17. {
  18. format(price, sizeof(price), field[2]);
  19. if(PlayerInfo[playerid][pCash] > strval(price))
  20. {
  21. AddVehicle(mod, 562.8253,-1289.3542,16.9182,0.6401, col1, col2, 900000, 1, PlayerInfo[playerid][pSQLid], 0, 0, 100);
  22. AntiHackCash(playerid, -strval(price));
  23. SendFormattedMessage(playerid, color_green, "[Info] You have successfully purchased a %s from Grotti Dealership for $%d", VehicleName[mod-400], strval(price));
  24. SendClientMessage(playerid, color_white, "[Info] Your new vehicle is located near the exit");
  25. return 1;
  26. }
  27. else {
  28. SendClientMessage(playerid, color_red, "[Error] You don't have enough money to purchase this vehicle. Try another one.");
  29. return 1;
  30. }
  31. }
  32. else {
  33. SendClientMessage(playerid, color_red, "[Error] You have entered an invalid vehicle color! Try another one.");
  34. return 1;
  35. }
  36. }
  37. else { // 852
  38. SendClientMessage(playerid, color_red, "[Error] You aren't at the Grotti Car Dealership.");
  39. return 1; //854
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement