02.02.2018, 18:42
So i've had some requests from my players to add an ability for regular vehicles to have sirens.I've tried it this way but couldn't work.I got a cmd which adds the organization vehicles so i'll put it here too.
What i tried:
CMD that adds the organization vehicles:
What i tried:
Код:
if (IsALaw(playerid) orgvid[orgid-1][giveplayerid-1] = CreateVehicle2(model, x, y, z, a, 900, addsiren=1);
Код:
CMD:addorgv(playerid, params[]) { new orgid, col1, col2, moneys1, tmp[256], tmp2[256], string[256], giveplayer[25], giveplayerid; if (adlvl[playerid] < 6) return 0; if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage2(playerid, COLOR_RED, "Error: You must be in a vehicle."); if (sscanf(params, "ddd", orgid, col1, col2)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /addorgv [orgid] [color1] [color2]"); format(string, 10, "org%d", orgid); if (!dini_Exists(AddDirFile(dir_orgfiles, string))) return SendClientMessage2(playerid, COLOR_RED, "Error: Invalid organization id."); if (col1 < -1 || col1 > 255 || col2 < -1 || col2 > 255) return SendClientMessage2(playerid, COLOR_RED, "Error: Invalid color id! (-1 - 255)"); for (new ovs = MAX_ORG_VEHICLES; ovs > 0; ovs--) { format(giveplayer, 12, "ocmodel_%d", ovs); if (dini_Int(AddDirFile(dir_orgfiles, string), giveplayer) == 0) giveplayerid = ovs; else moneys1 ++; } if (moneys1 == MAX_ORG_VEHICLES) { format(tmp2, sizeof(tmp2), "This organization has reached the max of %d vehicles.", MAX_ORG_VEHICLES); SendClientMessage2(playerid, COLOR_RED, tmp2); return 1; } new pvid = GetPlayerVehicleID(playerid); if (vorgo[pvid] != 0) return SendClientMessage2(playerid, COLOR_RED, "This vehicle already belongs to an organization."); new Float:x, Float:y, Float:z, Float:a; GetVehiclePos(pvid, x, y, z); GetVehicleZAngle(pvid, a); new model = GetVehicleModel(pvid); format(giveplayer, 12, "ocmodel_%d", giveplayerid); dini_IntSet(AddDirFile(dir_orgfiles, string), giveplayer, model); format(giveplayer, 12, "ocx_%d", giveplayerid); dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, x); format(giveplayer, 12, "ocy_%d", giveplayerid); dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, y); format(giveplayer, 12, "ocz_%d", giveplayerid); dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, z); format(giveplayer, 12, "oca_%d", giveplayerid); dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, a); format(giveplayer, 12, "occ1_%d", giveplayerid); dini_IntSet(AddDirFile(dir_orgfiles, string), giveplayer, col1); format(giveplayer, 12, "occ2_%d", giveplayerid); dini_IntSet(AddDirFile(dir_orgfiles, string), giveplayer, col2); SetVehicleToRespawn(pvid); if (col1 == -1 || col2 == -1) orgvid[orgid-1][giveplayerid-1] = CreateVehicle2(model, x, y, z, a, 900); else { orgvid[orgid-1][giveplayerid-1] = CreateVehicle(model, x, y, z, a, col1, col2, 900); vmodelused[model-400] ++; if (vmodelused[model-400] == 1) vehiclemodels ++; } if (dini_Isset(AddDirFile(dir_orgfiles, string), "lplate")) { format(tmp, 24, "%s %d", dini_Get(AddDirFile(dir_orgfiles, string), "lplate"), giveplayerid); SetVehicleNumberPlate2(orgvid[orgid-1][giveplayerid-1], tmp); SetVehicleToRespawn(orgvid[orgid-1][giveplayerid-1]); } vorgo[orgvid[orgid-1][giveplayerid-1]] = orgid; vorgid[orgvid[orgid-1][giveplayerid-1]] = giveplayerid; SendPlayerFormattedText(playerid, COLOR_SILVER, "Vehicle '%s' has been added to '%s'.", vehName[model-400], dini_Get(AddDirFile(dir_orgfiles, string), "name")); return 1; }