Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function LoadSVehicles() {
- for(new x = 1; x <= cache_num_rows(); x++) {
- Iter_Add(ServerCars, x);
- new s = x - 1;
- ServerVehicles[x][vID] = cache_get_field_content_int(s, "vID");
- ServerVehicles[x][vModel] = cache_get_field_content_int(s, "vModel");
- ServerVehicles[x][vLocation][0] = cache_get_field_content_float(s, "LocationX");
- ServerVehicles[x][vLocation][1] = cache_get_field_content_float(s, "LocationY");
- ServerVehicles[x][vLocation][2] = cache_get_field_content_float(s, "LocationZ");
- ServerVehicles[x][vAngle] = cache_get_field_content_float(s, "Angle");
- ServerVehicles[x][vColor][0] = cache_get_field_content_int(s, "Color1");
- ServerVehicles[x][vColor][1] = cache_get_field_content_int(s, "Color2");
- ServerVehicles[x][vFaction] = cache_get_field_content_int(s, "Faction");
- ServerVehicles[x][vRank] = cache_get_field_content_int(s, "Rank");
- ServerVehicles[x][vVirtual] = cache_get_field_content_int(s, "Virtual");
- ServerVehicles[x][vClan] = cache_get_field_content_int(s, "Clan");
- if(ServerVehicles[x][vModel] >= 400 && ServerVehicles[x][vModel] <= 611) {
- ServerVehicles[x][vSpawned] = CreateVehicleEx(ServerVehicles[x][vModel], ServerVehicles[x][vLocation][0], ServerVehicles[x][vLocation][1], ServerVehicles[x][vLocation][2], ServerVehicles[x][vAngle], ServerVehicles[x][vColor][0], ServerVehicles[x][vColor][1], -1);
- new idd = ServerVehicles[x][vSpawned];
- SetVehicleVirtualWorld(idd, ServerVehicles[idd][vVirtual]);
- if(ServerVehicles[idd][vFaction] != 0) {
- if(ServerVehicles[idd][vModel] == 411) {
- new policecar = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
- SetObjectMaterialText(policecar, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
- new lspdcar = CreateObject(19419,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
- AttachObjectToVehicle(policecar, idd, 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);
- AttachObjectToVehicle(lspdcar, idd, 0.0646, 0.1661, 0.6957, 0.0000, 0.0000, 0.0000);
- }
- if(ServerVehicles[idd][vModel] == 541) {
- if(ServerVehicles[idd][vFaction] == 2) {
- new object1 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- new object2 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- AttachObjectToVehicle(object1, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
- AttachObjectToVehicle(object2, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
- }
- }
- if(ServerVehicles[idd][vModel] == 525) {
- new object1 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- new object2 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- AttachObjectToVehicle(object1, idd, -0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
- AttachObjectToVehicle(object2, idd, 0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
- }
- }
- new str[64];
- if(ServerVehicles[idd][vFaction] != 0) format(str, 64, "F%d %d", ServerVehicles[idd][vFaction], idd);
- else format(str, sizeof(str), "RO-0%d", ServerVehicles[x][vSpawned]);
- SetVehicleNumberPlate(idd, str);
- }
- }
- printf("Server vehicles: %d", Iter_Count(ServerCars));
- return 1; }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
- if(ispassenger == 0) {
- new vehicle = GetVehicleID(vehicleid);
- if(ServerVehicles[vehicle][vID] != 0 && JobWorking[playerid] == 0) {
- if(vehicle >= 130 && vehicle <= 135) {
- if(GetPVarInt(playerid, "InLesson") == -1) return sendError(playerid, "Nu ai o lectie activa!"), SlapPlayer(playerid);
- }
- else if(ServerVehicles[vehicle][vFaction] == 1 || ServerVehicles[vehicle][vFaction] == 2 || ServerVehicles[vehicle][vFaction] == 3) {
- if(ServerVehicles[vehicle][vRank] > PlayerInfo[playerid][pRank]) {
- gMsg[0] = EOS;
- format(gMsg, sizeof(gMsg), "Ai nevoie de rank %d pentru a lua acest vehicul.", ServerVehicles[vehicle][vRank]);
- SCM(playerid, COLOR_GREY, gMsg);
- SlapPlayer(playerid);
- }
- else if(OnDuty[playerid] == 0 && IsACop(playerid)) {
- SCM(playerid, COLOR_LGREEN, "Nu poti folosi vehiculele factiunii daca nu esti la datorie!");
- SlapPlayer(playerid);
- return 1;
- }
- else if(!IsACop(playerid)) {
- gMsg[0] = EOS;
- format(gMsg, sizeof(gMsg), "Nu faci parte din factiunea %s.", FactionName(ServerVehicles[vehicle][vFaction]));
- SCM(playerid, COLOR_GREY, gMsg);
- SlapPlayer(playerid);
- }
- }
- else if(ServerVehicles[vehicle][vFaction] != PlayerInfo[playerid][pMember] && ServerVehicles[vehicle][vFaction] != 0) {
- gMsg[0] = EOS;
- format(gMsg, sizeof(gMsg), "Nu faci parte din factiunea %s.", FactionName(ServerVehicles[vehicle][vFaction]));
- SCM(playerid, COLOR_GREY, gMsg);
- SlapPlayer(playerid);
- }
- else {
- if(OnDuty[playerid] == 0 && IsACop(playerid) && Copcar2(vehicle)) {
- SCM(playerid, COLOR_LGREEN, "Nu poti folosi vehiculele factiunii daca nu esti la datorie!");
- SlapPlayer(playerid);
- return 1;
- }
- }
- }
- if(IsABoat(vehicleid) && GetPVarInt(playerid, "InLesson") == -1) {
- if(PlayerInfo[playerid][pBoatLic] < 1 && InDealer[playerid] == 0) {
- sendError(playerid,"Nu ai licenta de navigatie.");
- SlapPlayer(playerid);
- TogglePlayerControllable(playerid, 1);
- }
- }
- else if(IsAPlane(vehicleid) && GetPVarInt(playerid, "InLesson") == -1) {
- if(PlayerInfo[playerid][pFlyLic] < 1 && InDealer[playerid] == 0) {
- sendError(playerid,"Nu ai licenta de zbor.");
- SlapPlayer(playerid);
- TogglePlayerControllable(playerid, 1);
- }
- }
- else {
- if(PlayerInfo[playerid][pCarLic] < 1) {
- if(!IsAPlane(vehicleid) || IsABike2(vehicleid) || InExamen[playerid] == 1 || GetVehicleModel(vehicleid) == 471 || InDealer[playerid] > 0) { }
- else {
- sendError(playerid,"Nu ai licenta de condus.");
- SlapPlayer(playerid);
- TogglePlayerControllable(playerid, 1);
- SetTimerEx("UnFreezeStation", 500, 0, "i", playerid);
- }
- }
- }
- }
- return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement