Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- YCMD:createvehicle(playerid, params[], help) {
- new Float: Pos[3], Float: Angle, string[256], szQuery[500], modelid, color[2];
- if(PlayerInfo[playerid][pScripter] < 1) return true;
- if(sscanf(params, "iii", modelid, color[0], color[1])) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/createvehicle <model> <color1> <color2>");
- if(400 <= modelid >= 611) return SCM(playerid, COLOR_GREY, "Invalid vehicle id. (400 - 611)");
- if(!(0 <= color[0] <= 255 && 0 <= color[1] <= 255)) return SCM(playerid, COLOR_GREY, "Invalid color id. (0 - 255)");
- if(IsPlayerInAnyVehicle(playerid)) return true;
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- GetPlayerFacingAngle(playerid, Angle);
- new carid = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Angle, color[0], color[1], -1);
- ServerVehicles[carid][vSpawned] = carid;
- SetVehicleNumberPlate(ServerVehicles[carid][vSpawned], "NewCar");
- PutPlayerInVehicleEx(playerid, ServerVehicles[carid][vSpawned], 0);
- ServerVehicles[carid][vID] = carid;
- ServerVehicles[carid][vModel] = modelid;
- ServerVehicles[carid][vLocation][0] = Pos[0];
- ServerVehicles[carid][vLocation][1] = Pos[1];
- ServerVehicles[carid][vLocation][2] = Pos[2];
- ServerVehicles[carid][vAngle] = Angle;
- ServerVehicles[carid][vColor][0] = color[0];
- ServerVehicles[carid][vColor][1] = color[1];
- mysql_format(SQL, szQuery, sizeof(szQuery),
- "INSERT INTO `svehicles` (vModel, LocationX, LocationY, LocationZ, Angle, Color1, Color2) VALUES ('%d', '%f', '%f', '%f', '%f', '%d', '%d')", modelid, Pos[0], Pos[1], Pos[2], ServerVehicles[carid][vAngle], color[0], color[1]);
- mysql_tquery(SQL, szQuery, "", "");
- format(string, sizeof(string), "Ai creat cu succes un %s (vID: %d).", aVehicleNames[modelid - 400], carid);
- SCM(playerid, COLOR_LGREEN, string);
- format(string, sizeof(string), "Acesta a fost adaugat cu succes in baza de date iar acum sunt in total %d vehicule!", carid);
- SCM(playerid, COLOR_LGREEN, string);
- SCM(playerid, COLOR_LGREEN, "Daca vrei sa modifici acest vehicul, foloseste comanda /editvehicle.");
- return true;
- }
- function LoadPlayerCars(playerid) {
- gQuery[0] = EOS;
- mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT * FROM `cars` WHERE `Userid`='%d' LIMIT %d", PlayerInfo[playerid][pSQLID], MAX_PLAYER_VEHICLE);
- mysql_tquery(SQL, gQuery, "SQL_LoadVehicles", "i", playerid);
- return true;
- }
- function SQL_LoadVehicles(playerid) {
- new componenets[20], coordonate[50], Mods[50];
- if(cache_num_rows() == 0)
- return true;
- for(new i = 0; i < cache_num_rows(); i++) {
- new id = Iter_Free(PersonalVehicles);
- new ORM:ormid = orm_create("cars");
- orm_addvar_string(ormid, CarInfo[id][cOwner], 32, "Owner");
- orm_addvar_string(ormid, CarInfo[id][cText], 32, "Text");
- orm_addvar_string(ormid, CarInfo[id][cLicense], 32, "License");
- orm_addvar_int(ormid, CarInfo[id][cID], "ID");
- orm_addvar_int(ormid, CarInfo[id][cModel], "Model");
- orm_addvar_int(ormid, CarInfo[id][cNeon], "Neon");
- orm_addvar_float(ormid, CarInfo[id][cLocationx], "Locationx");
- orm_addvar_float(ormid, CarInfo[id][cLocationy], "Locationy");
- orm_addvar_float(ormid, CarInfo[id][cLocationz], "Locationz");
- orm_addvar_float(ormid, CarInfo[id][cAngle], "Angle");
- orm_addvar_float(ormid, CarInfo[id][KM], "KM");
- orm_addvar_int(ormid, CarInfo[id][cTemporarTime], "TemporarTime");
- orm_addvar_int(ormid, CarInfo[id][cTemporar], "Temporar");
- orm_addvar_int(ormid, CarInfo[id][cVirtual], "Virtual");
- orm_addvar_int(ormid, CarInfo[id][cColorOne], "ColorOne");
- orm_addvar_int(ormid, CarInfo[id][cColorTwo], "ColorTwo");
- orm_addvar_int(ormid, CarInfo[id][cTextColor], "ColorText");
- orm_addvar_int(ormid, CarInfo[id][cValue], "Value");
- orm_addvar_int(ormid, CarInfo[id][cAlarm], "Alarm");
- orm_addvar_int(ormid, CarInfo[id][cLock], "Lockk");
- orm_addvar_int(ormid, CarInfo[id][paintjob], "paintjob");
- orm_addvar_int(ormid, CarInfo[id][Userid], "Userid");
- orm_addvar_int(ormid, CarInfo[id][cTimeGoto], "TimeGoto");
- orm_addvar_int(ormid, CarInfo[id][Confiscated], "Confiscated");
- orm_addvar_int(ormid, CarInfo[id][cSpecial], "Special");
- orm_addvar_int(ormid, CarInfo[id][cTax], "Tax");
- orm_addvar_int(ormid, CarInfo[id][cPoints], "Points");
- orm_addvar_int(ormid, CarInfo[id][cFuel], "Fuel");
- orm_addvar_int(ormid, CarInfo[id][cVip], "VIP");
- orm_addvar_int(ormid, CarInfo[id][cRainBow], "RainBow");
- orm_addvar_int(ormid, CarInfo[id][cLegendary], "Legendary");
- orm_addvar_int(ormid, CarInfo[id][cStage], "Stage");
- orm_addvar_int(ormid, CarInfo[id][Dayss], "Days");
- orm_addvar_string(ormid, componenets, 20, "Components");
- orm_addvar_string(ormid, Mods, 50, "Mods");
- orm_addvar_string(ormid, coordonate, 50, "Cordonate");
- orm_apply_cache(ormid, i);
- CarInfo[id][cMaxSpeed] = GetVehicleMaxSpeed(CarInfo[id][cModel]);
- CarInfo[id][cTime] = -1;
- CarInfo[id][cOnline] = playerid;
- sscanf(Mods, "p<|>iiiiiiiiiiiiii", CarInfo[id][cMod][0], CarInfo[id][cMod][1], CarInfo[id][cMod][2], CarInfo[id][cMod][3], CarInfo[id][cMod][4], CarInfo[id][cMod][5], CarInfo[id][cMod][6],
- CarInfo[id][cMod][7], CarInfo[id][cMod][8], CarInfo[id][cMod][9], CarInfo[id][cMod][10], CarInfo[id][cMod][11], CarInfo[id][cMod][12], CarInfo[id][cMod][13]);
- sscanf(coordonate, "p<|>ffffff", CarInfo[id][cVipPos][0], CarInfo[id][cVipPos][1], CarInfo[id][cVipPos][2], CarInfo[id][cVipPos][3], CarInfo[id][cVipPos][4], CarInfo[id][cVipPos][5]);
- Iter_Add(MyVehicle[playerid], id);
- Iter_Add(PersonalVehicles, id);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement