Автор: Dark_Ilya
Описание: Вводим команду /cuff, у игрока достаются наручники, потом ударяем игрока с объектом наручников, тем самым, одеваем их на игрока, ну а потом можно его посадить в автомобиль.
Ко всем #define
Code: Select all
#define GivePVarInt(%0,%1,%2) \
SetPVarInt(%0,%1,(GetPVarInt(%0,%1) + %2))
В public OnPlayerCommandtext
Code: Select all
else if(StrCmp(cmd, "/cuff"))
{
if(PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pMember] != 12) return SCM(playerid,COLOR_GREY,"Вы не полицейский!");
else if(GetPVarInt(playerid,"CufF") != 0) SetPVarInt(playerid,"CufF",0),RemovePlayerAttachedObject(playerid, 8),format(string, sizeof(string), "%s %s убирает наручники",GetNameRank(playerid), PlayerInfo[playerid][pName]),GivePVarInt(playerid, "Наручники", 1);
else if(GetPVarInt(playerid,"Наручники") == 0) return SCM(playerid,COLOR_WHITE,"У вас нет наручников!");
else if(GetPVarInt(playerid,"CufF") == 0)SetPVarInt(playerid,"CufF",1),SetPlayerAttachedObject(playerid,8,19418,6,-0.031999,0.024000,-0.024000,-7.900000,-32.000011,-72.299987,1.115998,1.322000,1.406000),format(string, sizeof(string), "%s %s достаёт наручники",GetNameRank(playerid), PlayerInfo[playerid][pName]),GivePVarInt(playerid, "Наручники", -1);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else if(StrCmp(cmd, "/cput"))
{
if(IsACop(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Используйте: /cput [id] [место (1-3)]");
if(ProxDetectorS(9.0, playerid, giveplayerid))return SendClientMessage(playerid, COLOR_GRAD1, "Игрок не рядом с вами!");
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new seatid = strval(tmp);
{
PutPlayerInVehicle(giveplayerid, vehicleid, seatid);
return true;
}
}
return true;
}
else if(StrCmp(cmd, "/uncuff"))
{
if(PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pMember] != 12) return SCM(playerid,COLOR_GREY,"Вы не полицейский!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Используйте: /uncuff [id]");
giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "[Ошибка] Игрок не найден!");
if(ProxDetectorS(5.0, playerid, giveplayerid))
{
format(string, sizeof(string), "%s %s снимает наручники с %s",GetNameRank(playerid), PlayerInfo[playerid][pName],PlayerInfo[giveplayerid][pName]);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
ClearAnimations(giveplayerid);
GameTextForPlayer(giveplayerid,"~g~UNCUFFED",2500,3);
GivePVarInt(playerid, "Наручники", 1);
GameTextForPlayer(playerid,"~g~UNCUFFED",2500,3);
}
return true;
}
в public OnPlayerKeyStateChange:
Code: Select all
else if(newkeys & 128 && newkeys & 4 )
{
new giveplayerid = GetPlayerTargetPlayer(playerid);
if(IsACop(playerid))
{
if(IsPlayerConnected(giveplayerid) && ProxDetectorS(5.0, playerid, giveplayerid))
{
if(IsACop(giveplayerid)) return SCM(playerid,COLOR_WHITE,"Нельзя надеть наручники на полицейского!");
if((GetPlayerWeapon(playerid) == 0 || GetPlayerWeapon(playerid) == 46 || GetPlayerWeapon(playerid) == 6 || GetPlayerWeapon(playerid) == 5 || GetPlayerWeapon(playerid) == 3 || GetPlayerWeapon(playerid) == 2) && GetPVarInt(playerid,"CufF") != 0)
{
if(PlayerCuffed[giveplayerid] >= 1) return true;
if(IsPlayerInAnyVehicle(giveplayerid)||IsPlayerInAnyVehicle(playerid))return true;
SetPVarInt(playerid,"CufF",0);
RemovePlayerAttachedObject(playerid, 8);
format(string, sizeof(string), "%s %s одел наручники на %s",GetNameRank(playerid), PlayerInfo[playerid][pName],PlayerInfo[giveplayerid][pName]);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerAttachedObject(giveplayerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_CUFFED);
GameTextForPlayer(giveplayerid,"~r~CUFFED",2500,3);
GameTextForPlayer(playerid,"~g~CUFFED",2500,3);
PlayerCuFFed[giveplayerid] = 1;
PlayerCuFFedTime[giveplayerid] = 5;
ApplyAnimation(giveplayerid,"CRACK","crckdeth2", 4.0, 0, 0, 0, 1, 0);
ApplyAnimation(giveplayerid,"CRACK","crckdeth2", 4.0, 0, 0, 0, 1, 0);
}
}
}
}
Ко всем stock
Code: Select all
stock StrCmp(string_1[], string_2[])
{
if(!strcmp(string_1, string_2, true))
{
return true;
}
return false;
}
Ну и сделайте где вам удобно выдачу наручников. Просто нужно добавить:
Code: Select all
GivePVarInt(playerid, "Наручники", 1);
P.S PlayerInfo[playerid][pName] использую, как оптимизацию, в public OnplayerConnect
Code: Select all
GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
Ну и в сам массив игрока pInfo
Code: Select all
pName,
Code: Select all
GetNameRank
Узнаёт название ранга, если кому-то надо, то вот:
Code: Select all
stock GetNameRank(playerid)
{
new atext[50];
switch(PlayerInfo[playerid][pMember])
{
case 0:
{
}
case 1:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Президент";
case 9: atext = "Вице-президент";
case 8: atext = "Советник по СМИ";
case 7: atext = "Контролёр по здравоохранения";
case 6: atext = "Советник по внутренних дел";
case 5: atext = "Советник по армиям";
case 4: atext = "Советник по Мафиям Бандам";
case 3: atext = "Пресс-Секретарь";
case 2: atext = "Охраник";
case 1: atext = "Водитель";
}
}
case 2..4:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Мэр";
case 9: atext = "Заместитель Мэра";
case 8: atext = "Депутат";
case 7: atext = "Старший лицензёр";
case 6: atext = "Лицензёр";
case 5: atext = "Старший секретарь";
case 4: atext = "Секретарь";
case 3: atext = "Начальник Охраны";
case 2: atext = "Охраник";
case 1: atext = "Водитель";
}
}
case 5:
{
if(PlayerInfo[playerid][pRank] == 10) atext = "Министр обороны";
}
case 6,7:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Генерал";
case 9: atext = "Полковник";
case 8: atext = "Подполковник";
case 7: atext = "Майор";
case 6: atext = "Капитан";
case 5: atext = "Летинант";
case 4: atext = "Старшена";
case 3: atext = "Ст.Сержант";
case 2: atext = "Сержант";
case 1: atext = "Рядовой";
}
}
case 8:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Адмирал";
case 9: atext = "Капитан 1 ранга";
case 8: atext = "Капитан 2 ранга";
case 7: atext = "Капитан 3 ранга";
case 6: atext = "Лейтенант";
case 5: atext = "Старшина";
case 4: atext = "Cт. сержант";
case 3: atext = "Сержант";
case 2: atext = "Ст.Матрос";
case 1: atext = "Матрос";
}
}
case 9:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Министр Внутренних Дел";
case 9: atext = "Зам.министра внутренних дел";
case 8: atext = "Ген.Прокурор";
case 7: atext = "Зам.ген прокурора";
case 6: atext = "Нач.национальной безопасности";
case 5: atext = "Прокурор";
case 4: atext = "Нач.Kадров";
case 3: atext = "Инспектор МВД";
case 2: atext = "Охранник МВД";
case 1: atext = "Водитель МВД";
}
}
case 10..12:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Генерал";
case 9: atext = "Полковник";
case 8: atext = "Подполковник";
case 7: atext = "Майор";
case 6: atext = "Капитан";
case 5: atext = "Ст.Лейтенант";
case 4: atext = "Лейтенант";
case 3: atext = "Ст.Сержант";
case 2: atext = "Сержант";
case 1: atext = "Рядовой";
}
}
case 13:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Директор";
case 9: atext = "Заместитель Директора";
case 8: atext = "Инспектор";
case 7: atext = "Глава отдела КСО";
case 6: atext = "Глава отдела ГНК";
case 5: atext = "Старший Агент";
case 4: atext = "Агент КСО";
case 3: atext = "Агент ГНК";
case 2: atext = "Младший Агент";
case 1: atext = "Стажёр";
}
}
case 14..16:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Директор";
case 9: atext = "Зам.Директора";
case 8: atext = "Редактор";
case 7: atext = "Помощник редактора";
case 6: atext = "Корректор";
case 5: atext = "Старший журналист";
case 4: atext = "Журналист";
case 3: atext = "Радиотехник";
case 2: atext = "Верстальщик новостей";
case 1: atext = "Помощник редакции";
}
}
case 17:
{
if(PlayerInfo[playerid][pRank] == 10) atext = "Министр Здравоохранения";
}
case 18..20:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Главный врач";
case 9: atext = "Заведующий отделением";
case 8: atext = "Старший специалист";
case 7: atext = "Младший специалист";
case 6: atext = "Врач-хирург";
case 5: atext = "Врач-терапевт";
case 4: atext = "Врач-участковый";
case 3: atext = "Старший медработник";
case 2: atext = "Младший медработник";
case 1: atext = "Интерн";
}
}
case 21:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Mad Dog";
case 9: atext = "Legend";
case 8: atext = "Des King";
case 7: atext = "Mobsta";
case 6: atext = "O.G.";
case 5: atext = "Gangsta";
case 4: atext = "Yuong";
case 3: atext = "Killa";
case 2: atext = "Hustle";
case 1: atext = "Playa";
}
}
case 22:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Big Willy";
case 9: atext = "Legend";
case 8: atext = "Faulks";
case 7: atext = "Federal Block";
case 6: atext = "Gangster";
case 5: atext = "Up Bro";
case 4: atext = "Gong bro";
case 3: atext = "Craker";
case 2: atext = "Junior Niga";
case 1: atext = "Blyde";
}
}
case 23:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Padre";
case 9: atext = "Ajunta";
case 8: atext = "Autoridad";
case 7: atext = "Bandido";
case 6: atext = "Ermanno";
case 5: atext = "Junior";
case 4: atext = "Macho";
case 3: atext = "Amigo";
case 2: atext = "Ladron";
case 1: atext = "Novato";
}
}
case 24:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Padre";
case 9: atext = "Nestro";
case 8: atext = "Tesosero";
case 7: atext = "Invasor";
case 6: atext = "Sabio";
case 5: atext = "Mirando";
case 4: atext = "Las Gerras";
case 3: atext = "Gettor";
case 2: atext = "Tirador";
case 1: atext = "Perrault";
}
}
case 25:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Padre";
case 9: atext = "Padrino";
case 8: atext = "Asesor";
case 7: atext = "Authoritarian";
case 6: atext = "Asesino";
case 5: atext = "Amigo";
case 4: atext = "Estimado";
case 3: atext = "Soldado";
case 2: atext = "Crime";
case 1: atext = "Novato";
}
}
case 26:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Don";
case 9: atext = "Consigliere";
case 8: atext = "Strada Boss";
case 7: atext = "Capo";
case 6: atext = "Soldato";
case 5: atext = "Combatendo";
case 4: atext = "Razionate";
case 3: atext = "Controllato";
case 2: atext = "Associato";
case 1: atext = "Novizio";
}
}
case 27:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Вор в законе";
case 9: atext = "Блатной";
case 8: atext = "Смотрящий";
case 7: atext = "Бригадир";
case 6: atext = "Зам.Бригадира";
case 5: atext = "Авторитет";
case 4: atext = "Бык";
case 3: atext = "Браток";
case 2: atext = "Босяк";
case 1: atext = "Шнырь";
}
}
case 28:
{
switch(PlayerInfo[playerid][pRank])
{
case 10: atext = "Кумитэ";
case 9: atext = "Сайко-комон";
case 8: atext = "Оядзи";
case 7: atext = "Камбу";
case 6: atext = "Со-хонбуте";
case 5: atext = "Вакагасира";
case 4: atext = "Сямэйгасира";
case 3: atext = "Кёдай";
case 2: atext = "Томодати";
case 1: atext = "Вакасю";
}
}
}
return atext;
}
Надо обязательно нажать ПКМ и ЛКМ, можете изменить, 128 - ПКМ, она нужна чтобы правильно использовать функцию
Code: Select all
GetPlayerTargetPlayer(playerid);