Фак | Дата: Воскресенье, 22.11.2015, 14:58 | Сообщение # 1 |
Сообщений: 312 |
|
Группа: Администраторы |
|
| Я думаю эта команда подойдет к многим сервера как к РП так и к Дрифт,Дм,Зомби,Стант. И так идем в самый вверх мода и ищем там define И к ним вставляем:
Код #define SetPlayerHoldingObject(%1,%2,%3,%4,%5,%6,%7,%8,%9) SetPlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJ ECTS-1,%2,%3,%4,%5,%6,%7,%8,%9) #define StopPlayerHoldingObject(%1) RemovePlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_ OBJECTS-1
Далее идем в OnPlayerCommandText и вставляем нашу команду с помощи которой мы сможем вешать оружие на спину:
Код if(strcmp("/hg", cmdtext, true, 10) == 0) { new weapon = GetPlayerWeapon(playerid); new ammo = GetPlayerAmmo(playerid); if(GetPVarInt(playerid,"Gun")>=1) { GivePlayerWeapon(playerid,GetPVarInt(playerid,"Gun"),GetPVarInt(playerid,"Ammo")); SendClientMessage(playerid,COLOR_WHITE,"* Вы достали свое оружие."); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s забирает повешенное оружие с себя.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); StopPlayerHoldingObject(playerid); SetPVarInt(playerid, "Gun", 0); SetPVarInt(playerid, "Ammo", 0); } else if(weapon == 22) { // Colt.45 SetPVarInt(playerid, "Gun", 22); SetPlayerHoldingObject(playerid, 346, 8, 0.0, 0.0, 0.1, -100.0, 0.0, 0.0); SendClientMessage(playerid,COLOR_WHITE,"* Повесили на ногу Colt 45"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил Colt 45 на ногу.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,22); } else if(weapon == 23) { // Colt.45 с Глушителем SetPVarInt(playerid, "Gun", 23); SetPlayerHoldingObject(playerid, 347, 8, 0.0, 0.0, 0.1, -100.0, 0.0, 0.0); SendClientMessage(playerid,COLOR_WHITE,"* Повесили на ногу Colt 45 Silencer"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил Colt 45 Silence на ногу.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,23); } else if(weapon == 24) { // Desert Eagle SetPVarInt(playerid, "Gun", 24); SetPlayerHoldingObject(playerid, 348, 8, 0.0, 0.0, 0.1, -100.0, 0.0, 0.0); SendClientMessage(playerid,COLOR_WHITE,"* Повесили на ногу Deagle"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил Deagle на правую ногу.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,24); } else if(weapon == 25) { // Shotgun SetPVarInt(playerid, "Gun", 25); SetPlayerHoldingObject(playerid, 349, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину ShotGun"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил ShotGun за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,25); } else if(weapon == 28) { // UZI SetPVarInt(playerid, "Gun", 28); SetPlayerHoldingObject(playerid, 352, 8, 0.0, 0.0, 0.1, -100.0, 0.0, 0.0); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили на ногу UZI"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил UZI на ногу.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,28); } else if(weapon == 29) { // MK5 SetPVarInt(playerid, "Gun", 29); SetPlayerHoldingObject(playerid, 353, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину MP5"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил MP5 за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,29); } else if(weapon == 30) { // Ak47 SetPVarInt(playerid, "Gun", 30); SetPlayerHoldingObject(playerid, 355, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину Ak47"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил Ak47 за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,30); } else if(weapon == 31) { // M4A1 SetPVarInt(playerid, "Gun", 31); SetPlayerHoldingObject(playerid, 356, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину M4"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил M4 за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,31); } else if(weapon == 32) { // Tech 9 SetPVarInt(playerid, "Gun", 32); SetPlayerHoldingObject(playerid, 372, 8, 0.0, 0.0, 0.1, -100.0, 0.0, 0.0); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили на ногу Tech-9"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил Tech-9 на ногу.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,32); } else if(weapon == 33) { // Country Rifle SetPVarInt(playerid, "Gun", 33); SetPlayerHoldingObject(playerid, 357, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину Country Rifle"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил Country Rifle за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,33); } else if(weapon == 34) { // Sniper Rifle SetPVarInt(playerid, "Gun", 34); SetPlayerHoldingObject(playerid, 358, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину Sniper Rifle"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил Sniper Rifle за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,34); } else if(weapon == 35) { // RPG SetPVarInt(playerid, "Gun", 35); SetPlayerHoldingObject(playerid, 359, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину RPG"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил RPG за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,35); } else if(weapon == 36) { // RPG-Automatical SetPVarInt(playerid, "Gun", 36); SetPlayerHoldingObject(playerid, 360, 1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000); SendClientMessage(playerid,COLOR_WHITE,"* Вы повесили за спину RPG-Auto"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s повесил RPG-Auto за спину.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetPVarInt(playerid, "Ammo", ammo); RemovePlayerWeapon(playerid,36); } else {} return 1; }
И тут самое важно в этом всем,ищем паблик: RemovePlayerWeapon Если у вас нету данного паблика то я покажу вам как создать его. Ко всем Forward добовляем или можно просто выше паблика RemovePlayer вставить как захотите:
Код forward RemovePlayerWeapon(playerid, weaponid); В самый низ вашего мода вставляем вот это:
Код public RemovePlayerWeapon(playerid, weaponid) { new plyWeapons[12] = 0; new plyAmmo[12] = 0; for(new sslot = 0; sslot != 12; sslot++) { new wep, ammo; GetPlayerWeaponData(playerid, sslot, wep, ammo); if(wep != weaponid && ammo != 0) GetPlayerWeaponData(playerid, sslot, plyWeapons[sslot], plyAmmo[sslot]); } ResetPlayerWeapons(playerid); for(new sslot = 0; sslot != 12; sslot++) { if(plyAmmo[sslot] != 0) GivePlayerWeapon(playerid, plyWeapons[sslot], plyAmmo[sslot]); } return 1; }
|
|
| |