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][pAdmin] < 6) return 1;
- if(sscanf(params, "iii", modelid, color[0], color[1])) return SCM(playerid, COLOR_WHITE, "{008080}USAGE: {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 1;
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- GetPlayerFacingAngle(playerid, Angle);
- new carid = GetServerVehicles()+1;
- ServerVehicles[carid][vSpawned] = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Angle, color[0], color[1], -1);
- 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` (vID, vModel, LocationX, LocationY, LocationZ, Angle, Color1, Color2) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d')", carid, modelid, Pos[0], Pos[1], Pos[2], ServerVehicles[carid][vAngle], color[0], color[1]);
- mysql_query(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!", GetServerVehicles());
- SCM(playerid, COLOR_LGREEN, string);
- SCM(playerid, COLOR_LGREEN, "Daca vrei sa modifici acest vehicul, foloseste comanda /editvehicle.");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement