Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dcmd_buycar(playerid, params[])
- {
- new field[3][32], mod, col1, col2, Query[128], price[64];
- if(sscanf(params, "ddd", mod, col1, col1)) return SendClientMessage(playerid, color_white, "[Info] Usage: /buycar [model] [color1] [color2] (/vehicles)");
- if(IsPlayerInRangeOfPoint(playerid, 15, 540.1616,-1289.9795,17.2422))
- {
- format(Query, sizeof(Query), "SELECT * FROM vehicle_prices WHERE model = '%d'", mod);
- mysql_query(Query);
- mysql_store_result();
- if(mysql_num_rows() == 0)
- {
- SendClientMessage(playerid,color_red,"[Error] Sorry, we do not have this vehicle model available yet. Try another one.");
- return 1;
- }
- if(IsCarColorValid(col1) && IsCarColorValid(col2))
- {
- format(price, sizeof(price), field[2]);
- if(PlayerInfo[playerid][pCash] > strval(price))
- {
- AddVehicle(mod, 562.8253,-1289.3542,16.9182,0.6401, col1, col2, 900000, 1, PlayerInfo[playerid][pSQLid], 0, 0, 100);
- AntiHackCash(playerid, -strval(price));
- SendFormattedMessage(playerid, color_green, "[Info] You have successfully purchased a %s from Grotti Dealership for $%d", VehicleName[mod-400], strval(price));
- SendClientMessage(playerid, color_white, "[Info] Your new vehicle is located near the exit");
- return 1;
- }
- else {
- SendClientMessage(playerid, color_red, "[Error] You don't have enough money to purchase this vehicle. Try another one.");
- return 1;
- }
- }
- else {
- SendClientMessage(playerid, color_red, "[Error] You have entered an invalid vehicle color! Try another one.");
- return 1;
- }
- }
- else { // 852
- SendClientMessage(playerid, color_red, "[Error] You aren't at the Grotti Car Dealership.");
- return 1; //854
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement