Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GiveVehicle(playerid, modelid) {
- CP[playerid] = 53;
- new string[180];
- new idd;
- format(string, sizeof(string), "INSERT INTO cars (Model) VALUES (%d)", modelid);
- new Cache: result = mysql_query(SQL, string);
- new i = cache_insert_id();
- cache_delete(result);
- idd = i;
- new key = FindCSlot(playerid);
- PlayerInfo[playerid][pCarKey][key-1] = idd;
- mysql_format(SQL, string, sizeof(string), "UPDATE users SET CarKey%d='%d' WHERE `ID`='%d' LIMIT 1", key, PlayerInfo[playerid][pCarKey][key-1], PlayerInfo[playerid][pSQLID]);
- mysql_tquery(SQL, string, "", "");
- CarInfo[idd][Userid] = PlayerInfo[playerid][pSQLID];
- CarInfo[idd][cID] = idd;
- CarInfo[idd][cModel] = modelid;
- CarInfo[idd][cValue] = 1;
- CarInfo[idd][cSpecial] = 1;
- new randspawn = random(sizeof(DealerCarPos1));
- CarInfo[idd][cLocationx] = DealerCarPos1[randspawn][0]; CarInfo[idd][cLocationy] = DealerCarPos1[randspawn][1]; CarInfo[idd][cLocationz] = DealerCarPos1[randspawn][2];
- CarInfo[idd][cAngle] = DealerCarPos1[randspawn][3];
- CarInfo[idd][cColorOne] = 1; CarInfo[idd][cColorTwo] = 1;
- strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pUsername], 0, strlen(PlayerInfo[playerid][pUsername]), 255);
- strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
- CarInfo[idd][cAlarm] = 0; CarInfo[idd][cLock] = 0;
- CarInfo[idd][mod0] = 0; CarInfo[idd][mod1] = 0; CarInfo[idd][mod2] = 0; CarInfo[idd][mod3] = 0;
- CarInfo[idd][mod4] = 0; CarInfo[idd][mod5] = 0; CarInfo[idd][mod6] = 0; CarInfo[idd][mod7] = 0;
- CarInfo[idd][mod8] = 0; CarInfo[idd][mod9] = 0; CarInfo[idd][mod10] = 0; CarInfo[idd][mod11] = 0;
- CarInfo[idd][mod12] = 0; CarInfo[idd][mod13] = 0; CarInfo[idd][paintjob] = 3; CarInfo[idd][KM] = 0;
- CarInfo[idd][cPoints] = 5; CarInfo[idd][cTax] = 50;
- saveCar(idd);
- mysql_tquery(SQL, string, "", "");
- CarInfo[idd][Spawned] = CreateVehicleEx(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],CarInfo[idd][cColorOne],CarInfo[idd][cColorTwo],-1);
- new e,l,aa,d,b,bo,o;
- GetVehicleParamsEx(CarInfo[idd][Spawned],e,l,aa,d,b,bo,o);
- SetVehicleParamsEx(CarInfo[idd][Spawned],e,l,aa,1,b,bo,o);
- SetVehicleNumberPlate(CarInfo[idd][Spawned],CarInfo[idd][cLicense]);
- CarInfo[idd][cLock] = 1;
- format(string, sizeof(string), "Shop: %s si-a cumparat un %s[%d].", GetName(playerid), aVehicleNames[CarInfo[idd][cModel]-400], idd);
- submitToAdmins(COLOR_GREY, string, 1);
- InsertLog(playerid, string, LOG_CAR);
- VehicleOwned[CarInfo[idd][Spawned]] = CarInfo[idd][Spawned];
- VehicleSQL[CarInfo[idd][Spawned]] = idd;
- mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[idd][Spawned], idd);
- mysql_tquery(SQL, string, "", "");
- return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement