Drifter96 Дата: Воскресенье, 06.03.2011, 11:30:54 | Сообщение # 1
Группа: Пользователи
Сообщений: 300
Ко всемforward-ам добавляем:
Code
forward IsADalnoboiCar(carid);
Потом вставляем этот паблик куда вам угодно:
Code
public IsADalnoboiCar(carid) { new model=GetVehicleModel(carid); if(model == 515 || model == 514 || model == 403) // {return 1;} return 0; }
Где 515,514,403 это ид грузовых машин. В public OnPlayerStateChange(playerid, newstate, oldstate) вставляем:
Code
if(IsADalnoboiCar(newcar)) { if(PlayerInfo[playerid][pJob] != 16 ) RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_GREY, "Ты не Дальнобойщик."); } }
А сейчас переходим к созданию команды:
Code
if(strcmp(cmd, "/gruz", true) == 0) { carid = GetPlayerVehicleID(playerid); if(PlayerInfo[playerid][pJob] != 16) { format(string, sizeof(string), " Вы не работаете дальнобойщиком!"); SendClientMessage(playerid, COLOR_GRAD1, string); return 1; } if (!IsADalnoboiCar(carid)) { SendClientMessage(playerid, COLOR_GRAD1, " Вы должны находится в фуре чтобы взять груз!"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); new listitems[] = "1\tОтвезти груз в ЛС\n2\tОтвезти груз в СФ\n3\tОтвезти груз в ЛВ"; ShowPlayerDialog(playerid,123,DIALOG_STYLE_LIST," Портативный Gps Навигатор:",listitems," Подтвердить"," Отмена"); return 1; }
А это команда чтобы выбрать куда везти груз.
Code
if(strcmp(cmd, "/ungruz", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pJob] != 16) { SendClientMessage(playerid, COLOR_GREY, " Вы не дальнобойщик!"); return 1; } new carid = GetPlayerVehicleID(playerid); new gTrailer = GetVehicleTrailer(carid); if(!IsTrailerAttachedToVehicle(carid)) { SendClientMessage(playerid, COLOR_GREY, "Вы приехали без груза!!!"); return 1; } new x_nr[256]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_WHITE, "Используйте: /upgruz название взависимости от локации"); SendClientMessage(playerid, COLOR_WHITE, "Доступные Названия: ls, sf, lv."); return 1; } if(strcmp(x_nr,"ls",true) == 0) { if(PlayerToPoint(3.0,playerid,2519.7297,-2440.3740,13.3399)) { format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); format(string, sizeof(string), "Вы доставили груз!"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "И получили премию в размере 7000$"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); GivePlayerMoney(playerid, 7000); SetVehicleToRespawn(gTrailer); DisablePlayerCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED1,"|Фура разгружена,отправляйтесь на базу|"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Вы не на складе."); return 1; } } else if(strcmp(x_nr,"sf",true) == 0) { if(PlayerToPoint(3.0,playerid,-2688.5688,234.7379,4.0589)) { format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); format(string, sizeof(string), "Вы доставили груз в Сан Фиеро!"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "И вы получили премию в размере 14000$"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); GivePlayerMoney(playerid, 14000); SetVehicleToRespawn(gTrailer); DisablePlayerCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED1,"|Фура разгружена,отправляйтесь на базу|"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Вы не на складе."); return 1; } } else if(strcmp(x_nr,"lv",true) == 0) { if(PlayerToPoint(3.0,playerid,-367.9283,1583.2257,75.9362)) { format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); format(string, sizeof(string), "Вы доставили груз!"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "И вы получили премию в размере 25000$"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); GivePlayerMoney(playerid, 25000); SetVehicleToRespawn(gTrailer); DisablePlayerCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED1,"|Фура разгружена,отправляйтесь на базу|"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Вы не на складе."); return 1; } } } }
Это команда чтобы сдать груз когда будешь стоять на ЧП. И последний штрих добавляем в public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]):
Code
else if(dialogid == 123) { if(!response) return 0; else { gPlayerCheckpointStatus[playerid] = CHECKPOINT_GPS; switch (listitem) { case 0: { SetPlayerCheckpoint(playerid,2519.7297,-2440.3740,13.3399,5.0); SendClientMessage(playerid, COLOR_LIGHTRED, "Склад на котрый требуется доствить груз отмечен на радаре!"); } case 1: { SetPlayerCheckpoint(playerid,-2688.5688,234.7379,4.0589,5.0); SendClientMessage(playerid, COLOR_LIGHTRED, "Склад на котрый требуется доствить груз отмечен на радаре!");
Автор: R@W Урок: Drifter96
Samp-Pawno.Ru forever
Сообщение Ко всемforward-ам добавляем:
Code
forward IsADalnoboiCar(carid);
Потом вставляем этот паблик куда вам угодно:
Code
public IsADalnoboiCar(carid) { new model=GetVehicleModel(carid); if(model == 515 || model == 514 || model == 403) // {return 1;} return 0; }
Где 515,514,403 это ид грузовых машин. В public OnPlayerStateChange(playerid, newstate, oldstate) вставляем:
Code
if(IsADalnoboiCar(newcar)) { if(PlayerInfo[playerid][pJob] != 16 ) RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_GREY, "Ты не Дальнобойщик."); } }
А сейчас переходим к созданию команды:
Code
if(strcmp(cmd, "/gruz", true) == 0) { carid = GetPlayerVehicleID(playerid); if(PlayerInfo[playerid][pJob] != 16) { format(string, sizeof(string), " Вы не работаете дальнобойщиком!"); SendClientMessage(playerid, COLOR_GRAD1, string); return 1; } if (!IsADalnoboiCar(carid)) { SendClientMessage(playerid, COLOR_GRAD1, " Вы должны находится в фуре чтобы взять груз!"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); new listitems[] = "1\tОтвезти груз в ЛС\n2\tОтвезти груз в СФ\n3\tОтвезти груз в ЛВ"; ShowPlayerDialog(playerid,123,DIALOG_STYLE_LIST," Портативный Gps Навигатор:",listitems," Подтвердить"," Отмена"); return 1; }
А это команда чтобы выбрать куда везти груз.
Code
if(strcmp(cmd, "/ungruz", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pJob] != 16) { SendClientMessage(playerid, COLOR_GREY, " Вы не дальнобойщик!"); return 1; } new carid = GetPlayerVehicleID(playerid); new gTrailer = GetVehicleTrailer(carid); if(!IsTrailerAttachedToVehicle(carid)) { SendClientMessage(playerid, COLOR_GREY, "Вы приехали без груза!!!"); return 1; } new x_nr[256]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_WHITE, "Используйте: /upgruz название взависимости от локации"); SendClientMessage(playerid, COLOR_WHITE, "Доступные Названия: ls, sf, lv."); return 1; } if(strcmp(x_nr,"ls",true) == 0) { if(PlayerToPoint(3.0,playerid,2519.7297,-2440.3740,13.3399)) { format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); format(string, sizeof(string), "Вы доставили груз!"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "И получили премию в размере 7000$"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); GivePlayerMoney(playerid, 7000); SetVehicleToRespawn(gTrailer); DisablePlayerCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED1,"|Фура разгружена,отправляйтесь на базу|"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Вы не на складе."); return 1; } } else if(strcmp(x_nr,"sf",true) == 0) { if(PlayerToPoint(3.0,playerid,-2688.5688,234.7379,4.0589)) { format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); format(string, sizeof(string), "Вы доставили груз в Сан Фиеро!"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "И вы получили премию в размере 14000$"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); GivePlayerMoney(playerid, 14000); SetVehicleToRespawn(gTrailer); DisablePlayerCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED1,"|Фура разгружена,отправляйтесь на базу|"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Вы не на складе."); return 1; } } else if(strcmp(x_nr,"lv",true) == 0) { if(PlayerToPoint(3.0,playerid,-367.9283,1583.2257,75.9362)) { format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); format(string, sizeof(string), "Вы доставили груз!"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "И вы получили премию в размере 25000$"); SendClientMessage(playerid, COLOR_LG, string); format(string, sizeof(string), "|____________________________|"); SendClientMessage(playerid, COLOR_RED1, string); GivePlayerMoney(playerid, 25000); SetVehicleToRespawn(gTrailer); DisablePlayerCheckpoint(playerid); SendClientMessage(playerid, COLOR_RED1,"|Фура разгружена,отправляйтесь на базу|"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Вы не на складе."); return 1; } } } }
Это команда чтобы сдать груз когда будешь стоять на ЧП. И последний штрих добавляем в public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]):
Code
else if(dialogid == 123) { if(!response) return 0; else { gPlayerCheckpointStatus[playerid] = CHECKPOINT_GPS; switch (listitem) { case 0: { SetPlayerCheckpoint(playerid,2519.7297,-2440.3740,13.3399,5.0); SendClientMessage(playerid, COLOR_LIGHTRED, "Склад на котрый требуется доствить груз отмечен на радаре!"); } case 1: { SetPlayerCheckpoint(playerid,-2688.5688,234.7379,4.0589,5.0); SendClientMessage(playerid, COLOR_LIGHTRED, "Склад на котрый требуется доствить груз отмечен на радаре!");
Автор: R@W Урок: Drifter96
Автор - Drifter96 Дата добавления - 06.03.2011 в 11:30:54